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

int main(){
  string S;
  long K;
  cin >> S >> K;
  long num=0;
  while(S[num]=='1'){
    num++;
  }
  if(num>=K){
    cout << "1" << endl;
    return 0;
  }
  cout << S[num] << endl;
  return 0;
}

Measured memory_bytes: 256
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
vector<pair<ll, ll>> a[N];
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i++)
    {
        ll m, u, v;
        cin >> m;
        while (m--)
            cin >> u >> v, a[i].push_back({u - 1, v});
    }
    int ans = 0;
    for (ll i = 0; i < (1LL << n); i++)
    {
        for (ll j = 0; j < n; j++)
        {
            if (i & (1LL << j))
            {
                for (auto e : a[j])
                {
                    if (bool(i & (1LL << e.first)) != e.second)
                        goto l;
                }
            }
        }
        ans = max(ans, __builtin_popcount(i));
    l:;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <vector>

using namespace std;

typedef long long int ll;

vector<vector<ll>> range_sum(vector<ll>& v)
{
    int n = v.size();

    vector<vector<ll>> dp(n,vector<ll>(n));

    for (int i=0;i<n;++i) dp[i][i] = v[i];

    for (int i=0;i<n;++i)
    {
        for (int j=i+1;j<n;++j)
        {
            dp[i][j] = dp[i][j-1] + v[j];
        }
    }
    /**
    for (auto b:dp)
    {
        for (auto x:b)
        {
            cout<<x<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    **/
    return dp;
}

ll solve(vector<ll>& v)
{
    int n = v.size();

    vector<vector<ll>> rs = range_sum(v);

    vector<vector<ll>> dp(n,vector<ll>(n));
    /**
    for (int i=0;i<n;++i)
    {
        for (int j=0;j<n;++j)
        {
            dp[i][j] = rs[i][j];
            ll a = (i<j)?dp[i+1][j]:0;
            ll b = (j>i)?dp[i][j-1]:0;

            dp[i][j] -= min(a,b);
        }
    }
    **/

    for (int s=1;s<=n;++s)
    {
        int lim = n - s;
        for (int i=0;i<=lim;++i)
        {
            int j = i + s - 1;
            dp[i][j] = rs[i][j];
            ll a = (i<j)?dp[i+1][j]:0;
            ll b = (j>i)?dp[i][j-1]:0;

            dp[i][j] -= min(a,b);
        }
    }
    /**
    cout<<"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"<<endl;
    for (auto b:dp)
    {
        for (auto x:b)
        {
            cout<<x<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    **/
    ll my = dp[0][n-1];
    //cout<<"M"<<my<<endl;
    ll his = rs[0][n-1] - dp[0][n-1];
    //cout<<"H"<<his<<endl;
    return my-his;
}

int main()
{
    int N;
    cin>>N;
    vector<ll> v(N);

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

    cout<<solve(v)<<endl;

    return 0;
}


Measured memory_bytes: 144240
N = gets.chop.to_i
A = gets.chop.split.map(&:to_i)

b = []
rev_flg = false

A.each_with_index do |a, i|
  b.push(a) if i % 2 == 0
  b.unshift(a) if i % 2 == 1
end

b.reverse! if A.size % 2 == 1

puts b.join (' ')

Measured memory_bytes: 27356
package main

import "fmt"

func main() {
	var a, b, c, x int
	fmt.Scan(&a, &b, &c, &x)
	cnt := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			p := x - 500*i - 100*j
			if p >= 0 && p%50 == 0 && p/50 <= c {
				cnt++
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


# https://atcoder.jp/contests/abc169/tasks/abc169_e
def solve(n, ranges):
    a = sorted(map(lambda x: x[0], ranges))
    b = sorted(map(lambda x: x[1], ranges))

    if len(ranges) % 2 == 0:
        m_a = a[(len(a)//2)-1] + a[(len(a)//2)]
        m_b = b[(len(b)//2)-1] + b[(len(b)//2)]
    else:
        m_a = a[((len(a)+1)//2)-1]
        m_b = b[((len(b)+1)//2)-1]
    return m_b - m_a + 1



if __name__ == "__main__":
    n = int_in()
    ranges = mat_in(n)
    out(solve(n, ranges))

Measured memory_bytes: 126552
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

bool solve(int N, llint A, llint B, llint C, llint D) {
  B -= A;
  N--;
  
  llint cur = N * D;
  if (cur < B) return false;

  llint flips = min((cur - B) / (C + D), N*1LL);
  cur -= flips * (C + D);

  return cur - B <= N * (D - C);
}

int main(void) {
  int N, A, B, C, D;
  scanf("%d %d %d %d %d", &N, &A, &B, &C, &D);
  puts(solve(N, A, B, C, D) ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n,x,m;
    cin >> n >> x >> m;
    set<ll> st;
    set<ll> st2;
    ll ans = 0;
    ll nx = x;
    st.insert(nx);
    ll cnt=0;

    if (n<501010)
    {
        rep(i,n)
        {
            ans += nx;
            nx = (nx * nx ) % m;
        }
        cout << ans << endl;
        return 0;
    }


    rep(i,m+10)
    {
        cnt++;
        ans += nx;
        nx = (nx * nx) % m;
        auto itr = st.find(nx);
        if (itr!=st.end())
        {
            break;
        }
        st.insert(nx);
    }

    int loopcnt = 0;
    ll loopans = 0;
    int fx = nx;
    rep(j, m+10)
    {
        loopcnt++;
        st2.insert(nx);
        loopans += nx;
        nx = (nx * nx ) % m;
        auto itr = st2.find(nx);
        if (itr!=st2.end()) break;
    }
    ans += (n-cnt)/loopcnt * loopans;
    nx = fx;
    rep(i, (n-cnt)%loopcnt)
    {
        ans += nx;
        nx = (nx * nx ) % m;
    }
    cout << ans << endl;



}


Measured memory_bytes: 8240
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var num = parseInt(line[0]);
    var hi = parseInt(line[1]);
    var lo = parseInt(line[2]);
    var maxHP = 0;
    var maxInd = 0;
    var enm = [];
    var killcount = 0;
    var ans = 0;
    
    for(var i = 0; i<num; i++){
        enm[i] = parseInt(input[i+1]);
        if(enm[i] > maxHP){
            maxHP = enm[i];
            maxInd = i;
        }
    }
    
//    console.log(maxHP+" "+maxInd);
    var max = Math.ceil(maxHP / (lo));
    var min = 0
    var temp = 0
    ans = Math.ceil(maxHP / (2*lo));
    var basedamage = ans*lo;
    var flag = 0;
    var extra = 0;
    while(1){
        flag++;
        basedamage = ans * lo;
        for(var i = 0; i<num; i++){
            if(enm[i]>basedamage){
                extra += Math.ceil((enm[i] - basedamage) / (hi - lo));
            }
        }
        
//        console.log("max:"+max+" min:"+min+" ans:"+ans+" extra:"+extra+" temp:"+temp);
        
        if(extra > ans){
            temp = ans;
            ans = Math.ceil((max + ans) / 2);
            min = temp;
            
        } else if (extra < ans){
            temp = ans;
            ans = Math.ceil((min + ans) / 2);
            max = temp;
        } else {
            break;
        }

        if(ans === temp){
            break;
        }

        
        if(flag>100){
            break;
        }
        extra = 0;
        
    }

    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

ll MOD = 1e9+7;


int main(){
    ll N, K; cin >> N >> K;
    vector<vector<ll>> V(N);
    for(int i = 0; i < N-1; i++){
        ll a, b; cin >> a >> b; a--;b--;
        V[a].push_back(b);
        V[b].push_back(a);
    }
    ll ans = K;
    ans %= MOD;
    queue<ll> Q;
    vector<bool> grid(N); grid[0] = true;
    Q.push(0);
    bool flag = true;
    while(!Q.empty()){
        ll x = Q.front(); Q.pop();
        ll k;
        if(flag) {k = K-1; flag = false;}
        else k = K-2;
        for(auto v : V[x]){
            if(!grid[v]) {
                grid[v] = true;
                Q.push(v);
                ans*=k;
                ans%=MOD;
                k--;
            }
        }

    }
    cout << ans << endl;

}


Measured memory_bytes: 7284
#include <iostream>

int main()
{
	int a, b;
	std::cin >> a >> b;
	if (a < b)
	{
		std::cout << "a < b" << std::endl;
	}
	else if (a > b)
	{
		std::cout << "a > b" << std::endl;
	}
	else
	{
		std::cout << "a == b" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <cstdlib>

using namespace std;
typedef tuple<string, string, int> tssi;

int read_date(){
	string head;
	cin >> head;
	if(head == "*"){ return -1; }
	istringstream iss(head);
	int y, m, d;
	iss >> y; iss.ignore();
	iss >> m; iss.ignore();
	iss >> d;
	return y * 10000 + m * 100 + d;
}

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<tssi> books(n);
	for(int i = 0; i < n; ++i){
		string title, author;
		cin >> title >> author;
		const int date = read_date();
		books[i] = tssi(title, author, date);
	}
	int q;
	cin >> q;
	while(q--){
		string title, author;
		cin >> title >> author;
		int from = read_date();
		int to = read_date();
		if(from < 0){ from = 0; }
		if(to < 0){ to = 1000000000; }
		for(int i = 0; i < n; ++i){
			if(title != "*" && get<0>(books[i]).find(title) == string::npos){ continue; }
			if(author != "*" && get<1>(books[i]).find(author) == string::npos){ continue; }
			if(from <= get<2>(books[i]) && get<2>(books[i]) <= to){
				cout << get<0>(books[i]) << endl;
			}
		}
		if(q != 0){ cout << endl; }
	}
	return 0;
}

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

int main(void) {
    int H, W;
    int checkH = 1;
    int checkW = 1;
    
    while(true) {
        cin >> H >> W;
        
        if(H == 0 && W == 0)   break;
        
        checkH = 1;
        checkW = 1;
        for(int h = 0; h < H; ++h) {
            checkW = checkH;
            for(int w = 0; w < W; ++w) {
                if(checkW == 1) {
                    cout << "#";
                    checkW = 0;
                } else {
                    cout << ".";
                    checkW = 1;
                }
            }
            cout << endl;
            
            if(checkH == 1) {
                checkH = 0;
            } else {
                checkH = 1;
            }
        }
        cout << endl;
    }
    return 0;
}


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

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


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 200001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, m, k;
int a[SIZE], x[SIZE], y[SIZE];


map<int, int> cnt;

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


    for(int i = 0; i < n; i++)
    {
        x[i] = a[i] + i;
        y[i] = i - a[i];
        cnt[y[i]]++;
    }

    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        ans += cnt[x[i]];
        ans -= (y[i] == x[i] ? 1 : 0);
    }
    cout << ans;
    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;

//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 22932
#include<stdio.h>
#define H 250

int parent(int);
int left(int);
int right(int);

int main(){
  int i,n,heaps[H+1];
  int lk,rk;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&heaps[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,heaps[i]);
    if(i>1){
      printf("parent key = %d, ",heaps[parent(i)]);
    }
    rk=right(i);
    lk=left(i);
    if(lk<=n){
      printf("left key = %d, ",heaps[lk]);
    }
    if(rk<=n){
      printf("right key = %d, ",heaps[rk]);
    }
    printf("\n");
  }
  return 0;
}

int parent(int i)
{
  return i/2;
}
int left(int i)
{
  return i*2;
}
int right(int i)
{
  return i*2+1;
}
   

Measured memory_bytes: 600
fn main() {
	proconio::input!{
		x: usize,
		y: usize,
	}

	let g = [1, 3, 1, 2, 1, 2 ,1, 1, 2, 1, 2, 1];
	if g[x-1] == g[y-1] {
		println!("Yes");
	}
	else {
		println!("No");
	}
}


Measured memory_bytes: 2080
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B, C, D = lr()
S = input()
# if C > D:
#     if "..." not in S[B-1:D]:
#         print("No")
#         exit(0)
# if "##" in S[A-1:C] or "##" in S[B-1:D]:
#     print("No")
# else:
#     print("Yes")

ans = "Yes"
if C > D:
    tmp = S[B-2:D+1].count("...")
    if tmp == 0:
        ans = "No"

tmp = S[A-1:max(C, D)].count("##")
if tmp > 0:
    ans = "No"
print(ans)


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

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

	ll ans = 1;
	vector<ll> d;
	for (ll i = 1; i*i <= M; ++i)
	{
		if (M%i != 0)continue;
		if (i*N <= M)d.push_back(i);
		if ((M / i)*N <= M)d.push_back(M / i);
	}


	REP(i, d.size())
	{
		ans = std::max(ans, d[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
  Contest 070
  A - Palindromic Number
  Rakesh Kumar --> 03/09/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);
    int n = 0;
    std::cin >> n;
    std::cout << (n / 100 == n % 10 ? "Yes" : "No") << std::endl;

    return 0;
}


Measured memory_bytes: 3608
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n,r;cin>>n>>r;
	if(n>=10) cout<<r;
	else cout<<r + 100*(10-n)<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define cinf(x,n) for(int i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(int i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	ll h,w;
	while(true){
		cin >> h >> w;
		if(h==0&&w==0)
			break;
		rep(i,h){
			rep(j,w){
				if(i%2==0){
					if(j%2==0)
						cout << "#";
					else
						cout << ".";
				}else{
					if(j%2==0)
						cout << ".";
					else
						cout << "#";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}


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

typedef long long ll;
typedef pair<ll, ll> Pll;

int main() {
    int N; cin >> N;
    vector<Pll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A.begin(), A.end(), greater<Pll>());
    vector<vector<ll>> memo(N+1, vector<ll>(N+1, 0));

    memo[0][0] = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= i; j++) {
            if (i-j-1 >= 0) memo[i-j][j] = max(memo[i-j][j], memo[i-j-1][j] + A[i-1].first * abs(A[i-1].second - (i-j-1)));
            if (j-1 >= 0) memo[i-j][j] = max(memo[i-j][j], memo[i-j][j-1] + A[i-1].first * abs(A[i-1].second - (N-j)));
        }
    }

    ll ans = 0;
    for (int i = 0; i <= N; i++) {
        ans = max(ans, memo[N-i][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 34624
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 998244353;

vector<int> elist[200005];
int ans[200005]; bool pin[200005];
vector<pii> rob;
priority_queue<pair<pii, int>, vector<pair<pii, int>>, greater<pair<pii, int>>> pq;

int dfs(int node) {
    ans[node] = 1;
    ll prod = 1;
    for(int& i:elist[node]) prod = prod * dfs(i) % MOD;
    ans[node] += prod;
    if(ans[node] == MOD) ans[node]--;
    return ans[node];
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    rep(i, n) {
        int a, b; cin >> a >> b;
        rob.pb({a, b});
    }
    sort(all(rob));
    for(int i=n-1; i>=0; i--) {
        while(pq.size() && rob[i].fi+rob[i].se > pq.top().fi.fi) {
            elist[i].pb(pq.top().se);
            pin[pq.top().se] = 1;
            pq.pop();
        }
        pq.push({rob[i], i});
    }
    ll res = 1;
    rep(i, n) if(!pin[i]) res = res * dfs(i) % MOD;
    cout << res << endl;
}



Measured memory_bytes: 23152
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int a = 0, b = 0, c = 0;
        for (int i = 0; i < 10; i++) {
            int h = in.nextInt();
            if (a < h) {
                c = b;
                b = a;
                a = h;
            } else if (b < h) {
                c = b;
                b = h;
            } else if (c < h) {
                c = h;
            }
        }
        System.out.println(a + "\n" + b + "\n" + c);
    }
}

Measured memory_bytes: 26308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	string s;cin>>s;
	int n=s.size()+1;
	ll v[n];

	rep(i,n) v[i]=0;
	v[0]=0;v[n-1]=0;

	for(int i=0;i<n-1;i++) if(s[i]=='<') v[i+1]=max(v[i+1],v[i]+1);
//	rep(i,n) cout<<v[i];
//	cout<<"\n";
	for(int i=n-2;i>=0;i--) if(s[i]=='>') v[i]=max(v[i],v[i+1]+1);

	ll ans=0;
	rep(i,n){
		ans+=v[i];
	}

	cout<<ans<<"\n";
}

Measured memory_bytes: 4740
#include <iostream>
#include <vector>

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;

  vector<int> c(M);
  for(int i = 0; i < M; i++) { cin >> c[i]; }

  vector<int> dp(N+1, inf);       // dp[i] : i円を払うための最小枚数
  dp[0] = 0;
  for(int i = 1; i <= N; i++) {
    for(int j = 0; j < M; j++) {
      if( c[j] <= i ) {
        dp[i] = min(dp[i], dp[i-c[j]] + 1);
      }
    }
  }

  cout << dp[N] << "\n";

  return 0;
}

Measured memory_bytes: 3192
"""
AtCoder
    :author: vierbein
"""
from __future__ import absolute_import, division, print_function

# import itertools as it
# import collections
import sys
from heapq import *

def pp(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


N, M = map(int, input().split())
pairs = [[int(s) for s in input().split()] for _ in range(N)]
pairs = sorted(pairs)

idx = 0
h = []
res = 0

for rest in range(1, M + 1):
    while idx < N:
        a, b = pairs[idx]
        # pp(a, b, h)
        if a <= rest:
            heappush(h, -b)
            idx += 1
        else:
            break
    try:
        res += -heappop(h)
    except IndexError:
        pass

print(res)

Measured memory_bytes: 74328
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<algorithm>

using namespace std;

int main()
{int N; cin >> N;
 vector<int> A(N);
 for(int i = 0; i < N ; i++){cin >> A[i];}
 
 map<int, int> mp;
 
 for(int i = 0; i < N; i++)
 {mp[A[i]]++;}
 
 int cnt = 0;
 
 for(auto p: mp)
 {int s = p.first;
  int t = p.second;
 if(t >= s){cnt +=  t - s;}
  else{cnt += t;}
  
 } 
 cout << cnt << endl;
 return 0;
}
        

Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;

#define dump(...) DUMPOUT<<"  ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<std::endl;DUMPOUT<<"    ";dump_func(__VA_ARGS__)
#define PI 3.14159265358979323846
#define EPS 1e-10
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(j) (j).begin(), (j).end()
#define SZ(j) ((int)(j).size())

const int D = 365;

long long eval(vector<int> out, vector<int> c, vector<vector<int>> s) {
    long long sat = 0;
    vector<int> last(26, 0);
    // for d in range(D):
    REP(d, D) {
        //     assert(1 <= out[d] and out[d] <= 26)
        assert(1 <= out[d] and out[d] <= 26);
        //     j = out[d] - 1
        int j = out[d]-1;
        //     last[j] = d + 1
        last[j] = d+1;
        //     for i in range(26):
        REP(i, 26) {
            //         sat -= (d + 1 - last[i]) * c[i]
            sat -= (d+1-last[i]) * c[i];
        }
        //     sat += s[d][j]
        sat += s[d][j];
        cout << sat << endl;
    }
        
    // print("satisfaction: {}".format(sat))
    return sat;
    // print("score: {}".format(max(0, 1000000 + sat)))
}

int main() {

    int tempD;
    cin >> tempD;

    vector<int> c(26);
    REP(i, 26) cin >> c[i];

    vector<vector<int>> s(D, vector<int>(26));
    REP(d, D) REP(i, 26) cin >> s[d][i];

    vector<int> res(D);

    REP(d, D) {
        int t = 0;
        REP(i, 26) {
            if (s[d][i] > t) {
                t = s[d][i];
                res[d] = i+1;
            }
        }
    }



    for (int e : res) cout << e << endl;

    return 0;
}

Measured memory_bytes: 3660
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  ll ng=0,ok=INF;
  while(abs(ng-ok)>=2){
    ll mid=(ok+ng)/2;
    ll num=0;
    rep(i,0,n){
      num+=(a[i]+mid-1)/mid-1;
    }
    if(num<=k)ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
  return 0;
}

Measured memory_bytes: 4776
n=int(input())
primes=[0]*(n+1)
for i in range(2,n+1):
    cur = i
    for j in range(2,i+1):
        while cur%j == 0:
            primes[j]+=1
            cur//=j

def num(m):
    return len(list(filter(lambda x:x>=m-1, primes)))

print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)


Measured memory_bytes: 9140
#include <iostream>
#include <numeric>
#include <vector>

struct UnionFind {
    std::vector<int> par, sz;
    int gnum;

    explicit UnionFind(int n)
        : par(n), sz(n, 1), gnum(n) {
        std::iota(par.begin(), par.end(), 0);
    }

    int find(int v) {
        return (par[v] == v) ? v : (par[v] = find(par[v]));
    }

    void unite(int u, int v) {
        u = find(u), v = find(v);
        if (u == v) return;

        if (sz[u] < sz[v]) std::swap(u, v);
        sz[u] += sz[v];
        par[v] = u;
        --gnum;
    }

    bool same(int u, int v) { return find(u) == find(v); }
    bool ispar(int v) { return v == find(v); }
    int size(int v) { return sz[find(v)]; }
};

void solve() {
    int n;
    std::cin >> n;

    UnionFind uf(n);

    int m;
    std::cin >> m;
    while (m--) {
        int u, v;
        std::cin >> u >> v;
        uf.unite(--u, --v);
    }

    int ans = 0;
    for (int v = 0; v < n; ++v) {
        ans = std::max(ans, uf.size(v));
    }

    std::cout << ans << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 4732
/**
 *      ABC 55 C
 *      author  : kyomukyomupurin
 *      created : 2018-09-11 10:24:33
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, M; cin >> N >> M;

    if (2 * N == M){
        cout << N << endl;
    }
    else if (2 * N > M){
        cout << M / 2 << endl;
    }
    else if (2 * N < M){
        cout << N + (M - 2 * N) / 4 << endl;
    }
}

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

using namespace std;
using ll = long long;


int main()
{
    int n, k;
    string s;
    cin >> n >> k >> s;
    for(auto &i : s)i -= '0';
    s.push_back(2);
    vector<pair<int,int>> ass;
    int cur = 1;

    for(int i = 1; i <= n; i++){
        if(s[i] == s[i - 1])cur++;
        else{
            ass.push_back({s[i - 1],cur});
            cur = 1;
        }
    }

    if(ass.front().first)ass.insert(ass.begin(), {0,0});
    if(!ass.back().first)ass.push_back({1,0});

    int sum = 0;
    cur = 0;
    int nax = 0;
    int past = 0;
    int m = ass.size();
    for(int i = 0; i < m; i++){
        sum += !ass[i].first;
        if(sum > k){
            while(sum > k){
                cur -= ass[past].second;
                sum -= !ass[past].first;
                past++;
            }
        }
        cur += ass[i].second;
        nax = max(cur, nax);
    }
    cout << nax << endl;

}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

ll dp[2005][2005];

int main()
{
    int n,m;
    cin>>n>>m;
    vll a(n),b(m);

    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];

    rep(i,n+1)dp[i][0]=1;
    rep(i,m+1)dp[0][i]=1;
    rep(i,n+1)rep(j,m+1){
        if(i==0 || j==0){
            continue;
        }
        //dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%MOD;
        if(a[i-1]==b[j-1]){
            dp[i][j]=(dp[i-1][j]+dp[i][j-1]+MOD)%MOD;
        }
        else{
            dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+MOD)%MOD;
        }
    }
    cout<<dp[n][m]<<endl;
}



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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el cout << "\n"
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    int n;
    cin >> n;
    cout << ((n/1000) + (n%1000!=0))*1000-n;
    return 0;
}


Measured memory_bytes: 3644
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
//nCr mod m
#define MOD 1000000007
#define M 1000000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
int main(){
	init();
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi t(n);
	rep(i,n)t[i]=fact[n]*powmod(i+1,MOD-2)%MOD;
	rep(i,n-1)(t[i+1]+=t[i])%=MOD;
	ll out=0;
	rep(i,n)(out+=(MOD+t[i]+t[n-i-1]-t[0])%MOD*in[i]%MOD)%=MOD;
	cout<<out<<endl;
}











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

int main() {
  char c;
  cin >> c;
	if(c == 'a' || c == 'i'|| c == 'u'|| c == 'e'|| c == 'o'){
	   cout << "vowel" << endl;        
      }
        else{
	   cout << "consonant" << endl;       
        }
    }


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

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

void fastscan(ll &number)
{
	bool negative = false;
	register int c;
	number = 0;
	c = getchar();
	if (c=='-') 
	{
		negative = true;
		c = getchar();
	}
	for (; (c>47 && c<58); c=getchar())
		number = number *10 + c - 48;
	if (negative)
		number *= -1;
}

bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

bool checkisTree(ll degree[],ll n) 
{
    ll deg_sum = 0; 
    for (ll i = 0; i < n; i++) 
        deg_sum += degree[i]; 
    return (2*(n-1) == deg_sum);
}

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

}

int main()
{
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll arr[n], arr1[n];
		for(ll i=0; i<n; i++)
		{
			cin>>arr[i];
			arr1[i]=arr[i];
		}
		sort(arr1,arr1+n);
      	ll cnt=0;
		for(ll i=0; i<n; i++)
		{
			if(arr1[i]-arr[i]!=0)
				cnt++;
		}
		if(cnt==2 || cnt==0 || cnt==1)
			cout<<"YES";
		else
			cout<<"NO";
	}	
}

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

double dp[100010][30];
double ans[100010];
 
int main(){
    memset(dp,0,sizeof(dp));
    memset(ans,0,sizeof(ans));
    dp[1][1] = 1;
    for(int i = 1; i < 100010; i++){
        double p = 1, acc = 0;
        // double acc = 0;
        for(int j = 1; j < 30; j++){
            dp[i+1][j+1] += dp[i][j] * p;
            dp[i+1][1] += dp[i][j] * (1-p);
            acc += dp[i][j] * p;
            p /= 2;
        }
        ans[i] = acc + ans[i-1];
    }
    int n;
    while(scanf("%d", &n), n != 0){
        printf("%.5f\n", ans[n]);
    }
}

Measured memory_bytes: 25432
using System.Collections.Generic;
using static System.Linq.Enumerable;
using static System.Console;
using System;

namespace AtCoderCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(ReadLine());
            var ar = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            var count = new long[N];
            var all = 0L;
            Func<int, long> now = index => all + ar[index] - (N + 1) * count[index];
            while (Range(0, N).Select(now).Max() >= N)
            {
                foreach(var i in Range(0, N))
                {
                    var n = now(i);
                    all += n / N;
                    count[i] += n / N;
                }
            }
            WriteLine(all);
        }
    }
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    string s;cin >> s;
    int sl = (int)s.length();;

    int counter = 1 << (sl-1);
    ll sum = 0;
    rep(i,counter)
    {
   
        ll num = 0;
        rep(j,sl+1)
        {
            if(j==0)
            {
                continue;
            }
            num = 10 * num + (s[j-1] - '0');
            if(j==sl)
            {
                // cout << num << endl;
                sum += num;
                num = 0;
                continue;
            }
            if(!(i & 1<< (j-1)))
            {
                continue;  
            }
            // cout << num << endl;
            sum += num;
            num = 0;
        }
    }
    cout << sum << endl;

}

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

int main(void){
  int k;cin >> k;
  int a,b; cin >> a >> b;

  for(int i=a;i<=b;i++){
    if(i%k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }

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


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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int a = Integer.parseInt(strArr[0]);
            int b = Integer.parseInt(strArr[1]);
            int time = a + b;
            if (time >= 24) {
                time -= 24;
            }
            System.out.println(time);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 21076
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
 	string output = s < t ? "Yes" : "No";
    cout << output << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1000000007;

long long modPow(long long a, long long n) {
    if (n == 1) return a;
    if (n % 2) {
        return a * modPow(a, n - 1) % MOD;
    } else {
        return modPow(a * a % MOD, n / 2);
    }
}

int main() {
    long long N; cin >> N;
    long long ans = modPow(10, N);
    ans += modPow(8, N); 
    ans %= MOD;
    ans -= 2 * modPow(9, N);
    while (ans < 0) ans += MOD;
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int f[45]={1,1},n;
	for(int i=2;i<=44;i++)
		f[i] = f[i-1]+f[i-2];
	cin>>n;
	cout<<f[n]<<endl;
	return 0;
}



Measured memory_bytes: 3100
{-# LANGUAGE BangPatterns #-}

module Main where

import Control.Applicative
import Control.Monad

div2 :: Int -> Int
div2 n = iter 0 n
  where
    iter _ 0 = 0
    iter !i x
        | r == 0    = iter (i + 1) q
        | otherwise = i
      where
        (q, r) = x `divMod` 2

main :: IO ()
main = do
    getLine
    as <- fmap read . words <$> getLine :: IO [Int]
    let ans = fmap div2 as
    print $ sum ans

Measured memory_bytes: 7548
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    string s;
    while(cin >> s){
	  reverse(all(s));
	  cout << s << endl;	
   }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



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

int main(){
	int n,a[128];

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

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

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
using ldb = long double;
using pa = pair < int, int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int ans = m;
    for(int i = 0;i + m <= n;i++){
        string tmp = s.substr(i,m);
        int c = 0;
        f(j,0,m){
            c += (tmp[j] == t[j]);
        }
        // cout << c << "\n";
        ans = min(ans,m - c);
    }
    cout << ans;

    return 0;
}
 

Measured memory_bytes: 3660
#include <cstdio>

int main() {
	int n, temp;
	scanf("%d", &n);

	for (int i = 1; i <= n; i++) {
		if (!(i % 3))
			printf(" %d", i);
		else {
			temp = i;
			while (temp) {
				if (temp % 10 == 3) {
					printf(" %d", i);
					break;
				}
				temp /= 10;
			}
		}
	}
        puts("");
}

Measured memory_bytes: 1036
/**
 *    author:  math2do
 *    created: 02.05.2020 22:40:53 IST
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int k, a, b;
  cin >> k >> a >> b;
  bool found = false;
  for (int n = a; n <= b; n++) {
    found |= (n % k == 0);
  }
  cout << (found ? "OK" : "NG") << endl; 
  return 0;
}


Measured memory_bytes: 3560
#include <cstdio>
#include <algorithm>
#include <limits.h>
#define INF INT_MAX/100
#define FOR(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void){
  int n,x,y,z,ans,tmp=0,nodes=0,sum=INF;
  int graph[50][50];
  char str[100];

  while(1){
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%d",&n);
    if(n==0) break;
    FOR(i,10)
      FOR(j,10)
        graph[i][j] = (i==j ? 0 : 500);
    while(n--){
      fgets(str,sizeof(str),stdin);
      sscanf(str,"%d %d %d",&x,&y,&z);
      graph[x][y] = graph[y][x] = z;
      nodes = max(max(nodes,y),x);
    }
    /*REP(i,nodes+1)
      REP(j,nodes+1)
        (j!=nodes ? printf("%3d ",graph[i][j]) : printf("%3d\n",graph[i][j]));
    printf("\n");*/
    FOR(k,nodes+1){
      FOR(i,nodes+1){
        FOR(j,nodes+1){
          graph[i][j] = min(graph[i][j],graph[i][k] + graph[k][j]);
        }
      }
      //printf("\n");
    }
    FOR(i,nodes+1){
      FOR(j,nodes+1)
          tmp += graph[i][j];
      if(sum > tmp){
        sum = tmp;
        ans = i;
      }
      tmp = 0;
    }
    printf("%d %d\n",ans,sum);
    nodes = ans = 0;
    sum = INF;
  }
  return 0;
}

/* 0  1  2  3  4
  --------------
0| 0 80 60  0  0
1|80  0 20  0 90 
2|60 20  0 50  0
3| 0  0 50  0 60
4| 0 90  0 60  0  */

Measured memory_bytes: 2580
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	
	var n,k int
	var s string
	fmt.Scan(&n,&k,&s)

	ans := 0
	l,r := 0,n-1
	for {
		if k == 0 {
			for i := l; i < r; i++ {
				if s[i] == s[i+1] {
					ans++
				}
			}
			break
		}

		for ; l < r; l++ {
			if s[l] != s[l+1] {
				l++
				break
			} else {
				ans++
			}
		}

		if l==n-1 {
			break
		}

		for ; r >= l; r-- {
			if s[r] != s[r-1] {
				r--
				break
			} else {
				ans++
			}
		}

		if l<=r{
			ans+=2
			if l == r {
				break
			}
		} else {
			ans++
			break
		}
		// fmt.Println(l,r,ans)
		k--
	}

	fmt.Println(ans)

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long LL;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t; cin >> t; while (t--) {
        LL n, m, a, b; cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << '\n';
    }
}

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

using namespace std;

using ll = long long;

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

    string s;
    cin >> s;

    int size = s.size();

    if (size <= k) cout << s << endl;
    else {
        for (int i = 0; i < k; i++) {
            cout << s[i];
        }
        cout << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
def resolve():
    a = input()
    b = input()
    c = input()
    count = "a"
    for i in range(len(a)+len(b)+len(c)):
        if count == "a":
            if len(a) != 0:
                count = a[0]
                a = a[1:]
            else:
                print("A")
                exit()
        elif count == "b":
            if len(b) != 0:
                count = b[0]
                b = b[1:]
            else:
                print("B")
                exit()
        else:
            if len(c) != 0:
                count = c[0]
                c = c[1:]
            else:
                print("C")
                exit()
resolve()

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

int main() {
  int a, b;
  cin >> a >> b;
  int x, y;
  x = min(a,b);
  y = max(a,b);
  for (int i = 0; i < y; i++){
    cout << x;
  }
  cout << endl;
}

Measured memory_bytes: 256