akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


bool prime[100000];
vector<ll> primes;
void sieve() {
    fill(prime, prime + 100000, 1);
    prime[0] = prime[1] = 0;

    for (int i = 2; i < 100000; i++) {
        if (prime[i]) {
            primes.pb(i);
            for (int j = i * 2; j < 100000; j += i) {
                prime[j] = 0;
            }
        }
    }
}



int main() {
    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int e;
    cin >> e;
    int m = e;
    int ans = 1;
    for (int i = 0; i < n - 1; i++) {
        cin >> e;
        if (m <= e) {
            ans++;
        }
        m = max(m, e);
    }

    cout << ans;


}






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

using namespace std;

int main(){
  int N,M ; cin >> N >> M;
  int to[60][60] = {0};
  for(int i = 0; i < M; i++){
    int a,b; cin >> a >> b; a--; b--; //0-indexed
    to[a][b]++; to[b][a]++;}
  
  for(int j = 0; j < N; j++){ int count  = 0;
    for(int k = 0; k < N; k++){
      count += to[j][k];}
                             cout << count << endl;}
  
  return 0;}

Measured memory_bytes: 256
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	bool ok=true;
	READV(T);
	while(T--)
	{
		READV(x);
		if(x%2==0)
		{
			if(x%3!=0 && x%5!=0)
			{
				ok=false;
			}
		}
	}
	if(ok)
	{
		cout<<"APPROVED"<<endl;
	}
	else
	{
		cout<<"DENIED"<<endl;
	}
	

//-----------------------------------------------------------------------------------------------------------//


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e6 + 5, mod = (int) 0;
int a[N], mark[N];
int main() {
	int n, c, k;
	cin >> n >> c >> k;
	for (int j = 0; j < n; ++j)
		scanf("%d", a + j);
	sort(a, a + n);
	set<pair<int, int>> ed;
	int pt = 0, res = 0;
	for (int j = 0; j < n; ++j) if (!mark[j]) {
		++res;
		while (pt < n && a[j] + k >= a[pt]) ed.insert(make_pair(a[pt] + k, pt)), ++pt;
		for (int x = 0; x < c; ++x) {
			if (!ed.size()) break;
			auto p = *(ed.begin());
			ed.erase(p);
			mark[p.second] = 1;
		}
	}
	printf("%d\n", res);

}


Measured memory_bytes: 4864
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if ((a < b) && (b < c))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//dp[j]==>价值为j时体积为dp[j]
//体积dp[j]<w时的最大价值 

ll c[100005];
ll ans;
ll n,w;
ll a[100005],b[1000005];
int main()
{
	ll i,j,k,x,y,t;
	cin>>n>>w;//w是容积 
	memset(c,1e9+5,sizeof(c));
	//cout<<"ans="<<c[5]<<endl;
	c[0]=0;
	for(i=1;i<=n;i++)
	cin>>a[i]>>b[i];//a是体积 b是价值 
	for(i=1;i<=n;i++)
	{
		for(j=1e5;j>=b[i];--j)//1e2*1e3
		{
			c[j]=min(c[j],c[j-b[i]]+a[i]);
			if(c[j]<=w)
		    ans=max(ans,j);		
		}	
	}	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4312
/*
  Vivek Rathi
  CSE 3rd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
//unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
//shuffle (foo.begin(), foo.end(), std::default_random_engine(seed));
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above-----------------------------------------------

int main()
{
	boost
	ll n;
	cin>>n;
	n--;
	ll a[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll co=a[0]+a[n-1];
	for(ll i=0;i<n-1;i++)
	{
		co+=min(a[i],a[i+1]);
	}
	cout<<co<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int w, h, n, x, y, a;
	cin >> w >> h >> n;
	int x_min, x_max, y_min, y_max;
	x_max = w;y_max = h;x_min = y_min = 0;
	rep(i, 0, n) {
		cin >> x >> y >> a;
		if (a == 1) {
			x_min = max(x_min, x);
		}
		else if (a == 2) {
			x_max = min(x_max, x);
		}
		else if (a == 3) {
			y_min = max(y_min, y);
		}
		else if (a == 4) {
			y_max = min(y_max, y);
		}
	}
	int ans = (x_max - x_min)*(y_max - y_min);
	if (x_max > x_min&& y_max > y_min)cout << ans << endl;
	else cout << "0" << endl;
	return 0;
}


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

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

	int length = S.size() / 2;
	string S_first = S.substr(0, length);
	string S_last = "";
	if(S.size() % 2 == 0) {
		S_last = S.substr(length);
		reverse(S_last.begin(), S_last.end());
	} else {
		S_last = S.substr(length + 1);
		reverse(S_last.begin(), S_last.end());
	}
	
	int cnt = 0;
	for(int i = 0; i < S_first.size(); ++i) {
		if(S_first[i] == S_last[i]) {
			continue;
		} else {
			cnt++;
		}
	}

	cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dfs(int vertex, vector<int> &dp, vector<vector<int>>& adj)
{
    if(dp[vertex]!=-1)
        return dp[vertex];
        
    int len = 0;
    for(int i=0; i<adj[vertex].size(); i++)
        len = max(len, 1+dfs(adj[vertex][i], dp, adj));
    
    return dp[vertex] = len;
}
int main()
{
    int n, m, x, y;
    cin>>n>>m;
    vector<vector<int>> adj(n+1);
    for(int i=0; i<m; i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
    }

	vector<int> dp(n+1, -1);
	int maximum = 0;
	for(int i=1; i<=n; i++)
    {
        if(dp[i]==-1)
        {
            dfs(i, dp, adj);
        }
        maximum = max(maximum, dp[i]);
	}
    cout<<maximum<<endl;
    return 0;
}

Measured memory_bytes: 8832
m,d = map(int,input().split())
ans = 0
d_ten = d // 10
d_one = d - d_ten*10
n = 2
if m<4 or d<22:
  print(0)
else:
  for i in range(2,d_ten):
    for j in range(2,10):
      if i*j<=m:
        ans += 1
  while(n<=d_one):
    if d_ten*n <= m:
      ans += 1
    n += 1
  print(ans)

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

SUM=0
numbers=[0]*100001
for i in range(N):
    a=A[i]
    numbers[a]+=1
    SUM+=a

B=[0] * Q
C=[0] * Q
for i in range(Q):
    B[i],C[i]  = list(map(int, input().split()))

for i in range(Q):
    b = B[i]
    c = C[i]

    SUM = SUM - b * numbers[b]
    SUM = SUM + c * numbers[b]
    numbers[c] += numbers[b]
    numbers[b] = 0
    print(SUM)


Measured memory_bytes: 22108
#include <stdio.h>

int main(){
  char s[6];
  if(scanf("%s",s)==1){}
  if(s[0]=='S'){
    printf("Cloudy");
  }else if(s[0]=='C'){
    printf("Rainy");
  }else{
    printf("Sunny");
  }
  return 0;
}

Measured memory_bytes: 128
//ritik_patel05

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

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

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
// const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&

void solve(){
    char c; cin >> c;
    for(char ch = 'A'; ch <= 'Z'; ++ch){
        if(ch == c){
            cout << "A\n";
            return;
        }
    }
    cout << "a\n";
    
}


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        // brute();
        solve();
    }
    return 0;
}

/*
Sample inp
*/

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    map<ll,ll> d;
    while(n--){
        cin >> i;
        d[i]++;
    }
    cin >> m;
    while(m--){
        cin >> i;
        if(d[i]==0){
            cout << "NO" << endl;
            return 0;
        }
        d[i]--;
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define MAX 10000
#define NIL -1

typedef struct Node
{
    int parent, left, right;
} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void getDepth(int u, int d)
{
    if (u == NIL) return;
    D[u] = d;
    getDepth(T[u].right, d + 1);
    getDepth(T[u].left, d + 1);
}
int getHeight(int u)
{
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL)
        h1 = getHeight(T[u].left) + 1;
    if (T[u].right != NIL)
        h2 = getHeight(T[u].right) + 1;
    return H[u] = max(h1, h2);
}
int getSiblings(int u)
{
    if (T[u].parent == NIL) return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL)
        return T[T[u].parent].left;
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL)
        return T[T[u].parent].right;
    return NIL;
}
void printNode(int u)
{
    cout << "node " << u << ": "
         << "parent = " << T[u].parent << ", "
         << "sibling = " << getSiblings(u) << ", ";
    int deg = 0;
    if (T[u].left != NIL) deg++;
    if (T[u].right != NIL) deg++;
    cout << "degree = " << deg << ", "
         << "depth = " << D[u] << ", "
         << "height = " << H[u] << ", ";
    if (T[u].parent == NIL) {
        cout << "root" << endl;
    } else if (T[u].left == NIL && T[u].right == NIL) {
        cout << "leaf" << endl;
    } else {
        cout << "internal node" << endl;
    }
}

int main(void)
{
    int u, left, right, root = 0;
    cin >> n;

    for (int i = 0; i < n; ++i) T[i].parent = NIL;

    for (int i = 0; i < n; ++i) {
        cin >> u >> left >> right;
        T[u].left = left;
        T[u].right = right;
        if (left != NIL) T[left].parent = u;
        if (right != NIL) T[right].parent = u;
    }

    for (int i = 0; i < n; ++i)
        if (T[i].parent == NIL) root = i;
    getDepth(root, 0);
    getHeight(root);

    for (int i = 0; i < n; ++i) printNode(i);
    return 0;
}



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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N;
  cin >> N;
  vector<int> B(N);
  for (int i = 1; i < N; i++)
  {
    cin >> B[i];
  }

  long long sum = 0;
  sum += B[1];
  for (int i = 1; i < N - 1; i++)
  {
    sum += std::min(B[i], B[i + 1]);
  }
  sum += B[N - 1];

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
typedef long long ll;
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
ll ma = 1000000000 + 7;


ll n;ll a[100010];ll dp[100010];

int main() {
	cin >> n;ll res = 0;
	for (ll i = 0;i < n;i++) {
		cin >> a[i];
		res += a[i] - 1;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int memo[100010];

signed main() {
	vector<int> v;
	v.push_back(1);

	int tmp = 6;
	while (tmp < 100000) {
		v.push_back(tmp);
		tmp *= 6;
	}

	tmp = 9;
	while (tmp < 100000) {
		v.push_back(tmp);
		tmp *= 9;
	}

	sort(all(v));

	int N;
	cin >> N;

	REP(i, 1, 100000) {
		memo[i] = INT_MAX;
		for (int num : v) {
			if (num > i) break;
			memo[i] = min(memo[i], memo[i - num] + 1);
		}
		if (i == N) break;
	}

	cout << memo[N] << endl;
}

//signed main() {
//	int N;
//	cin >> N;
//
//	string ret;
//
//	if (N == 0) ret = "0";
//	else if (N > 0) {
//		ret += N % 2 ? '1' : '0';
//		ret >>= 1;
//		while (ret) {
//			if (N == 1) 
//		}
//	} else {
//		N *= -1;
//	}
//
//	cout << ret << endl;
//}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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 arr[500010];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  string s;
  cin >> s;
  int n = s.size();
  fi(0, s.size()) {
    if(s[i] == '<')
      arr[i + 1] = arr[i] + 1;
  }
  for(int i = s.size() - 1; i >= 0; --i) {
    if(s[i] == '>')
      arr[i] = max(arr[i], arr[i + 1] + 1);
  }
  // ans = accumulate(arr, arr + n + 1, 0);
  fi(0, s.size() + 1)
    ans += arr[i];
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 2820
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;

int main(){
    int N;
    cin>>N;
    int cmax=INT_MIN;
    int dmax=INT_MIN;
    int cmin=INT_MAX;
    int dmin=INT_MAX;
    for(int i=0;i<N;i++){
        int x,y;
        cin>>x>>y;
        int c=x+y;
        int d=x-y;
        cmax=max(cmax,c);
        cmin=min(cmin,c);
        dmax=max(dmax,d);
        dmin=min(dmin,d);
    }

    cout<<max(cmax-cmin,dmax-dmin)<<endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    int N;
    cin >> N;
    vector<ll> B(N+1, 100005);
    for(int i = 1; i < N; i++){
        cin >> B[i];
    }
    ll ans = 0;
    for(int i = 0; i < N; i++){
        ans += min(B[i], B[i+1]);
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

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

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int a, b, c, d; cin>>a>>b>>c>>d;
    int i, j, k, l; cin>>i>>j>>k>>l;
    cout << max(a+b+c+d, i+j+k+l) << endl;
}


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

int main(){
	int a, b;
	cin >> a >> b;
	if(a < b){
		cout << "a < b\n";
	}
	else if(a > b){
		cout << "a > b\n";
	}
	else{
		cout << "a == b\n";
	}
}


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

int main(){
  int j,n,t,ans;cin>>n;
  vector<vector<int>> v(2,vector<int>(100001,0));
  vector<int> m(2,0),c(2,0);
  REP(i,n){
    j=i%2;
    cin>>t;v.at(j).at(t)++;
    if(v.at(j).at(t)>m.at(j)) m.at(j)=v.at(j).at(t),c.at(j)=t;
  }
  if(c.at(0)!=c.at(1)) ans=n-m.at(0)-m.at(1);
  else{
    sort(v.at(0).begin(),v.at(0).end(),greater<int>());
    sort(v.at(1).begin(),v.at(1).end(),greater<int>());
    ans=n-max(m.at(0)+v.at(1).at(1),m.at(1)+v.at(0).at(1));
  }  
  cout<<ans;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   string s;
   cin>>s;

   rep(i, s.size()) cout<<"x";
   cout<<endl;
   return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    sort(a.begin(), a.end());
    int ret = 1e9;
    rep(i, n) {
        int ans = 0;
        int prev = a[i];
        for (int j = i - 1; j >= 0; --j) {
            ans += abs(a[j] - prev);
            prev = a[j];
        }
        prev = a[i];
        for (int j = i + 1; j < n; ++j) {
            ans += abs(a[j] - prev);
            prev = a[j];
        }
        ret = min(ret, ans);
    }
    cout << ret << endl;
}


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

int main() {
	string s;  cin >> s;
	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0 && s[i] == 'p') ans--;
		if (i % 2 == 1 && s[i] == 'g') ans++;
	}
	cout << ans << endl;
}

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

int main() {

	ll n, k; cin >> n >> k;
	vector<ll> num(k, 0);
	for (ll i = 1; i <= n; i++) {
		num[i % k]++;
	}
	ll ans = 0;	
	for (ll a = 0; a < k; a++) {
		ll b = (k - a) % k;
		ll c = (k - a) % k;
		if ((b + c) % k != 0) continue;
		ans += num[a] * num[b] * num[c];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4812
//c.c C-Linear Approximation
#include<stdio.h>
#include<stdlib.h>
typedef long long lld;


int cmp(const void *a,const void *b){
    if(*(lld*)a<*(lld*)b){
        return -1;
    }else{
        return 1;
    }
    return 0;
}
lld iabs(lld x){
    if(x<0){
        return -x;
    }
    return x;
}

int main(void){
    int n;
    scanf("%d",&n);
    lld a[n];
    for(int i=0;i<n;++i){
        scanf("%lld",&a[i]);
    }

    lld b[n];
    for(lld i=0;i<n;++i){
        b[i] = a[i] - i - 1;
    }

    qsort(b,n,sizeof(lld),cmp);

    lld ansnum1,ansnum2,ansnum,ans1=0,ans2=0,ans=0;
    if(n%2!=0){
        ansnum = n/2;
        for(int i=0;i<n;++i){
            ans += iabs(a[i]-b[ansnum]-(i+1));
        }
    }else{
        ansnum1 = n/2 - 1;
        ansnum2 = n/2;
        for(int i=0;i<n;++i){
            ans1 += iabs(a[i]-b[ansnum1]-(i+1));
            ans2 += iabs(a[i]-b[ansnum2]-(i+1));
        }
        if(ans1>ans2){
            ans = ans2;
        }else{
            ans = ans1;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4860
#include<stdio.h>
int main(void)
{
	int i,j,n,m;
	char s[100],t[100];
	char a;
	scanf("%d",&n);
	while (n!=0) {
		for (i=0;i<n;i++) {
			scanf(" %c %c",&s[i],&t[i]);
		}
		scanf("%d",&m);
		for (i=0;i<m;i++) {
			scanf(" %c",&a);
			for (j=0;j<n;j++) {
				if(a == s[j]) {
					a=t[j];
					break;
				}
			}
				printf("%c",a);
		}
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1000
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
    Node *y=NIL;
    Node *x=root;
    Node *z;
    
    z=(Node*)malloc(sizeof(Node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;
    
    while(x!=NIL){
        y=x;
        if(z->key < x->key){
            x=x->left;
        }else{
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL){
        root=z;
    }else{
        if(z->key < y->key){
            y->left=z;
        }else{
            y->right=z;
        }
    }
}

void inorder(Node *u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if(u==NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        cin >> com;
        if(com=="insert"){
            scanf("%d",&x);
            insert(x);
        }else if(com=="print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 26732
datas = $stdin.read.split("\n")
datas[1] = datas[1].split(" ")
datas[2] = datas[2].split(" ")

max_candies = 0

for i in 0..datas[0].to_i - 1
	sum = 0
	for j in 0..i do
		sum += datas[1][j].to_i
	end

	for j in i..datas[0].to_i
		sum += datas[2][j].to_i
	end

	if max_candies < sum then
		max_candies = sum
	end
end

puts max_candies

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

int is_kaibun(int n){
  int m = n, reverse_n = 0;
  while(m>0){
    reverse_n = reverse_n*10 + m%10;
    m /= 10;
  }
  if(n == reverse_n){return 1;}
  else {return 0;}
}

int main(){
  int a,b;
  int c = 0;
  cin >> a >> b;
  for(a;a <= b;++a){
    if(is_kaibun(a) == 1){ ++c;}
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
    long long int N,A,B;
    cin>>N>>A>>B;
    cout<<max((long long int)0,(B*(N-1)+A)-(A*(N-1)+B)+1)<<endl;
    return 0;
}


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

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
string board[60];

int main(void) {
  int X, Y;
  cin >> X >> Y;
  for (int i = 0; i < X; i++) {
    cin >> board[i];
  }
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      if (board[i][j] == '.') {
        int counter = 0;
        for (int k = 0; k < 8; k++) {
          int x = i + dx[k];
          int y = j + dy[k];

          if (x >= 0 && x < X && y >= 0 && y < Y && board[x][y] == '#') {
            counter++;
          }
        }
        board[i][j] = '0' + counter;
      }
    }
  }
  for (int i = 0; i < X; i++) {
    cout << board[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const int dx[2] = {0, 1}, dy[2] = {1, 0};

ll pat[1001][1001];

int main() {
    int H, W;
    cin >> H >> W;

    string S[H];
    for (int i = 0; i < H; ++i) {
        cin >> S[i];
    }

    pat[0][0] = 1;

    queue<pair<int, int>> que;
    que.push(make_pair(0, 0));

    while (!que.empty()) {
        int x, y;
        tie(x, y) = que.front();
        que.pop();

        for (int i = 0; i < 2; ++i) {
            int nx = x + dx[i], ny = y + dy[i];
            if (nx < 0 || H <= nx || ny < 0 || W <= ny || S[nx][ny] == '#') continue;

            if (pat[nx][ny] == 0) que.push(make_pair(nx, ny));

            pat[nx][ny] += pat[x][y];
            pat[nx][ny] %= MOD;
        }
    }

    cout << pat[H - 1][W - 1] << endl;
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep (i, n) cin >> a[i];
  vector<int> sorted = a;
  sort(sorted.begin(), sorted.end());
  for (auto v : a) {
    if (v <= sorted[n / 2 - 1]) {
      cout << sorted[n / 2] << endl;
    } else {
      cout << sorted[n / 2 - 1] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i=0; i<(int64_t)(n); i++)
#define all(v) v.begin(), v.end()
//b
int main(){
  int a, b, c, k; cin >> a >> b >> c >> k;
  if(k<=a) cout << k << endl;
  else if(k<=a+b) cout << a << endl;
  else if(k>a+b) cout << a - (k-a-b) << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> v;
int n,m,cnt=0,ans=0,aa[220000],ab[220000];
pair<int,char> pp[220000];
string s,ss[220000],sa;
char ch[110][110];
queue<int> que;
signed main(){
    cin>>s>>sa;
    sort(s.begin(),s.end());
    sort(sa.begin(),sa.end(),greater<char>());
    if(s<sa){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 10496
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,m;
    cin>>n>>m;
    ll l=1,r=n,lp,rp;
    for(ll i=0;i<m;i++){
        cin>>lp>>rp;
        if(lp>l) l=lp;
        if(rp<r) r=rp;
    }
    cout<<max((ll)0,r-l+1)<<endl;
    return 0;
}

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

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      for(int i=0; i<n; i++)
        seq[i] = Integer.parseInt(br.readLine());

      System.out.println( shellSort(seq, n) );

      StringBuilder str = new StringBuilder(n*5);
      for (int i : seq)
        str.append(i).append("\n");
      str.setLength(str.length()-1);
      System.out.println(str);
    }
  }

  public static int shellSort(int a[], int n) {
    int cnt=0;
    int m = 0;
    int[] aG = new int[100];
    for (int g=1,max=n+1; g < max; g=(g*3+1)) {
      aG[m++] = g;
    }
    StringBuilder str = new StringBuilder(m*5);
    str.append(m).append("\n");

    for(int i=(m-1); i>-1; i--){
      cnt += insertionSort(a, n,aG[i]);
      str.append(aG[i]).append(" ");
    }

    str.setLength(str.length()-1);
    System.out.println(str);

    return cnt;
  }
  
  public static int insertionSort(int a[], int max, int g) {
    int cnt=0;

    for (int i=g,j=0,v=0; i < max; i++) {
      for( j=(i-g), v=a[i]; j>=0 && a[j]>v; j-=g ) {
        a[j+g] = a[j];
        cnt++;
      }
      a[j+g] = v;
    }

    return cnt;
  }
}


Measured memory_bytes: 88180
#include<stdio.h>
#include<string.h>

int main(void){
	int i;
	char caesar[1001];
	
	scanf("%s",caesar);
	
	for(i=0;i<strlen(caesar);++i){
		if(caesar[i]>='D'&&caesar[i]<='Z'){
			caesar[i] = caesar[i]-0x03;
		}else{
			caesar[i] = caesar[i]-0x03+0x1A;
		}
	}
	
	printf("%s\n",caesar);

	return 0;
	
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

std::int64_t dynamic(std::array<std::int64_t, 3>const& A, std::array<std::int64_t, 3>const& B, std::int64_t N)
{
	std::vector<std::int64_t> dp(N + 1);
	for (int i : {0, 1, 2})
	{
		if (A[i] < B[i])
		{
			for (int k = 0; k + A[i] <= N; ++k)
			{
				dp[k + A[i]] = std::max(dp[k + A[i]], dp[k] + B[i] - A[i]);
			}
		}
	}
	return *boost::max_element(dp) + N;
}

void Main()
{
	std::int64_t N;
	std::cin >> N;
	std::array<std::int64_t, 3> A{}, B{};
	for (auto& v : A)
	{
		std::cin >> v;
	}
	for (auto& v : B)
	{
		std::cin >> v;
	}
	std::cout << dynamic(B, A, dynamic(A, B, N)) << std::endl;
}

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

Measured memory_bytes: 195584
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,R; cin>>N>>R;
	cout<<R+max(0,100*(10-N))<<"\n";
	return 0;
}


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

using namespace std;

#define ld long double
#define ll long long int
#define endl '\n'
#define check_time() cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1e9+7
#define INF 0x3f3f3f3f
#define maxarr(A,n) *max_element(A,A+n) 
#define minarr(A,n) *min_element(A,A+n);
#define ft first
#define sd second
#define all(v) (v.begin(),v.end())
#define vll vector<ll> 
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define pb push_back
#define show(x) cout<<#x<<" "<<x<<endl;
#define PI 3.14159265358979323846

void solve()
{
	ld a,b,h,m,angh,angm,fang,ans;ld val;
	cin>>a>>b>>h>>m;
	cout<<fixed<<setprecision(20);
	angh=30*h;
	angm=6*m;
	angh+=(m/2);
	fang=abs(angh-angm);
	fang=min(fang,360-fang);
	//show(fang);
	
	/*if(fang==90)
		val=0;
	else if(fang==0)
		val=1;
	else if(fang==180)
		val=-1;
	else
	{*/
		fang*=(PI/180);
		val=cos(fang);
	//}
	
	//show(cos(fang));
	ans=(a*a)+(b*b)-(2*a*b*val);
	cout<<sqrt(ans)<<endl;
	//cin>>a;
}

int main()
{
	fastio();

	ll T=1;	//cin>>T;
	while(T--) solve();
	
	//check_time();
	return 0;   
}   



Measured memory_bytes: 4180
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
int main(){
  string o,s;
  cin>>o>>s;
  int n=o.size()+s.size();
  char l[n];
  for(int i=0;i<o.size();i++){
    l[2*i]=o[i];
    if(i<s.size())l[2*i+1]=s[i];
  }
  for(int i=0;i<n;i++){
    cout<<l[i];
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{

    long long  num = 0;
    long long  money = 0;
    long long  total = 0;
    int i;
    
    scanf("%lld",&num);
    for (i = 0; i < num; i++) {
        scanf("%lld",&money);
        total += money;
    }
    printf("%lld\n",total / num);
    return 0;
}

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

int main(){
	int a,b,c,x;cin>>a>>b>>c>>x;
	int cnt=0;
	rep(i,a+1)rep(j,b+1)rep(k,c+1){
		if(500*i+100*j+50*k==x)cnt++;
	}
	cout<<cnt<<endl;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	if (n > m)
	{
		if (n - 2 >= m)
			cout << 2 * n - 1 << endl;
		else cout << n + m << endl;
	}
	else if (n == m)
	{
		cout << n + m << endl;
	}
	else
	{
		if (m - 2 >= n)
			cout << 2 * m - 1 << endl;
		else cout << n + m << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//Code by 27.
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const int MOD=1000000007;
const long long LMOD=1000000007;
long long n;
long long a[300001];
long long f[300001][5];
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	long long mx=BIGEST;
	long long mn;
	for(int i=1;i<=n;i++)
	{
		mn=BIGEST;
		mn=min(mn,f[i-1][0]);
		f[i][0]=mn+a[i]-0;
		mn=min(mn,f[i-1][1]);
		f[i][1]=mn+a[i]%2+(a[i]==0)*2;
		mn=min(mn,f[i-1][2]);
		f[i][2]=mn+(a[i]+1)%2;
		mn=min(mn,f[i-1][3]);
		f[i][3]=mn+a[i]%2+(a[i]==0)*2;
		mn=min(mn,f[i-1][4]);
		f[i][4]=mn+a[i]-0;
	}
	mx=min(mx,f[n][0]);
	mx=min(mx,f[n][1]);
	mx=min(mx,f[n][2]);
	mx=min(mx,f[n][3]);
	mx=min(mx,f[n][4]);
	printf("%lld",mx);
	return 0;
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  if(N < 1000) cout << "ABC" << endl;
  else cout << "ABD" << endl;
  
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x, a[114514];
	cin>>n>>x;
	ll ans=0;
	REP(i, n){
		cin>>a[i];
		if(a[i]>x){
			ans+=a[i]-x;
			a[i]=x;
		}
	}
	REP(i, n-1){
		if(a[i]+a[i+1]>x){
			ans+=a[i]+a[i+1]-x;
			a[i+1]-=a[i]+a[i+1]-x;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 640
n, a, b = map(int, input().split())
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = i//(10**j)
    if num != 0:
      num = num % 10 
      sum += num
      j+=1
    else:
      break
  if a<=sum and sum<=b:
    res += i;
 
print(res)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <set>

using namespace std;

const int INF = 1<<30;

vector<int> board( 9 );
int completeState;
set<int> reachedState;

void PrintBoard() {
    for ( int row=0; row<3; ++row ) {
	for ( int col=0; col<3; ++col ) cout << board[row*3+col];
	cout << endl;
    }
}

bool IsReachedState( int state ) {
    return reachedState.find( state ) != reachedState.end();
}

int TranslateIntoState( const vector<int>& b ) {
    int state = b[8] + 1;
    for ( int i=7; i>=0; --i ) state = state*10 + (b[i]+1);
    return state;
}

void RegisterState( int state ) {
    reachedState.insert( state );
}

bool IsCompleted( int state ) {
    return state == completeState;
}

int Try( int x, int y, int moves ) {

    return 100;
}

int main() {

    const int dx[4] = { -1, 0, 1,  0 };
    const int dy[4] = {  0, 1, 0, -1 };
    
    int x, y;
    for ( int i=0; i<3; ++i ) {
	for ( int j=0; j<3; ++j ) {
	    cin >> board[i*3+j];
	    if ( board[i*3+j] == 0 ) {
		y = i;
		x = j;
	    }
	}
    }

    completeState = 1;
    for ( int i=9; i>=2; --i ) completeState = completeState*10 + i;

    /*
    vector<int> b(9);
    b[0] = 1; b[1] = 2; b[2] = 3;
    b[3] = 4; b[4] = 5; b[5] = 6;
    b[6] = 7; b[7] = 8; b[8] = 0;
    cout << completeState << " " << TranslateIntoState( b ) << endl;
    */
    
    //    PrintBoard();

    queue< pair<vector<int>,int> > stateQue;
    stateQue.push( make_pair(board, 0) );

    int minStep = INF;
    while ( !stateQue.empty() ) {

	vector<int> state = stateQue.front().first;
	int step = stateQue.front().second;
	stateQue.pop();

	int s = TranslateIntoState( state );
	if ( IsCompleted( s ) ) {
	    cout << step << endl;
	    board = state;
	    //	    PrintBoard();
	    break;
	}

	if ( IsReachedState( s ) ) continue;
	RegisterState( s );

	int x, y;
	for ( int i=0; i<9; ++i ) {
	    if ( state[i] == 0 ) {
		x = i%3;
		y = i/3;
		break;
	    }
	}
	
	for ( int i=0; i<4; ++i ) {

	    int nx = x + dx[i];
	    int ny = y + dy[i];

	    if ( nx < 0 || nx > 2 || ny < 0 || ny > 2 ) continue;

	    vector<int> next = state;
	    swap( next[3*y+x], next[3*ny+nx] );
	    stateQue.push( make_pair( next, step+1 ) );
	    
	}
	
    }
    
    return 0;
}



Measured memory_bytes: 14400
# -*- using:utf-8 -*-

class main:
  def function(x, k, d):
    if x >= k * d:
      ans = x - k * d
    else:
      r = x // d
      n = k - r
      if n % 2 == 0:
        ans = x % d
      else:
        ans = abs(x % d - d)
    return ans

if __name__ == "__main__":
  x, k, d = map(int, input().split())
  x = abs(x)
  ans = main.function(x, k, d)
  print(ans)

Measured memory_bytes: 61832