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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000



int main (void)
{
	llint N,H;
	cin >> H >> N;
	vector<pair<llint, llint> > P(N);
	rep(i,0,N) {
		cin >> P[i].F >> P[i].S;
	}

	vector<llint> dp(H+1e4+1,INF64);

	dp[0] = 0;

	for(llint i=0;i<H;i++) {
		if (dp[i] < INF64) {
			for(llint j=0;j<N;j++) {
				dp[i+P[j].F] = min(dp[i+P[j].F], dp[i]+P[j].S);
			}
		}
	}

	llint ans=INF64;

	for(llint i=H;i<=H+1e4;i++){
		ans = min(ans,dp[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(){
  string s;
  cin >> s;
  for(int i=0 ; i<s.size(); i++){
    //int aaa = s.at(i) - '0';
    //cout << aaa << " " ;
  } //cout << endl;
  int n = s.size();
  
  
  ll ans = 0;
  for(int i=0; i<(1<<(n-1)); i++){//例: n=3の場合 i<2^2 4回ループする   
    ll num = 0;//addする数字を一時保存する箱
    
    for(int j=0; j<n; j++){//例:s=124なら j=0,1,2の3回ループ
      if(i & (1<<n-j-1)){//iを二進表記したときに (左から)j番目が1なら...
        ans += num;//分割('+'を挿入する)と考え，ansにaddする
        //cout << "yah1 i: "<< i <<" ans: " << ans <<  " num: " << num << endl;
        num = 0;
        num = s.at(j) - '0';
      }
      else{//'+'を挿入しないなら
        num = num * 10;//今の数字を10倍
        num += s.at(j) - '0'; //左からj番目の数字を足す
      }
    }
    ans += num; //最後は+が挿入されないので，
    //cout <<"yah2 i: " << i <<" ans: " << ans << " num: " << num << endl;
  }
    
  cout << ans << endl;
  
  
  
  /*
  ll ans = 0;
  for(int i=0; i<(1<<(n-1)); i++){//例: n=3の場合 i<2^2 4回ループする   
    ll num = 0;//addする数字を一時保存する箱
    
    for(int j=n-1; j>=0; j--){//例:s=124なら j=0,1,2の3回ループ
      if(i & (1<<j)){//iを二進表記したときに (右から)j番目が1なら...
        ans += num;//分割('+'を挿入する)と考え，ansにaddする
        //cout << "yah1 i: "<< i <<" ans: " << ans <<  " num: " << num << endl;
        num = 0;
        num = s.at(n-j-1) - '0';
      }
      else{//'+'を挿入しないなら
        num = num * 10;//今の数字を10倍
        num += s.at(n-j-1) - '0'; //右からj番目(左からn-j-1番目)の数字を足す
      }
    }
    ans += num; //最後は+が挿入されないので，
    //cout <<"yah2 i: " << i <<" ans: " << ans << " num: " << num << endl;
  }
    
  cout << ans << endl;
  */
}

Measured memory_bytes: 256
a,b = map(str, input().split())
a = int(a)
li_b = []
for i in range(4):
    B = b[i]
    if B!=".":
        li_b.append(int(B))
b = 100*li_b[0] + 10*li_b[1] + li_b[2]

ans = a*b // 100
print(ans)

Measured memory_bytes: 9072
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k - 1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include<iostream>
//#include<vector>
//#include<map>
//#include<math.h>
//#include<algorithm>

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define rrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

set<int> ans;

void solve(v2_int &g, map<pii,int> &tree, v_int &used, int from, int c = 0)
{
    int color = 1;
    for(auto to : g[from]) {
        if(to == from) { continue; }
        if(color == c) { color++; }
        if(used[to]) { continue; }
        used[to] = 1;
        if(to < from) { 
            tree[pii(to,from)] = color; 
        } else {
            tree[pii(from,to)] = color; 
        }

        ans.insert(color);
        solve(g, tree, used, to, color++);
    }
}

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

    v2_int g(n);
    v_int a(n-1), b(n-1);
    rep(i,n-1) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    
    map<pii, int> tree;
    v_int used(n);
    used[0] = 1;

    solve(g, tree, used, 0);
    cout << ans.size() << endl;
    rep(i,n-1) {
        cout << tree[pii(a[i], b[i])] << endl;
    }
    return 0;
} /*atcoder*/



Measured memory_bytes: 18888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
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; }
//DはDPのD!
#define int long long
#define itn int
signed main(void){
    string s; cin>>s;
    int n = s.size();
    set <int> se;
    vector <bool>  data(n+1) ;
    for(int i=0;i<n-1;i++){
        if(s[i] == 'R'&& s[i+1]=='L') {se.insert(i); data[i] = data[i+1] = true;}
    }
    vector <int> ans(n); 
    for(int i=0;i<n;i++){
        if(data[i]) {ans[i]++; continue;}
        if(s[i] == 'R'){
        int r = *(se.lower_bound(i));
        //cout<<r<<endl;
        if((r-i) %2 == 0) ans[r]++;
        else ans[r+1]++;
        }else{
            int l = *(--se.lower_bound(i));
            //cout<<l<<endl;
            if((l-i) %2 == 0) ans[l]++;
            else ans[l+1]++;
        }
    }
    rep(i, n) cout<<ans[i]<<' ';
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n, m; cin >> n >> m;
  ll min_time = 1900*m + (n-m)*100;

  cout << min_time * pow(2, m) << endl;
}

Measured memory_bytes: 4144
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append((a+b, a, b))
    A.sort(reverse=True)
    takahashi = aoki = 0
    for i, (_, a, b) in enumerate(A):
        if i % 2 == 0:
            takahashi += a
        else:
            aoki += b
    print(takahashi - aoki)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20972
#include <iostream>
#include <stdio.h>
using namespace std;
#define LL long long
const LL maxn = (1<<18)+22;

int a[maxn];

struct node
{
	int a,b;
}Max[maxn];

void f(int x,node &b)
{
	if(b.a==x||b.b==x) return;
	if(a[b.a]<a[x]) swap(b.a,b.b),b.a=x;
	else if(a[b.b]<a[x]) b.b=x;
}


int main()
{
	int n;
	scanf("%d",&n);
	int N=1<<n;
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
		Max[i].a=i;
		Max[i].b=N;
	}
	for(int i=1;i<N;i++){
		for(int j=0;j<n;j++){
			if(i&(1<<j)){
				int k=i^(1<<j);
				f(Max[k].a,Max[i]);
				f(Max[k].b,Max[i]);
			}
		}
	}
	int ans=0;
	for(int i=1;i<N;i++){
		ans=max(ans,a[Max[i].a]+a[Max[i].b]);
		printf("%d\n",ans);
	}


	return 0;
}


Measured memory_bytes: 6144
/**
 *    author:  tourist
 *    created: 14.07.2018 15:39:29       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  n *= 2;
  int bal = 0;
  string t = "";
  vector<string> res;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a') {
      bal++;
    } else {
      bal--;
    }
    t += s[i];
    if (bal == 0) {
      if (t[0] == 'a') {
        int tlen = (int) t.length();
        vector<int> as, bs;
        for (int j = 0; j < tlen; j++) {
          if (t[j] == 'a') {
            as.push_back(j);
          } else {
            bs.push_back(j);
          }
        }
        string cur = "";
        int start = 0;
        for (int j = 0; j < tlen / 2; j++) {
          if (as[j] >= start) {
            cur += "ab";
            start = bs[j] + 1;
          }
        }
        res.push_back(cur);
      } else {
        string cur = t;
        while (t != "") {
          string new_t = "";
          int first_a = 1, first_b = 1;
          for (int j = 0; j < (int) t.length(); j++) {
            if (t[j] == 'a' && first_a) {
              first_a = 0;
              continue;
            }
            if (t[j] == 'b' && first_b) {
              first_b = 0;
              continue;
            }
            new_t += t[j];
          }
          t = new_t;
          cur = max(cur, t);
        }
        res.push_back(cur);
      }
      t = "";
    }
  }
  int sz = (int) res.size();
  vector<int> good(sz, 1);
  for (int i = 0; i < sz; i++) {
    for (int j = i + 1; j < sz; j++) {
      if (res[i][0] == 'a' && res[j][0] == 'b') {
        good[i] = 0;
      }
      if (res[i][0] == 'b' && res[j][0] == 'b' && res[i] < res[j]) {
        good[i] = 0;
      }
    }
  }
  for (int i = 0; i < sz; i++) {
    if (good[i]) {
      cout << res[i];
    }
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<math.h>

bool is_prime(int n){
  int sq = (int)sqrt(n);
  for(int i = 2; i <= sq; i++){
    if(n % i == 0){
      return false;
    }
  }
  return true;
}

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

  int count = 0;
  for(int i = 0; i < n; i++){
    int m;
    std::cin >> m;
    if(is_prime(m)) count++;
  }
    
  std::cout << count << std::endl;
 
  return 0;
}



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String... nui) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		
		int c = Math.abs(x - a);
		int d = Math.abs(x - b);
		
		System.out.println((c < d) ? "A" : "B");
		
	}

}

Measured memory_bytes: 21844
#include <stdio.h>
#define mod 1000000007
typedef long long ll;

ll mpow(ll a, ll b) {
  ll ans = 1;
  while( b ) {
    if(b & 1) ans *= a, ans %= mod;
    a *= a, a %= mod, b >>= 1;
  }
  return ans;
}

ll rev(ll a) {
  return mpow(a, mod - 2);
}

int main(void) {
  ll i, j, k, n, ans = 0, now;
  scanf("%lld%lld", &n, &k);
  ll fact[2 * n];
  fact[0] = 1;
  for(i = 1; i < 2 * n; ++i) fact[i] = fact[i - 1] * i, fact[i] %= mod;
  if(k < n) {
    for(i = 0; i <= k; ++i) {
      now = fact[n - 1] * rev(fact[i]);
      now %= mod;
      now *= rev(fact[n - 1 - i]);
      now %= mod;
      now *= fact[n];
      now %= mod;
      now *= rev(fact[n - i]);
      now %= mod;
      now *= rev(fact[i]);
      now %= mod;
      ans += now;
      ans %= mod;
    }
  } else {
    ans = fact[2 * n - 1] * rev(fact[n]);
    ans %= mod;
    ans *= rev(fact[n - 1]);
    ans %= mod;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 3328
R, G, B, N = map(int, input().split())
count = 0
rgb = sorted([R, G, B], reverse=True)
if False:
    count = 0
else:
    for i in range(N+1):
        for j in range(N+1):
            tmp = N - (rgb[0] * i + rgb[1] * j)
            if 0 > tmp:
                break
            if tmp % rgb[2] == 0:
                count += 1
print(count)


Measured memory_bytes: 40556
/*
___ is a raging sadist.
*/
//Destroy all WA at test 2
// Stay cool
// Pass the 4th wall..

#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define pow power
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define siz(a) int((a).size())
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define endl "\n"
#define pi 3.14159265
const ll mod = 1000 * 1000 * 1000 + 7;
const ll mod1 = 998244353;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7; 
using namespace std;

ll power(ll x, ll y) 
{ 
   ll res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  

        y = y>>1; 

        if (x<=100000000)
        x = (long long)(x*x);

        //cout<<x<<'\n'; 
    } 
    return res; 
} 




ll x[200005]; ll y[200005];

int main()
{

#ifndef ONLINE_JUDGE    
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif

fastio();

    ll n,d;
    cin>>n>>d;

    For(i,0,n)
    cin>>x[i]>>y[i];

    ll cnt=0;

    d=d*d;

    For(i,0,n)
    {
        ll now=x[i]*x[i]+y[i]*y[i];

        if (now<=d)
            cnt+=1;
    }

    cout<<cnt;

return 0;
}

Measured memory_bytes: 6816
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long long
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
using namespace std;
ll a[2000005];
ll k;
ll cnt=1;
void dfs(ll n){
	if(n%k==0){
		cout<<cnt;
		return;
	}
	cnt++;
	dfs((n*10ll+7)%k);
}
int main(){
      
   cin>>k;
   if(k%2==0 || k%5==0){
   	  cout<<-1;
   	  return 0;
   }   
   dfs(7);
	
   
   
   
   
   
   
   
   
}
	
 
    


Measured memory_bytes: 3604
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
    FOR(i,2,p) {
      if (p%i==0) return false;
    }
  return true;
}

int main(){
  int n,x,t,mi,m[100];
  cin >> n >> x;
  t=x;
  mi=1000;
  REP(i,n){
    cin >> m[i];
    t-=m[i];
    if (mi>m[i]) mi=m[i];
  }
  cout << n+t/mi;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>
#include <string>

using namespace std;

int main() {
	long long int X;
	cin >> X;

	long long int money = 100;
	int year = 0;
	while (money < X) {
		money *= 1.01;
		year++;
	}

	cout << year << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
#define sz(x) (int)(x).size()
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=3e5+5,MOD=1e9+7;
 
 
bool vis[5005];
int n,k;
int main()
{	
 	
 	scanf("%d %d",&n,&k);

 	std::vector<int> dp(n),a(n);
 	for(int i=0;i<n;i++){
 		scanf("%d",&a[i]);
 		if(i)dp[i]=2e9;
 		for(int j=1;j<=k && i-j>=0;j++){
 			dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
 		}
 	}
 	printf("%d\n",dp[n-1] );
}
 

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

#pragma GCC optimization_level 3
#define _GLIBCXX_DEBUG

using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;



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

    vector<ll> d(n);
    ll ans;

    for (size_t i = 0; i < n; i++)
    {
        cin>>d.at(i);
    }

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

    ans = d.at(d.size()/2) - d.at(d.size()/2-1);

    cout<<ans<<endl;
    
}


Measured memory_bytes: 1152
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
const ll MAXN = 1e5;
vector<bool> used(MAXN,false);

int cnt[1000];

int main(){
    int n; cin >> n;
    cout << pow(n,3);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
    int fie[400002];
    int ans[400002]={0},te=0;
using namespace std;
int main(){
    int N,M;
    string S;
    cin>>N>>M;
    cin>>S;
    for(int i=0;i<S.size();i++){
        fie[i]=S[S.size()-1-i]-'0';
    }
    for(int i=S.size();i<400002;i++){
        fie[i]=1;
    }
    int now=0;
    while(1){
        if(now==S.size()-1)break;
        int kk=M;
        while(1){
            if(kk==0){
                puts("-1");
                return 0;
            }
            if(fie[now+kk]==0){
                ans[te]=kk;
                te++;
                now+=kk;
                break;
            }
            kk--;
        }
    }
    for(int i=0;i<te;i++){
        if(i!=0)printf(" ");
        printf("%d",ans[te-1-i]);
    }
    return 0;
}


Measured memory_bytes: 2560
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]

for y in range(h):
    for x in range(w):
        if s[y][x]=='.':
            count = 0
            for dy,dx in ((1,0),(1,1),(0,1),(1,-1),(-1,1),(0,-1),(-1,-1),(-1,0)):
                ny,nx = dy+y,dx+x
                if (0<=ny<h and 0<=nx<w and s[ny][nx]=="#"):
                    count += 1
            s[y][x] = str(count)
for i in s:
    print(''.join(i))

Measured memory_bytes: 39792
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b[ohara],c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
P p[ohara];
    
//------ Believe yourself as a genius!!!!!! ------

bool ok(ll x){
    ll cou=0;
    rep(i,n){
        if(p[i].fi<=x)continue;
        cou+=a[p[i].se]-x/b[p[i].se];
    }
    //if(x==4)Cout(cou);
    if(cou>k)return false;
    else return true;
}
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    reverse(b,b+n);
    rep(i,n){
        p[i]=m_p(a[i]*b[i],i);
        //cout<<p[i].fi<<"\n";
    }
    sort(p,p+n);
    reverse(p,p+n);
    ll le=0,ri=LINF,mid;
    while(ri-le>1){
        mid=(le+ri)/2;
        if(ok(mid))ri=mid;
        else le=mid;
    }
    //cout<<le<<" "<<ri<<"\n";
    //Cout(ok(4));
    rrep(i,max(le-10,0LL),min(ri+10,LINF+1)){
        //Cout(i);
        //Cout(ok(i));
        if(ok(i)==true){
            Cout(i);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<char,ll> mp; 

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>s;
    rep(i,Size(s)){
        mp[s[i]]++;
    }
    rep(i,Size(s)){
        if(mp[s[i]]%2==1){
            Cout("No");
            return 0;
        }
    }
    Cout("Yes");
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;



int main() {
  ll N,M;
  cin>>N>>M;
  if(M%2==0){
    ll m=M/2;
    ll a=m,b=m+1;
    for(int i=0;i<m;i++){
      cout<<a<<" "<<b<<endl;
      a--;
      b++;
    }
    a=M+1;
    b=N;
    if(N%2==0){
      b--;
    }
    for(int i=0;i<m;i++){
      cout<<a<<" "<<b<<endl;
      b--;
      a++;
    }
  }
  else{
    ll m=M/2;
    ll a=m+1,b=m+2;
    for(int i=0;i<m+1;i++){
      cout<<a<<" "<<b<<endl;
      a--;
      b++;
    }
    a=M+2;
    b=N;
    if(N%2==0){
      b--;
    }
    for(int i=0;i<m;i++){
      cout<<a<<" "<<b<<endl;
      b--;
      a++;
    }
  }
      
}


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

template <class lambda_type>
class make_recursive
{
    const lambda_type &func;
public:
    make_recursive(lambda_type &&f) : func(std::move(f)) {}
    template <class... Args> auto operator()(Args &&... args) const
    {
        return func(*this, std::forward<Args>(args)...);
    }
};

main()
{
    int n; cin>>n;
    vector<int> a(n);
    for(auto &e: a) cin>>e;
    vector<vector<int>> tree(n);
    for(int i=0; i<n-1; ++i)
    {
        int u,v; cin>>u>>v; --u,--v;
        tree[v].emplace_back(u);
        tree[u].emplace_back(v);
    }
    vector nlow(n, INT_MAX),ans(n,0);
    make_recursive([&](const auto &dfs, int v, int p)->void
    {
        auto ptr=lower_bound(begin(nlow), end(nlow), a[v]);
        const int plow=*ptr;
        *ptr=a[v];
        ans[v]=lower_bound(begin(nlow), end(nlow), INT_MAX)-begin(nlow);
        for(int u: tree[v]) if(p!=u) dfs(u,v);
        *ptr=plow;
    })(0,-1);
    for(int e: ans) cout << e << "\n";
}


Measured memory_bytes: 30816
#include <iostream>
#include <algorithm>
#include <cstring>
#include <limits>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int dp[n];
	memset(dp, 1000001, sizeof(int)*n);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < min(k+1+i, n); j++) {
			dp[j] = min(dp[j], dp[i] + abs(a[j] - a[i]));
		}
	}
	cout << dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 21;
const int M = 1e9+7;
int dp[N][1<<N];
bool g[N][N];
int n;

int f(int id, int mask) {
    if (id == n) return 1;
    int &r = dp[id][mask];
    if (r != -1) return r;
    
    r = 0;
    forn(i, 0, n) {
        if (((mask>>i)&1) && g[id][i]) {
            int next = mask^(1<<i);
            r = (r + f(id+1, next)) % M;
        }
    }
    return r;
    
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> n;
    forn(i, 0, n) {
        forn(j, 0, n) {
            cin >> g[i][j];
        }
    }
    
    memset(dp, -1, sizeof dp);
    cout << f(0, (1<<n)-1) << endl;
}


Measured memory_bytes: 175648
#include<stdio.h>
int main()
{
    int n, x, y, k, i, j;
    scanf("%d %d %d %d", &n, &k, &x, &y);
    int sum;
    i = n - k;
    if(i <= 0)
    {
        sum = n*x;
    }
    else{
        sum = k*x + i*y;
    }
    printf("%d\n", sum);
    return 0;
}


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

int main(){

  ll n,m;
  ll count = 0;
  vector<ll> points;
  
  cin >> n >> m;
  
  rep(i,n){
    ll point ;
    
    cin >> point;
    
    points.push_back(point);
    count += point;
  }
  
  sort(points.begin(),points.end());

  if(points.at(n-m) < (float)count /(4*m) ){
  
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  
    return 0;
}


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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n;
  string s;
  cin >> n >> s;

  map<char, int> cnt;
  for (auto e : s) ++cnt[e];

  i64 ans = 1;
  for (char c = 'a'; c <= 'z'; ++c) {
    ans *= (cnt[c] + 1);
    ans %= MOD;
  }

  cout << ans - 1 << "\n";

  return 0;
}

Measured memory_bytes: 512
S = input()
dp = []
for i in range(0, len(S)+1):
	lst = []
	for i in range(0, 13):
		lst.append(0)
	dp.append(lst)
dp[0][0] = 1
for i in range(0, len(S)):
	if S[i] == '?':
		for j in range(0, 10):
			for k in range(0, 13):
				dp[i+1][(10*k+j)%13] += dp[i][k]
				dp[i+1][(10*k+j)%13] %= 10**9 + 7
	else:
		for j in range(0, 13):
			dp[i+1][(10*j+int(S[i]))%13] += dp[i][j]
			dp[i+1][(10*j+int(S[i]))%13] %= 10**9 + 7
print(dp[len(S)][5])

Measured memory_bytes: 65372
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
using ll = long long;
using namespace std;
const ll mod = 1000000007;

const int bound = 3000000;
ll fact[bound], fact_inv[bound];

ll power( ll a, ll b ){
	ll res = 1;
	while( b > 0 ){
		if( b & 1 ) res = res*a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return res;
}

void init(){
	fact[0] = 1;
	int b = bound-10;
	for( int i = 0; i < b; ++i ){
		fact[i+1] = fact[i]*(i+1) % mod;
	}
	fact_inv[b] = power(fact[b], mod-2);
	for( int i = b-1; i >= 0; --i ){
		fact_inv[i] = fact_inv[i+1]*(i+1) % mod;
	}
}

ll comb( ll n, ll r ){
	if( n < r ) return 0;
	return ( fact[n]*fact_inv[r] ) % mod * fact_inv[n-r] % mod;
}

ll seq( ll x, ll y ){
	return ( comb(x+y+2, x+1)+mod-1 ) % mod;
}

int main(){
	init();
	ll a, b, c, d; cin >> a >> b >> c >> d;
	cout << ( seq(c, d) - seq(a-1, d) - seq(c, b-1) + seq(a-1, b-1) + 10*mod ) % mod << endl;
}

Measured memory_bytes: 47104
def func(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in range(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True
n=int(input())
while True:
    if func(n):
        break
    n=n+1
print(n)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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(){
    ll n,k; cin>>n>>k;
    vector<pair<ll,ll>> sushi(n); // sushi[i] = {美味しさ, 種類}
    vector<pair<ll,ll>> reserve;
    rep(i,n) cin>>sushi[i].second>>sushi[i].first;
    sort(sushi.begin(), sushi.end(), greater<pair<ll,ll>>());
    map<ll,ll> m;
    vector<ll> f, s;
    rep(i,n){
        if(m[sushi[i].second]==0){
            m[sushi[i].second]=1;
            f.push_back(sushi[i].first);
        }else{
            s.push_back(sushi[i].first);
        }
    }

    sort(f.begin(), f.end(), greater<ll>());
    sort(s.begin(), s.end(), greater<ll>());

    vector<ll> F(f.size()+1), S(s.size()+1);
    rep(i, f.size()){
        F[i+1]=F[i]+f[i];
    }
    rep(i, s.size()){
        S[i+1]=S[i]+s[i];
    }

    ll res=0;

    for(ll i=0; i<=k; i++){
        if(i>f.size() || (k-i)>s.size()) continue;
        chmax(res, F[i]+S[k-i]+i*i);
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 9588
#include <stdio.h>

#define f(i, q) for(int i = 0; i < q; i++)  

typedef long long ll;

int main() {
    ll i, j, k;
    ll ans = 0;

    char input;
    scanf("%c", &input);

    // printf("%d\n", input);

    if((input - 91) < 0) {
        printf("A\n");
    } else {
        printf("a\n");
    }

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

    return 0;
}


Measured memory_bytes: 1596
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 100005;

int n, m, d[MAXN], p[MAXN], ret[MAXN];
LL a[MAXN], k;

inline void Mul(int *x, int *y)
{
	static int t[MAXN];
	for (int i = 1; i < n; i ++)
		t[i] = x[y[i]];
	for (int i = 1; i < n; i ++)
		x[i] = t[i];
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 1; i <= n; i ++)
		a[i] = Read();
	m = Read(); scanf("%lld", &k);
	for (int i = 1; i < n; i ++)
		p[i] = ret[i] = i, d[i] = a[i + 1] - a[i];
	for (int i = 1, x; i <= m; i ++)
		x = Read(), swap(p[x], p[x - 1]);
	for (; k; k >>= 1, Mul(p, p))
		if (k & 1)
			Mul(ret, p);
	printf("%lld\n", a[1]);
	for (int i = 1; i < n; i ++)
		printf("%lld\n", a[i + 1] = a[i] + d[ret[i]]);
	return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>
 
int main()
{
    int n,i=1,x;
    scanf("%d",&n);
    while(i<=n){
        if(i%3==0){
            printf(" %d",i);
        }
        else{
            if(i%10==3){
                printf(" %d",i);
            }
            else{
                x=i;
                while(x){
                    if(x%10!=3){
                    x/=10;
                    }
                    else{
                        printf(" %d",i);
                        break;
                    }
                }
            }
        }
        i++;
    }
    printf("\n");
    return 0;
}
 



  

 



Measured memory_bytes: 2104
#include <iostream>

using namespace std;

int main() {
    int a,b,res;
    char op;

    while(true) {
        cin >> a >> op >> b;

        if (op == '?')
            break;

        switch (op) {
            case '+':
                res = a + b;
                break;
            case '-':
                res = a - b;
                break;
            case '*':
                res = a * b;
                break;
            case '/':
                res = a / b;
                break;
            default:
                break;
        }

        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
fun main(args: Array<String>) {
  val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
  solve(sc)
}

fun solve(sc: java.util.Scanner) {
  val N = sc.nextInt()
  val a = Array(N) { sc.nextInt() }
  var i = 0
  var pos = 0
  while (i < N) {
    pos = a[pos] - 1
    i++
    if (pos == 1) {
      println(i)
      return
    }
  }
  println(-1)
}


Measured memory_bytes: 55532
import sys
from sys import stdin
input = stdin.readline

road = int(input())
while road > 0:
    answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
    city = 0
    for _ in range(road):
        c1, c2, w = (int(n) for n in input().split(" "))
        answer[c1][c2] = w
        answer[c2][c1] = w
        city = max(city, c1, c2)
    city += 1
    for i in range(city):
        for j in range(city):
            for k in range(city):
                answer[j][k] = min(answer[j][k], answer[j][i] + answer[i][k])
    sum_ans = [-1 , float("inf")]
    for i in range(city):
        if sum(answer[i][:city]) < sum_ans[1]:
            sum_ans = [i, sum(answer[i][:city])]
    print(*sum_ans)
    road = int(input())

Measured memory_bytes: 7784
from math import ceil
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)[p - 1:]
l = 0
r = n - p

while l != r:
    k = ceil((l + r) / 2)
    b = a[k] + m
    if b < a[0] or (v - (n - k)) * m > (k * b - sum(a[:k])):
        r = k - 1
    else:
        l = k
print(p+l)

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

#define int long long

using namespace std;

int a[100031];
int d[100031];

 main () {
	int n;
	cin >> n;
	int kol = n * (n + 1) / 2, ans = 0, sum = 0;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum % kol) {
		cout << "NO";
		return 0;
	}
	int k = sum / kol;
	for (int i = 1;i < n;i ++) d[i] = a[i] - a[i + 1];
	d[n] = a[n] - a[1];
	for (int i = 1;i <= n;i ++) {
		d[i] += k;
		if (d[i] % n || d[i] < 0) {
			cout << "NO";
			return 0;
		}
//		cout << d[i] << ' ';
		ans += ((d[i]) / n);
	}	         
//	cout << ans << ' ' ;
	if (ans != k) {
		cout << "NO";
		return 0;
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}


//cout<<""<<endl;
int main(){
  string S;cin>>S;
  rep(i,S.size())cout<<"x";
  cout<<endl;
}





Measured memory_bytes: 256
def interest_rates(y, r, t)
  return t == 1 ? 1 + y * r / 100.0 : (1 + r / 100.0) ** y
end

until (n = gets.to_i).zero?
  y, arr, tmp1, ans = gets.to_i, [], 0, nil
  
  n.times do
    b, r, t = gets.split.map(&:to_i)
    tmp2 = interest_rates(y, r, t)
    ans, tmp1 = b, tmp2 if tmp1 < tmp2
  end
  
  puts ans
end

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

typedef long long ll;

const int MAXN = 5e5 + 5;

int N;
char s[MAXN];
int a[MAXN];
bool bio[MAXN];
set <int> sinks;

void update(int x) {
	if (x < 0 || x >= N || bio[x])
		return;
	bool sink = true;
	if (x && s[x - 1] == '<') {
		a[x] = max(a[x], a[x - 1]);
		if (!bio[x - 1])
			sink = false;
	}
	if (x < N - 1 && s[x] == '>') {
		a[x] = max(a[x], a[x + 1]);
		if (!bio[x + 1])
			sink = false;
	}
	if (sink)
		sinks.insert(x);
}

int main() {
	memset(a, -1, sizeof a);
	
	scanf("%s", s);
	N = strlen(s) + 1;
	
	for (int i = 0; i < N; i++)
		update(i);
	
	ll ans = 0;
	while (!sinks.empty()) {
		int x = *sinks.begin();
		sinks.erase(x);
		ans += ++a[x];
		bio[x] = true;
		update(x - 1);
		update(x + 1);
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 9088
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=2e5+10;
int n,a[N],b[N];
int main() {
    R(n);
    REP1(i,1,n) R(a[i]);
    REP1(i,1,n) b[a[i]]=i;
    set<int> s;
    s.insert(0);
    s.insert(n+1);
    LL ans=0;
    REP1(i,1,n) {
        auto it=s.lower_bound(b[i]);
        int r=*it-1;
        int l=*--it+1;
        LL cl=b[i]-l+1;
        LL cr=r-b[i]+1;
        ans+=cl*cr*i;
        s.insert(b[i]);
    }
    W(ans);
    return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#define N 105

int table[N][N];
 
int main(void) {
    int i, j, n, q;
    int id, t;
    char a[1024];
     
    scanf("%d\n", &n);
    for(i=0;i<=n;i++) {
        for(j=0;j<=n;j++) {
            table[i][j] = 0;
        }
    }
     
    for(i=0;i<n;i++) {
        scanf("%d %d", &id, &q);
        for(j=0;j<q;j++) {
            scanf("%d", &t);
            table[id][t] = 1;
        }
        gets(a);
    }
     
    for(i=1;i<=n;i++) {
        for(j=1;j<=n;j++) {
            printf("%d", table[i][j]);
            if(j<n) {
                printf(" ");
            } else {
                printf("\n");
            }
        }
    }
     
    return 0;
}

Measured memory_bytes: 644
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple
 
int main(){
  int n,m,k; cin >> n >> m >> k;
  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= m; j++)
      if(i*m+j*n-2*i*j == k || k == n*m){cout << "Yes" << endl; return 0;}
  cout << "No" << endl;
  return 0;
}

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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    int i,x,y;
    cin >> x >> y;
    if(y & 1)cout << "No";
    else
    {
        for(i=0;i<=y && i/2<=x;i+=2)
        {
            if(i+(x-i/2)*4 == y)
            {
                cout << "Yes";
                return 0;
            }
        }
        cout << "No";
    }
    return 0;
}


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

int main(void){
std::vector<int> len(3);
  for(int i=0;i<3;i++){
  std::cin>> len.at(i);
  }
  std::cout<< len.at(0)*len.at(1)/2 <<std::endl;
  return 0;
}

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



int main()
{
    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    int x = sx, y = sy;
    while (y < ty)
    {
        y++;
        std::cout << 'U';
    }
    while (x < tx)
    {
        x++;
        std::cout << 'R';
    }
    while (y > sy)
    {
        y--;
        std::cout << 'D';
    }
    while (x >= sx)
    {
        x--;
        std::cout << 'L';
    }
    while (y <= ty)
    {
        y++;
        std::cout << 'U';
    }

    while (x < tx)
    {
        x++;
        std::cout << 'R';
    }
    y--;
    std::cout << 'D';
    x++;
    std::cout << 'R';
    while (y >= sy)
    {
        y--;
        std::cout << 'D';
    }
    while (x > sx)
    {
        x--;
        std::cout << 'L';
    }
    y++;
    std::cout << 'U';

    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll a,b,c,d,e,na,nb,nc;

void func(){

	ll ans = 0;
	if(nc >= d){
		ans += nc*e;
		ans += nb*b;
		ans += na*a;
	}else{
		int count = d;
		ans = nc*c + nb*b + na*a;
		count -= nc;
		if(count > nb){
			count -= nb;
			nb = 0;
		}else{
			nb -= count;
			count = 0;
		}
		if(count > na){
			count -= na;
			na = 0;
		}else{
			na -= count;
			count = 0;
		}
		ans = min(ans,d*e+nb*b+na*a);
	}

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


int main(){

	while(true){
		scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
		if(a == 0 && b == 0 && c == 0 && d == 0 && e == 0)break;
		scanf("%d %d %d",&na,&nb,&nc);
		func();
	}

	return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>
#include <math.h>
#include <time.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int n, k, ans = 1;

	scanf("%d %d", &n, &k);

	for (int i = 0; i < n; i++) {
		if (ans * 2 - ans > k) {
			ans += k;
		}
		else {
			ans *= 2;
		}
	}
	printf("%d", ans);
}

Measured memory_bytes: 1732