akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string S;
  cin >> S;
  ll n = S.size()+1;
  
  vl a(n);
  rep(i, n-1) {
    if(S[i]=='<') a[i+1]=a[i]+1;
  }
  rep(i, n-1) {
    if(S[n-2-i]=='>') chmax(a[n-i-2], a[n-1-i]+1);
  }
  ll ans=0;
  rep(i, n) ans += a[i];
  cout << ans << newl;
  return 0;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;
ll a[mxn],limit[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=0; i<=n; i++)cin >> a[i];
	if(n==0){
		if(a[0]==1)cout << 1 << endl;
		else cout << -1 << endl;
		return 0;
	}
	if(a[0]>0){
		cout << -1 << endl;
		return 0;
	}
	limit[0]=1LL;
	for(int i=0; i<n; i++){
		if(limit[i]<a[i]){
			cout << -1 << endl;
			return 0;
		}
		limit[i+1]=min(ll(1e18),2LL*(limit[i]-a[i]));
	}
	if(limit[n]<a[n]){
		cout << -1 << endl;
		return 0;
	}
	ll cnt = a[n];
	ll cur = a[n];
	for(int i=n-1; i>=0; i--){
		cur = min(limit[i],cur+a[i]);
		cnt += cur;
	}
	cout << cnt << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 5148
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let ab: Vec<u32> = read_vec();
  let ans = if ab[0] <= ab[1] * 2 {
    0
  } else {
    ab[0] - ab[1] * 2
  };
  println!("{}", ans);
}


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

int main() {
	int n,k;
	cin >> n >> k;
	//n>k k/n 
	double ans=0;
	for(int i = 1;i <= n;i++)
	{
		double t =1.0/n;
		int a=i;
		while(a<k)
		{
			a*=2;
			t/=2;
		}
		ans+=t;
	}
	cout << fixed << setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 3756
n,m,k=map(int,input().split())
ans=0
INF=10**9+7
if n<=m:
    M=(m-1)*m*(2*m-1)//3
    for i in range(1,n+1):
        for j in range(i,n+1):
            if i==j:
                ans=ans+m*m*(m-1)//2-(m-1)*m*(2*m-1)//6
            else:
                d=j-i
                ans=ans+d*m+(m+d)*m*(m-1)-M
            ans=ans%INF
else:
    (n,m)=(m,n)
    M=(m-1)*m*(2*m-1)//3
    for i in range(1,n+1):
        for j in range(i,n+1):
            if i==j:
                ans=ans+m*m*(m-1)//2-(m-1)*m*(2*m-1)//6
            else:
                d=j-i
                ans=ans+d*m+(m+d)*m*(m-1)-M
            ans=ans%INF
import math
ans=(math.factorial(n*m-2)//(math.factorial(n*m-k)*math.factorial(k-2)))*ans
ans=ans%INF
print(ans)


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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i, n) {
		char now = (i%2) ? 'p' : 'g';
		if(s[i] == 'g' && now == 'p') ans++;
		if(s[i] == 'p' && now == 'g') ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
N,M,K = map(int,input().split())
MOD = 10**9+7

a = 0
for i in range(N):
    j = N-1-i
    a += i*(i+1)//2 + j*(j+1)//2

b = 0
for i in range(M):
    j = M-1-i
    b += i*(i+1)//2 + j*(j+1)//2

MAX = N*M+5
fac = [1,1] + [0]*MAX
finv = [1,1] + [0]*MAX
inv = [0,1] + [0]*MAX
for i in range(2,MAX+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

ans = (a * inv[N]**2 + b * inv[M]**2) * inv[N*M-1] * (N*M)
ans *= K*(K-1)//2
ans *= ncr(N*M, K)
print(ans % MOD)

Measured memory_bytes: 28344
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1000005;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  int pre = 0;
  ll ret = 0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(pre>x){
      ret += pre - x;
    } else pre = x;
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 3628
from math import gcd
from functools import reduce

K = int(input())
num = 0
for k in range(1,K+1):
    num += k

for k in range(1,K+1):
    for j in range(k+1,K+1):
        num += gcd(k,j)*6

for k in range(1,K+1):
    for j in range(k+1,K+1):
        for i in range(j+1,K+1):
            num += reduce(gcd,[k,j,i])*6
print(num)



Measured memory_bytes: 9640
def main():
    def c(x,y):
        if x > y:
            return 1
        else:
            return 0
    n,k = map(int,input().split())
    x = 1000000007
    kk = int(k*(k-1)//2)%x
    a = list(map(int,input().split()))
    c1 = []
    c2 = []
    for i in range(n):
        l = [c(a[i],p) for p in a]
        c1.append(sum(l))
        c2.append(sum(l[i:]))
    ans = ((sum(c1)%x)*kk)%x+((sum(c2)%x)*k)%x
    print(ans%x)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include<stdio.h>
#define N 101

typedef struct{
  int num;
  int v;
  int num1;
} hairetu;

int main(){
  int i,j;
  int u;
  scanf("%d", &u);
  hairetu Adj[N];
  int r[N][N] = {0};
  for(i = 0;i<u;i++){
    scanf("%d%d", &Adj[i].num,&Adj[i].v);
    for(j = 0; j < Adj[i].v;j++){
      scanf("%d",&Adj[i].num1);
      r[Adj[i].num][Adj[i].num1] = 1;
    }
  }
  for(i = 0; i < u; i++){
    for(j = 0; j < u-1; j++){
      printf("%d ",r[Adj[i].num][Adj[j].num]);
	     }
	printf("%d" , r[Adj[i].num][Adj[u-1].num]);
      printf("\n");
    }
    return 0;
  }

Measured memory_bytes: 652
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int r, D, x;
	cin >> r >> D >> x;
	for (int i = 2001; i <= 2010; i++) {
		cout << (x = r * x - D) << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
int N,L;
int taste[205];
int Totaltaste=0;
int dif=1e9;
int ans;
int main(void)
{
  cin >> N >> L;
  for (int i = 1;i<=N; i++)
  {
    taste[i]=L+i-1;
    Totaltaste+=taste[i];
  }
  for (int i = 1; i <= N; i++)
  {
    int nowtaste=0;
    for(int j=1;j<=N;j++)
    {
      if(i!=j)nowtaste+=taste[j];
    }
    if(abs(Totaltaste-nowtaste)<dif)
    {
      dif=abs(Totaltaste-nowtaste);
      ans=nowtaste;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
from collections import deque

def solve():
    N = int(readline())
    C = readline().rstrip()

    R, W = 'R', 'W'
    reds = deque(i for i in range(len(C)) if C[i] == 'R')
    whites = deque(i for i in range(len(C)) if C[i] == 'W')

    count = 0
    while len(whites) > 0 and len(reds) > 0 and whites[0] < reds[-1]:
        reds.pop()
        whites.popleft()
        count += 1
    
    print(count)

solve()

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

int main(void){
    string s;
    ll k;

    cin >> s >> k;

    if(s.size() == 1){
        cout << k / 2 << endl;
        return 0;
    }

    ll count = 0;
    ll count_f = 0;
    char f = s[0];

    rep(i, s.size()){
        if(s[i] == f){
            count_f++;
        }else{
            break;
        }
    }
    if(count_f == s.size()){
        if(count_f % 2 == 1){
            cout << (count_f / 2) * k  + k / 2 << endl;
            return 0;
        }
    }
    rep(i, s.size() - 1){
        if(s[i] == s[i+1]){
            count++;
            s[i+1] = '0';
        }
    }

    ll ans = count * k;

    if(s[s.size()-1] != s[s.size()-2] && s[s.size()-1] == s[0]){
        if(count_f % 2 == 1)
            ans += k - 1;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define int long long
#define rep(i,a,b) for (int (i)=(a);(i)<=(b);(i)++)
#define Rep(i,a,b) for (int (i)=(a);(i)<(b);(i)++)
#define REP(i,a,b) for (int (i)=(a);(i)>=(b);(i)--)
#define reg(i,x)   for (int (i)=head[x];(i);i=e[i].next)
#define lowbit(x) ((x)&(-(x)))
#define ls ((x)<<1)
#define rs ((x)<<1|1)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
const int N = 100010 ;
const int inf = 1e18 ; 
const int MOD = 1e9+7 ;

struct node {
	int x,y,dis ;
}e[100010];

bool cmp(node a,node b){
	return a.dis<b.dis ;
}

int n,m,ans ;
int dis[310][310] ;

void floyd(int k){
	rep(i,1,n) rep(j,1,n) dis[i][j]=dis[j][i]=min(dis[i][j],dis[i][k]+dis[k][j]) ;
}

void print(){
	printf("-1\n") ;
	exit(0) ;
}

signed main(){
	ios::sync_with_stdio(false) ;
	scanf("%lld",&n) ;
	rep(i,1,n) {
		rep(j,1,n) dis[i][j]=inf ;
		dis[i][i]=0 ;
	}
	rep(i,1,n) rep(j,1,n) {
		int x ;
		scanf("%lld",&x) ;
		if (j>i) {
			e[++m].x=i;
			e[m].y=j ;
			e[m].dis=x ;
		}
	}
	sort(e+1,e+m+1,cmp) ;//把边排序，选最小的构成图 
//	for (int i=1;i<=m;i++) cout<<e[i].x<<" "<<e[i].y<<" "<<e[i].dis<<endl ;
	for (int i=1;i<=m;i++){ //选较小的边，更新 
		int from=e[i].x,to=e[i].y,dist=e[i].dis ;
//		cout<<dis[from][to]<<endl ;
		if (dis[from][to]<dist) print() ;
		else if (dis[from][to]>dist){
			dis[from][to]=dis[to][from]=dist ;
			ans+=dist ;
			floyd(from);floyd(to) ;
		}
	}
	printf("%lld\n",ans) ; 
}
/*
3
0 1 3
1 0 1
3 1 0
*/


Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int card[255][14]={{0}};

int main(void){
   int n,i,num;
   cin >> n;
   for(i=0;i<n;i++){
       char c;
       cin >> c >> num;
       card[(int)c][num]=1;
   }
   for(i=1;i<=13;i++){
       if(card[(int)'S'][i]==0){
           cout << "S" << " " << i << endl;
       }
   }
   for(i=1;i<=13;i++){
       if(card[(int)'H'][i]==0){
           cout << "H" << " " << i << endl;
       }
   }
   for(i=1;i<=13;i++){
       if(card[(int)'C'][i]==0){
           cout << "C" << " " << i << endl;
       }
   }
   for(i=1;i<=13;i++){
       if(card[(int)'D'][i]==0){
           cout << "D" << " " << i << endl;
       }
   }
}


Measured memory_bytes: 3112
#include<iostream>
#include<vector>
#include<string>
#include<queue>
using namespace std;

int main(){

	int L,N;
	
	priority_queue<string,vector<string>,greater<string>> S;

	cin>>N>>L;

	for(int i=0;i<N;i++){
		string s;
		cin>>s;
		S.push(s);
	}
	
	string gousei = "";
	while(!S.empty()){
		gousei += S.top();	
		S.pop();
	}
	cout<<gousei<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r0,w0,c,r,i,j,k;
  while(cin>>r0>>w0>>c>>r,r0||w0||c||r){
    i=0;
    while(1){
      if(r0+i*r>=w0*c) break;
      i++;
    }
    cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 3076
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

void add(int &a, int b, int mod) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int mul(int a, int b, int mod) {
  return (int)((long long)a * b % mod);
}

int pw(int a, int b, int mod) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a, mod);
    }
    a = mul(a, a, mod);
    b /= 2;
  }
  return res;
}

const int N = 3'009;

int c[N][N];
int f[N][N];

int main() {
  int n, mod;
  scanf("%d %d", &n, &mod);
  memset(c, 0, sizeof c);
  for (int i = 0; i <= n; ++i) {
    c[i][0] = 1;
    c[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j];
      add(c[i][j], c[i - 1][j - 1], mod);
    }
  }
  memset(f, 0, sizeof f);
  f[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= i; ++j) {
      add(f[i + 1][j], mul(f[i][j], j + 1, mod), mod);
      add(f[i + 1][j + 1], f[i][j], mod);
    }
  }
  int ans = pw(2, pw(2, n, mod - 1), mod);
  for (int i = 1; i <= n; ++i) {
    int cur = 0;
    for (int j = 0; j <= i; ++j) {
      add(cur, mul(f[i][j], pw(2, (n - i) * j, mod), mod), mod);
    }
    cur = mul(cur, c[n][i], mod);
    cur = mul(cur, pw(2, pw(2, n - i, mod - 1), mod), mod);
    if (i % 2 == 1) {
      add(ans, mod - cur, mod);
    } else {
      add(ans, cur, mod);
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 71040
def resolve():
    s = input()
    k = int(input())
    cnt = -1
    for i in range(len(s)):
        if s[i] != '1':
            break
        cnt = i + 1
    if cnt >= k:
        print(1)
    else:
        print(s[cnt] if len(s) > cnt > -1 else s[0])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

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

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

		vector<int> c;
		set_symmetric_difference(
			a.begin(), a.end(),
			b.begin(), b.end(),
			back_inserter( c ) );

		for( int i = 0; i < (int)c.size(); ++i ) {
			cout << c[i] << '\n';
		}
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}



Measured memory_bytes: 6496
from collections import defaultdict
def unification(s):

    ans = 0
    d = defaultdict(int)
    for k in s:
       d[k] += 1

    ans = len(s) - abs(d["0"]-d["1"])

    return ans

def main():
    s = str(input())
    print(unification(s))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
vector<long long> factors;
bool check(long long a,long long b)
{
    while(b%a==0) b/=a;
    if(b%a==1) return true;
    else return false;
}
int main()
{
    long long n;
    scanf("%lld",&n);
    long long i,cnt=0;
    for(i=2;i*i<=n;i++)
        if(check(i,n)) cnt++;
    cnt++; n--;
    for(long long j=1;j*j<=n;j++)
        if(n%j==0)
        {
            if(j*j==n) factors.push_back(j);
            else
            {
                factors.push_back(j);
                factors.push_back(n/j);
            }
        }
    for(int j=0;j<(int)factors.size();j++)
        if(factors[j]>=i)
            cnt++;
    printf("%lld\n",cnt);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e7+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;

int main(){
	REP(i, 3){
		string s;
		cin >> s;
		cout << s[0];
	}
	cout << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii; 
const int N = 2e5+10, mod = 1e9+7;

void solve() {
    int n; cin >> n;
    ll a[n];

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

    sort(a, a + n);
    reverse(a, a + n);
    ll ans = a[0], ptr = 1, cnt = 0;

    n -= 2;
    while (n--) {
        if (cnt > 1) {
            cnt = 0;
            ++ptr;
        }
        ans += a[ptr];
        ++cnt;
    }

    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1; 
    while (t--) solve();
    return 0;
}


Measured memory_bytes: 5188
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int n_max = 2e5;
const bool debug = false;

int n,q;
vector<vector<int>> ls(n_max+1);
vector<ll> cnts(n_max+1);
vector<bool> visited(n_max+1);

void dfs(int v, ll cnt){
    if(debug) cout << "dfs:" << v << " " << cnt << endl;
    cnts.at(v) += cnt;
    visited.at(v) = true;
    for(int x : ls.at(v)){
        if(!visited.at(x)){
            dfs(x, cnts.at(v));
        }
    }
}

int main(){
    cin >> n >> q;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        ls.at(a).push_back(b);
        ls.at(b).push_back(a);
    }

    rep(j,q){
        int a,b;
        cin >> a >> b;
        cnts.at(a) += b;
    }

    dfs(1,0);

    rep(i,n){
        if(i > 0) cout << " ";
        cout << cnts.at(i+1);
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 24320
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int n,MOD,a,b,c,t;

template<class T>
class matrix{
public:
	vector<vector<T>> elm;
	int height,width;
	
	
	matrix():height(0),width(0){};
	matrix(int h,int w):height(h),width(w){
		elm.resize(h,vector<T>(w,0));	//0-padding
	}
	
	matrix<T> operator * (const matrix m)const{
		assert(width==m.height);
		matrix<T> ret(height,m.width);
		rep(i,height){
			rep(j,m.width){
				rep(k,width){
					(ret.elm[i][j] += elm[i][k]*m.elm[k][j])%=MOD;
				}
			}
		}
		return ret;
	}
};


vector<matrix<int>> T;

matrix<int> f(int t,matrix<int> v){
	matrix<int> ret = v;
	int c=0;
	while(t){
		if(t%2==1)ret = T[c]*ret;
		t/=2;
		c++;
	}
	return ret;
}


int main(){
	while(cin>>n>>MOD>>a>>b>>c>>t&&(n||MOD||a||b||c||t)){
		matrix<int> v(n,1);
		rep(i,n)cin>>v.elm[i][0];
		
		T.clear();
		T.resize(30,matrix<int>(n,n));
		rep(i,n)T[0].elm[i][i]=b;
		rep(i,n-1)T[0].elm[i][i+1]=c;
		rep(i,n-1)T[0].elm[i+1][i]=a;
		
		for(int i=1;i<30;i++) T[i] = T[i-1] * T[i-1];
		
		matrix<int> res = f(t,v);
		rep(i,res.height){
			if(i)cout<<" ";
			cout<<res.elm[i][0];
		}
		cout<<endl;
	}
}

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


public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder builder = new StringBuilder();
		int i = 1;
		while(true){
			int data = Integer.parseInt(reader.readLine());
			if (data == 0)
				break;
			builder.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(data)).append("\n");
		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 31256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=200000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int n;
char s[N];

int main()
{
    scanf("%s",s+1);n=strlen(s+1);
    ll ans=0;
    int c0=0,c1=0;
    rep(i,1,n) 
    {
        if (s[i]=='0') c0++;else c1++;
    }
    int pre=0;
    rep(i,1,n)
    {
        if (s[i]=='0') pre++;
        else
        {
            if (s[i+1]=='1')
            {
                ans+=(c0+1);i++;
            }
            else
            {
                ans+=((i&1)+(c0-pre));
                if (i&1) ans+=(pre>>1);
                else ans+=((pre+1)>>1);
            }
        }
    }
    per(i,c1-1,1) ans+=((i+1)>>1);
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RSORT(x) sort(x.begin(), x.end(),greater<int>())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define VLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define VSTR(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,k,m,l,n,r,x,y,z,ans=100000000,ans2=0,cnt=0;
string s,S,t;
bool flag=false;
int main() {
long double x;
ios_base::sync_with_stdio(false);
cin>>n>>m;
vector<int>H(m+1,0);
REP(i,n){
    cin >> k;
    REP(i,k){
       cin>>a;
       H[a]++; 
    }
}
REP(i,m+1){
    if(H[i]==n)ans2++;
}
cout<<ans2<<endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 1; i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int INF=1e10;

int main(){
	ll n,ans=0;
	cin >> n;
	rep(i,n){
		rep(j,n){
			if(i*j<n)ans++;
			else break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793


int main(){
    int r; cin >> r;
    cout << (double)r*PI*2 << endl;
}

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

ll cpt(ll B, ll x) {
	ll A=B+x;
	return A*A*A*A*A-B*B*B*B*B;
}

int eval(int x, int X) {
	int low=-int(x/2);
	for (int B=low; ; B++) {
		ll cur=cpt(B,x);
		if(cur>X) break;
		if(cur==X) return B;
	}
	return 0;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int X; cin>>X;
	set<int> st;
	for (int x=1; x*x<=X; x++)
		if(X%x==0)
			st.insert(x), st.insert(X/x);
	for (int x : st) {
		int B=eval(x,X);
		if(cpt(B,x)==X) {
			cout<<B+x<<" "<<B<<"\n";
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3636
use proconio::input;
// use proconio::marker::{Bytes, Chars};

fn main() {
    input! {
        n: usize,
        d: i64,
        xy: [(i64, i64); n],
    }
    let mut count = 0;
    let dd = d * d;
    for num in xy {
        if num.0 * num.0 + num.1 * num.1 <= dd {
            count += 1;
        }
    }

    println!("{}", count);
}

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

#ifdef TESTING
  #include "dump.hpp"
#else
  #define DUMP(...)
  #define DEBUG(...)
#endif

typedef long long LL;
typedef long long ll;
typedef unsigned long long ULL;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)

#define INT(n) int n;scanf("%d",&n)
#define AI(a,size,n) array<int,size> a;REP(i,n){scanf("%d",&a[i]);}
#define VI(v,n) vector<int> v(n);REP(i,n){scanf("%d",&v[i]);}
#define MSET(arr,val)  memset(arr,val,sizeof(arr))

int main(){
  INT(n); VI(as, 3 * n);
  LL sl[3 * n], sr[3 * n], s = 0;
  priority_queue<int, vector<int>, greater<int>> ql, qr;
  REP(i, n){
    ql.push(as[i]);
    s += as[i];
  }
  REP(i, 3 * n){sl[i] = s;}
  s = 0;
  REP(i, 2 * n, 3 * n){
    qr.push(-as[i]);
    s -= as[i];
  }
  REP(i, 3 * n){sr[i] = s;}
  REP(i, n, 2 * n){
    int ai = as[i], al = ql.top(); ql.pop();
    if (ai < al){
      sl[i] = sl[i - 1];
    } else {
      sl[i] = sl[i - 1] - min(al, ai) + max(al, ai);
    }
    ql.push(max(al, ai));
  }
  REP(i, 2 * n, n){
    int ai = -as[i], ar = qr.top(); qr.pop();
    if (ai < ar){
      sr[i] = sr[i + 1];
    } else {
      sr[i] = sr[i + 1] - min(ar, ai) + max(ar, ai);
    }
    qr.push(max(ar, ai));
  }
  LL ans = sl[n - 1] + sr[n];
  REP(i, n - 1, 2 * n){
    ans = max(ans, sl[i] + sr[i + 1]);
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 7032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,n,x,c,res,sum,n1,m;
    scanf("%lld%lld",&n,&x);
    a = x;
    b = n-x;
    res = b/a ;
    n1 = b - (a*res);
    sum = n;

    while(1)
    {
        if(n1==0)
        {

            sum+=((res*2)-1)*a;
            break ;

        }
        sum+=(res*2)*a;

        if(a>n1)
        {
            m=a;
            a = n1 ;
            b = m ;
        }
        res = b/a;
        n1 =  b - (a*res);

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


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

int n,k;
double pw[100001],win;

int main ()
{
    cin >> n >> k;
    pw[0] = 1;
    for ( int i = 1 ; i <= n ; ++ i )
	    pw[i] = pw[i-1] * 0.5;
    for ( int i = 1 ; i <= n ; ++ i )
    {
        double pi = 1.0 / n;
        int cur = i;
        while ( cur < k )
		{
			cur *= 2;
			pi *= 0.5;
		}
        win += pi;
    }
    
    cout << fixed << setprecision ( 10 ) << win << endl;
    
    return 0;
    
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;

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

typedef struct Node_tag Node;

Node *root;
Node *nil = (Node *)malloc(sizeof(Node));

void init(){
	nil->parent = nil->left = nil->right = nil;
	root = nil;
}

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

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

void insert(Node *z){
	Node *x = root, *y = 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;
}

Node* find(Node *x, int k){
	while(x != nil && k != x->key){
		if(k < x->key)
			x = x->left;
		else
			x = x->right;
	}
	return x;
}

Node* getMinimum(Node *x){
	while(x->left != nil)
		x = x->left;
	return x;
}

Node* getSuccessor(Node *x){
	if(x->right != nil)
		return getMinimum(x->right);
	Node *y = x->parent;
	while(y != nil && x == y->right){
		x = y;
		y = y->right;
	}
	return y;
}

void deleteNode(Node *z){
	Node *x, *y;
	if(z->left == nil || z->right == nil)
		y = z;
	else
		y = getSuccessor(z);
		
	if(y->left != nil)
		x = y->left;
	else
		x = y->right;
	
	if(x != nil)
		x->parent = y->parent;
	
	if(y->parent == nil)
		root = x;
	else if(y == y->parent->left)
		y->parent->left = x;
	else
		y->parent->right = x;
	
	if(y != z)
		z->key = y->key;
}

int main(void){
	int m, i, key;
	char S[10];
	init();
	scanf("%d", &m);
	for(i = 0;i < m;i++){
		scanf("%s", S);
		if(S[0] == 'p'){
			inParse(root);
			printf("\n");
			preParse(root);
			printf("\n");
		} else {
			scanf("%d", &key);
			if(S[0] == 'i'){
				Node *z = (Node *)malloc(sizeof(Node));
				z->key = key;
				z->left = z->right = nil;
				insert(z);
			} else if(S[0] == 'f'){
				if(find(root, key) != nil)
					printf("yes\n");
				else
					printf("no\n");
			} else
				deleteNode(find(root, key));	//??¨????????¨?????????key????????????????????´?????¨??????????????????????????????
		}
	}
	return 0;
}

Measured memory_bytes: 21496
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.exec();
	}
	
	public void exec() {
		Scanner sc = new Scanner(System.in);
		int p = Integer.parseInt(sc.nextLine());
		String[] strArr = sc.nextLine().split(" ");
		sc.close();
		int[] aArr = new int[p];
		for(int i = 0; i < p ; i++) {
			aArr[i] = Integer.parseInt(strArr[i]);
		}
		
		int[] factArr = new int[p];
		int[] recipFactArr = new int[p]; 
		
		factArr[0] = 1;
		recipFactArr[0] = 1; 
		makeFactArr(factArr, p);
		makeRecipFactArr(recipFactArr,p,factArr[factArr.length - 1]);
		
		int[] coefArr = new int[p];
		for(int i = 0; i < p; i++) {
			if(aArr[i] == 0) {
				continue;
			}
			coefArr[p - 1] = mod(coefArr[p - 1] - 1,p);
			int powValue = 1;
			for(int j = 1; j <= p - 1; j++) {
				powValue = mod(powValue * (-i),p);
				int addValue;
				int factValue = mod(mod(factArr[p - 1] * recipFactArr[j],p) * recipFactArr[p - 1 - j], p);
				addValue = mod(factValue * powValue,p);
				
				coefArr[p - 1 - j] = mod(coefArr[p - 1 - j] - addValue,p);
			}
			coefArr[0] = mod(coefArr[0] + 1, p);
//			System.out.println(Arrays.toString(coefArr));
		}
		
		for(int i = 0; i < p; i++) {
			System.out.print(coefArr[i]);
			if(i == p - 1) {
				System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.flush();
	}
	
	public long fact(long n) {
		long result = 1;
		for(long i = 1;i <= n;i++ ) {
			result *= i;
		}
		return result;
	}
	
	public void makeFactArr(int[] factArr, int base) {
		for(int i = 1; i < factArr.length; i++) {
			factArr[i] = mod(factArr[i-1] * i, base);
 		}
	}
	
	public void makeRecipFactArr(int[] recipFactArr, int base, int lastFactVal) {
		recipFactArr[recipFactArr.length - 1] = makePowWithBase(lastFactVal, base - 2, base);
		for(int i = recipFactArr.length - 1; i > 0; i--) {
			recipFactArr[i - 1] = mod(recipFactArr[i]*i,base);
		}
	}
	
	public int makePowWithBase(int value, int time, int base) {
		int retVal = 1;
		for(int i = 0; i < time; i++) {
			retVal = mod(retVal * value,base);
		}
		return retVal;
	}
	
	public int munusSurplus(int value, int base) {

		int invValue = value * (-1);
		if(invValue % base == 0) {
			return 0;
		}
		int x = invValue / base;
		return value + ((x + 1) * base);
	}
	
	public int mod(int value, int base) {
//		if(value < 0) {
//			return munusSurplus(value, base);
//		}else {
//			return value % base;
//		}
		return value % base + ((value % base) < 0 ? base : 0);
	}

}


Measured memory_bytes: 25044
n, m, x = map(int, input().split())
ca = [list(map(int,input().split())) for _ in range(n)]

add = []

for i in range(2**n):
    skill = [0]*(m+1)
    for j in range(n):
        if ((i>>j) & 1):
            skill = list(map(sum, zip(skill, ca[j])))
    if min(skill[1:])>=x:
        add.append(skill)

if add:
    add.sort()
    print(add[0][0])
else:
    print(-1)

Measured memory_bytes: 11256
#include <bits/stdc++.h>
using namespace std;
const int N=2005,Mod=1e9+7;
int v[N],f[N];
inline int qpow(int a,int b){
	int ans=1;
	while (b){
		if (b&1) ans=1ll*ans*a%Mod;
		a=1ll*a*a%Mod,b>>=1;
	}
	return ans;
}
int main(){
    int n,k,tot=0,ans=0;
    scanf ("%d%d",&n,&k);
    for (int i=1; i*i<=n; i++)
        if (n%i==0) {
			v[++tot]=i;
			if (i*i!=n) v[++tot]=n/i;
		}
    sort(v+1,v+tot+1);
    for (int i=1; i<=tot; i++){
        f[i]=qpow(k,(v[i]+1)/2);
        for (int j=1; j<i; j++) if (v[i]%v[j]==0) f[i]=(f[i]-f[j]+Mod)%Mod;
        if (v[i]&1) ans=(1ll*ans+1ll*v[i]*f[i]%Mod)%Mod;
        else ans=(1ll*ans+1ll*(v[i]/2)*f[i]%Mod)%Mod;
    }
    printf ("%d",ans);
    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 __gnu_pbds;
using namespace std;
#define in(s) ll s; cin >> s
#define prarr(a, i ,n) fab(j, i , n) cout << a[j] << " "
#define wh(t) ll t; cin >> t; while(t--)
#define sz(u) u.size()
#define deb(x) cout << #x << " " << x << endl
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define arr(a,n) vl a(n, 0); fab(i, 0, n) cin >> a[i]
#define fab(i,a,b) for(ll i = a; i < b; i++)
#define fba(i,b,a) for(ll i = b; i >= a; i--)
#define fa(i, x) for(auto i: x)
#define mem(s, j) memset(s, j, sizeof(s))
#define sup ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define ll long long int
#define vl vector<ll>
#define vpl vector<pl>
#define pl pair<ll, ll>
#define pll pair<ll, pl>
#define vvl vector<vl>
#define vvpl vector<vpl>
#define mxe(x) *max_element(x)
#define mne(x) *min_element(x)
#define mp make_pair
#define pb push_back
#define fs first
#define sd second
#define fr front()
#define bk back()
#define rr return
const ll N = (ll)3e5;
const ll inf = (ll)1e18 + 7;
const ll mod = (ll)1e9 + 7;
const ll MX = (ll)1e9 + 7;
const ll MAX = (ll)1e12 + 7;

bool sortbysec(const pair<ll, ll> &a,const pair<ll, ll> &b){ return (a.second < b.second);}

//-------------policy based-----------------------------
typedef tree<int, null_type, less<int>, rb_tree_tag, 
        tree_order_statistics_node_update> pb_set;
//------------------------------------------------------


vector<char> dir = {'L', 'R', 'U', 'D'};
vl dx = {-1, 1, 0, 0};
vl dy = {0, 0, -1, 1};

void add(ll &x, ll y){
    x = ((x % mod) + (y % mod)) % mod;
}

void mul(ll &x, ll y){
    x = ((x % mod) * (y % mod)) % mod;
}

ll sm(vl a) {
    ll sum = 0;
    for(auto i: a)
        sum += i;
    return sum;
}

ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return power(x, y / 2) * power(x, y / 2); 
    else
        return x * power(x, y / 2) * power(x, y / 2); 
}
 
bool isPrime(ll p)
{
    for(ll i = 2;i * i <= p; i++)
        if(p % i == 0)
            rr false;
    rr true;
}


int main()
{
	sup;
    
    in(x);
    cout << (x / 500) * 1000 + ((x % 500) / 5) * 5;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
ll pow_mod(ll fi,ll se,ll mod){
  if(se==0){
    return 1;
  }
  if(se%2){
    return pow_mod(fi,se-1,mod)*fi%mod;
  }
  ll t=pow_mod(fi,se/2,mod);
  return t*t%mod;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}

vector<pair<int,int>> Dir={{-1,0},{1,0},{0,1},{0,-1}};
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
  ll r,d,x;
  cin>>r>>d>>x;
  ll ans=r*x-d;
  rep(i,10){
    op(ans);
    ans=r*ans-d;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll N, X;

    cin >> N >> X;

    ll L[N+5];
    ll D[N+5];
    D[0] = 0;

    ll cnt = 1;

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

    for(int i = 1; i <= N; i++) {
        D[i] = D[i-1] + L[i-1];
        if(D[i] > X) break;
        cnt++;
    }

    cout << cnt;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
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;

// --------write my code!!!!!----------//

int main(){
    int a,b; cin >> a >> b;
    cout << a*b/2<< endl;
}


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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int INF = 1e9 + 7;


int main(void)
{
	FAST
	
	pii start, end;
	int length;

	cin >> start.first >> start.second >> end.first >> end.second >> length;

	int delta = 0;

	if(start.first == end.first)
	{
		delta = end.second-start.second;
	}
	else
	{
		start.first++;
		delta += 60-start.second;
		start.second = 0;
		delta += (end.first-start.first)*60;
		delta += end.second;
	}

	cout << (delta - length) << '\n';
		
	
	return 0;
}


Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadLong();
            var ans = long.MaxValue;
            for (var i = 1; i <= Sqrt(N); i++)
            {
                var j = (N / i);
                if (i * j == N)
                    ans = Min(ans, i + j - 2);
            }

            Println(ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 13140
'''
ITP-1_6-A
 ??°???????????¢
?????????????????°???????????????????????????????????°?????????????????????????????????
???Input
??\????????\????????¢?????§?????????????????????
n
a1 a2 . . . an
n ?????°????????????????????????ai ??? i ???????????°?????¨????????????
???Output
???????????°?????????????????????????????????????????°??????????´??????????????????????????????\???????????????
??????????????°????????????????????\??????????????¨?????¨????????????????????????
'''
# import
import sys

# ?????°??????????????????
## ??°????????????
cntData = int(input())
#inputData = map(int, input().split())
## ??°
inputData = input().split(" ")

# sort
# inputData.sort(reverse=True)
inputData.reverse()

# Output
print(" ".join(inputData))

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

// #define NDEBUG
#include<assert.h>
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int res = 0;
  for(int i = 0; i < 3; ++i) {
    if(s[i] == 'R') res++;
  }
  if(s[1] == 'S') {
    res = min(1, res);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main()
{
    int n,i;
    scanf("%d\n",&n);
    int ar[n];
    for(i=0; i<n ; i++)
    {
        scanf("%d",&ar[i]);

    }
    int max;
    max=ar[0];
    for(i=1; i<n; i++)
    {
        if(max<ar[i])
        {
            max=ar[i];
        }
    }
    int j,temp;
    for(i=0; i<n-1; i++)
    {
        for(j=0; j<n-i-1; j++)
        {
            if(ar[j]>ar[j+1])
            {

                temp=ar[j];
                ar[j]=ar[j+1];
                ar[j+1]=temp;
            }
        }


    }
    int sum=0;
    for(i=0; i<n-1; i++)
    {
        sum=sum+ar[i];
    }
    printf("%d\n",(sum+max/2));
    return 0;
}









Measured memory_bytes: 1720
import java.util.*;
import java.io.*;
public class Main {
 
	public static void main(String[] args) throws Exception{
		int num = 998244353;
 
		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		long a = Long.parseLong(st.nextToken());
 		double b = Double.parseDouble(st.nextToken());
 		int c = (int)(b*100.0001);
 		long d = a*(long)(c);
 		out.println((d-((a%100)*(c%100))%100)/((long)(100)));
 		out.close();
 		
 	}
 
}

Measured memory_bytes: 25292