akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
const long long INFll=1ll*INF*INF;
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug(x) cout << x << endl;
#define sz(a) int((a).size())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash>
    //gp_hash_table<long long, int, custom_hash>
};
long long genrand(long long L,long long R)
{
	return uniform_int_distribution<long long>(L, R)(rng);
}
int mul(int a, int b,int mod = MOD) {
	return int(a * 1ll * b % mod);
}
int norm(int a,int mod = MOD) {
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
	return a;
}
int powmod(int x,int y,int mod = MOD){
	int res = 1;
	while(y>0)
	{
		if(y&1)
			res = mul(res,x,mod);
		x = mul(x,x,mod);
		y=y>>1;
	}
	return res;
}
int inv(int a,int mod = MOD) {
	return powmod(a, mod - 2);
}
int main() {
	
	int a, b, k; cin>>k>>a>>b;

	if(b-a+1>=k || a%k==0 || (a%k > b%k)){
		cout<<"OK";
	}
	else{
		cout<<"NG";
	}
	
	return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#define P pair<int,int>
#define int long long
const int N=1e5+5,p=1e9+7;
inline int read(){
    int x=0;char ch=getchar();
    for(;ch<48||ch>57;ch=getchar());
    for(;ch>47&&ch<58;ch=getchar())
    x=(x<<1)+(x<<3)+(ch^48);return x;
}
using namespace std;
signed main()
{
    read();int a=read(),b=read();
    puts((a^b)&1?"Borys":"Alice");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n,a,b;
    cin >> n >> a >> b;

    vector<LL> vec(n);

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

    LL ans = 0;

    for(int i = 0; i < n-1; i++){
        ans += min((vec[i+1]-vec[i])*a,b);
    }

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

Measured memory_bytes: 1024
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <unordered_map>
#define ll long long
#define INF 0x3f3f3f3f
#define rep(i,x,y) for(int i = x;i <= y;++i)
#define fori(i,x,y) for(int i = x;i >= y; -- i)
#define bug puts("--------------")
#define out(x) cout<<x<<'\n';
inline char gc(){char op[2];scanf("%s",op);return op[0];}
const int N =2e5+10;
const double eps = 0.00000001;
const ll mod = 1e9 + 7;
using namespace std;
ll read()
{
    ll 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;
}
ll Qpow(ll a,ll b,ll p){
    a = (a % p + p)%p;
    ll ans = 1;
    while(b){
        if(b&1) ans = ans * a % p;
        b >>= 1;
        a = a * a%p;
    }
    return ans;
}
ll dp[N];
int main(){
    ll n = read(),k = read();
    ll ans = 0;
    for(int i = k; i >= 1; -- i){
        dp[i] = Qpow(k/i,n,mod);
        for(int j = 2 * i;j <= k;j += i) dp[i] = (dp[i]-dp[j]+mod)%mod;
        ans = (ans + 1LL*i*dp[i]+mod)%mod;
    }
    cout << ans;
}

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

int main() {
	long n,k;
	cin>>n>>k;
	long h[n];
    for(int i=0;i<n;i++)cin>>h[i];
    sort(h,h+n);
    long p[n-k+1];
    for(int i=0;i<n-k+1;i++){
    	p[i]=h[i+k-1]-h[i];
    }
    sort(p,p+(n-k+1));
    cout<<p[0]<<endl;
	return 0;
}

Measured memory_bytes: 1792
import sys
stdin = sys.stdin
def ls(): return stdin.readline()

def li(): return map(int, stdin.readline().split())
N, K = tuple(li())
S = ls()
sl = []
for i, c in enumerate(S):
    if i == K -1:
        sl.append(c.lower())
    else:
        sl.append(c)

print(''.join(sl))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    if(e-a>f){
        cout<<":("<<endl;
    }
    else{
     cout<<"Yay!"<<endl;  
    }
}

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

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;


//abc066_b
//aaaa →　aa 2
//同じ文字列が2回並ぶまで
int main()
{
    string S;
    cin >> S;

    ll a[26] = {};

    string tmpS1,tmpS2;

    for(ll i = S.size() -3; i >= 1; i-=2)
    {

        tmpS1 = S.substr(0,i/2);
        tmpS2 = S.substr(i/2+1,i);

        bool isOK = true;

        for(ll j = 0; j < tmpS1.size(); ++j)
        {
            if(tmpS1[j] != tmpS2[j])
            {
                isOK = false;
                break;
            }
        }
        if(isOK)
        {
            cout << i+1 << endl;
            return 0;
        }


    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;


int main() {
    ll n, m; cin >> n >> m;
    vector<ll> h(n); rep(i, n) cin >> h[i];
    vector<vector<ll>> g(n);
    rep(i, m) {
        ll a, b; cin >> a >> b; a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ll ans = 0;
    rep(i, n) {
        bool fl = 1;
        for(ll x : g[i]) if(h[i] <= h[x]) fl = 0;
        if(fl) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 9844
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> a(m), p(n, 0);
	for (int i = 0; i < m; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++)
		p[a[i]]++;
	int x_f = 0, x_b = 0;
	for (int i = 1; i < x; i++)
		x_f += p[i];
	for (int i = x + 1; i < n; i++)
		x_b += p[i];
	cout << min(x_f, x_b) << endl;
	return 0;
}

Measured memory_bytes: 256
# 囲いを作らないように端から順に塗っていけばよい
# あとはマス目をどう管理するか
h,w = list(map(int, input().split()))
n = int(input())
a = [0] + list(map(int, input().split()))[::-1]
b = [[0] * w for _ in range(h)]
color = 1
rest = a.pop()
for x in range(w):
    if x&1:
        hh = reversed(range(h))
    else:
        hh = range(h)
        
    for y in hh:
        b[y][x] = color
        rest -= 1
        if rest == 0:
            color += 1
            rest= a.pop()

for line in b:
    print(*line)

Measured memory_bytes: 9296
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
vector <int> F(30);
int main(){
    int N , M;
    cin >> N >> M;
    vector <int> K(N);
    for(int i = 0; i < N; i++){
        cin >> K[i];
        for(int j = 0; j < K[i]; j++){
            int A;
            cin >> A;
            F[A - 1]++;
        }
    }
    int best_food = 0;
    for(int i = 0; i < M; i++){
        if(F[i] == N){
            best_food++;
        }
    }
    cout << best_food << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
long long n,s[15],d[15],v[15];vector<long long>Z;
pair<long long,vector<long long>>dp[1<<15][15];
int main(){
	cin>>n;for(int i=0;i<n;i++)cin>>s[i]>>d[i]>>v[i];
	for(int i=0;i<(1<<n);i++){for(int j=0;j<n;j++)dp[i][j]=make_pair(2e18,Z);}
	for(int i=0;i<n;i++){dp[(1<<i)][i]=make_pair(0,vector<long long>{s[i]});}
	
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if(dp[i][j].first>19e17)continue;
			long long u=0;for(int k=0;k<n;k++){if((i/(1<<k))%2==1)u+=v[k];}
			u*=20;u+=70;
			for(int k=0;k<n;k++){
				if((i/(1<<k))%2==1)continue;
				long long sc=dp[i][j].first+abs(d[k]-d[j])*u;
				if(dp[i+(1<<k)][k].first>sc){
					dp[i+(1<<k)][k].first=sc;vector<long long>c=dp[i][j].second;
					c.push_back(s[k]);dp[i+(1<<k)][k].second=c;
				}
			}
		}
	}
	long long minx=2e18;vector<long long>ret;
	for(int i=0;i<n;i++){
		if(minx>dp[(1<<n)-1][i].first){
			minx=dp[(1<<n)-1][i].first;ret=dp[(1<<n)-1][i].second;
		}
	}
	for(int i=0;i<(int)ret.size();i++){if(i)cout<<' ';cout<<ret[i];}cout<<endl;
	return 0;
}

Measured memory_bytes: 36648
<?php


[$N] = fscanf(STDIN, "%d");
//$ans = $N * ($N+1) /2 ;
$ans = 0;
for($i=1;$i<=$N;$i++){
    for($j = $i; $j<= $N; $j+=$i){
        $ans += $j;
    }
}
echo $ans;

Measured memory_bytes: 16232
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x, y;
  cin >> x >> y;
  if (x == y) {
    cout << '=' << endl;
    return 0;
  }
  char m = max(x, y);
  if (m == x) {
    cout << '>' << endl; 
  } else {
    cout << '<' << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M (1000000007)
#define N (100010)
struct data{
	int a,b;
}a[N];
int n,m,ans,f[N];

bool cmp(data o1,data o2){
	return o1.b>o2.b;
}
int find(int x){
	if (f[x]==x) return f[x];
	else return f[x]=find(f[x]);
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d%d",&a[i].a,&a[i].b);
	for (int i=1;i<=m;i++) f[i]=i;
	sort(a+1,a+1+n,cmp);
	for (int i=1;i<=n;i++){
		if (a[i].a>m) continue;
		int fa=find(m-a[i].a+1);
		if (fa==0) continue;
		ans+=a[i].b; f[fa]=fa-1;
	}
	printf("%d",ans);
}


Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;


int main(){
	vector<int> v(3);
	for(int i=0;i<3;++i)
		cin>>v[i];
	sort(begin(v),end(v));
	if(v[0]==5&&v[1]==5&&v[2]==7){
		cout<<"YES\n";
	}
	else{
		cout<<"NO\n";
	}
	return 0;
}


Measured memory_bytes: 3548
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in range(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            elif ices[i] > ices[i+1]:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        elif i == N-1:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,input().strip().split())
ices = [int(input().strip()) for _ in range(N)]


orderN(N,L,ices)

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  string s;
  cin >> s;
  stack<int> st;
  for (char c : s) {
    if (c == 'B') {
      if (!st.empty()) {
        st.pop();
      }
    } else {
      st.push(c);
    }
  }
  string res = "";
  while (!st.empty()) {
    char c = st.top();
    st.pop();
    string ss{c};
    res.insert(0, ss);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
let N=Int(readLine()!)!,a=(1..<N).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}},C=a.map{$0[0]},S=a.map{$0[1]},F=a.map{$0[2]}
for i in 0..<N{print((i..<N-1).reduce(0){max(S[$1],(F[$1]+$0-1)/F[$1]*F[$1])+C[$1]})}

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

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

int main() {
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    int ans=A-B;
    if(abs(ans)>1e18){
        cout<<"Unfair"<<endl;
        return 0;
    }

    if(K%2==0) cout<<ans<<endl;
    else cout<<-ans<<endl;

    return 0;
}


Measured memory_bytes: 256
N,M=list(map(int,input().split()))

X=0
if N==1:
    if M==1:
        X=1
    if M==2:
        X=0
    if M>=3:
        X=M-2
if N==2:
    X=0
if N>=3:
    if M==1:
        X=N-2
    if M==2:
        X=0
    if M>=3:
        X=(N-2)*(M-2)
        
print(X)

Measured memory_bytes: 3060
N = int(input())
perm = [i for i in map(int,input().split())]
perm_new = [perm[0]]
import heapq
heapq.heapify(perm_new)
ans = 1
for i in range(1,N):
  now_min = heapq.heappop(perm_new)
  if now_min >= perm[i]:
    ans += 1
  heapq.heappush(perm_new,now_min)
  heapq.heappush(perm_new,perm[i])
  
print(ans)

Measured memory_bytes: 25768
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    LL x;
    LL m;
    cin >> n >> x >> m;
    vector<bool> is_visit(m, false);
    vector<LL> visit_idx(m, NIL);
    is_visit[x]=true;
    visit_idx[x]=1;
    LL first_visit_idx=NIL;
    LL second_visit_val=NIL;
    LL second_visit_idx=NIL;
    LL ans=0;
    LL tmp_x;
    if(n<=m){
        tmp_x=x;
        for(LL i=1; i<=n; i++){
            ans+=tmp_x;
            tmp_x=(tmp_x*tmp_x)%m;
        }
    }else if(x==0){
        ans=0;
    }else{
        LL tmp_x=x;
        for(LL i=2; i<=m; i++){
            tmp_x=(tmp_x*tmp_x)%m;
            if(is_visit[tmp_x]==true){
                second_visit_val=tmp_x;
                second_visit_idx=i;
                break;
            }else{
                is_visit[tmp_x]=true;
                visit_idx[tmp_x]=i;
            }
        }
        first_visit_idx=visit_idx[second_visit_val];
        tmp_x=x;
        for(LL i=1; i<first_visit_idx; i++){
            ans+=tmp_x;
            tmp_x=(tmp_x*tmp_x)%m;
        }
        tmp_x=second_visit_val;
        LL tmp_ans=0;
        for(LL i=first_visit_idx; i<second_visit_idx; i++){
            tmp_ans+=tmp_x;
            tmp_x=(tmp_x*tmp_x)%m;
        }
        LL res=n-(first_visit_idx-1);
        ans=ans+tmp_ans*(res/(second_visit_idx-first_visit_idx));
        res=res%(second_visit_idx-first_visit_idx);
        tmp_x=second_visit_val;
        for(LL i=0; i<res; i++){
            ans+=tmp_x;
            tmp_x=(tmp_x*tmp_x)%m;            
        }
        //cout << first_visit_idx << " " << second_visit_idx << " " << second_visit_val << endl;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define debug(x) cout << #x << " = " << (x) << endl;
#define MOD 1000000007
//#define MOD 998244353
#define EPS (1 >> 30)
//#define INF (1 << 30)
#define INF (1LL << 60)
#define ff first
#define se second
//#define int long long
const int dx[]={0,-1,0,1};
const int dy[]={1,0,-1,0};

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

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    ll n;
    cin>>n;
    ll ans=INF;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            ans=min(ans,i+n/i-2);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n, c = map(int, input().split())
sushi = [tuple(map(int, input().split())) for _ in range(n)]
sushi = [(0, 0)] + sushi
cclkmax = [0] * (n+1)
cumvalue = 0
for i in range(1, n+1):
    cumvalue += sushi[i][1]
    cclkmax[i] = max(cclkmax[i-1], cumvalue - sushi[i][0])
maxscore = cclkmax[n]
cum = 0
for i in range(n, 0, -1):
    cum += sushi[i][1]
    score = cclkmax[i-1] + cum - 2*(c - sushi[i][0])
    maxscore = max(maxscore, score)
clkmax = [0] * (n+1)
cumvalue = 0
for i in range(n, 0, -1):
    cumvalue += sushi[i][1]
    clkmax[i] = max(clkmax[(i+1)%(n+1)], cumvalue - (c - sushi[i][0]))
maxscore = max(maxscore, clkmax[1])
cum = 0
for i in range(1, n+1):
    cum += sushi[i][1]
    score = clkmax[(i+1)%(n+1)] + cum - 2*sushi[i][0]
    maxscore = max(maxscore, score)
print(maxscore)

Measured memory_bytes: 24328
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    ll a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0)
    {
        cout << (a + b) / 2 << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=4005,B=2002,Mod=1e9+7,S=2000,MX=8000;
typedef long long ll;
int f[N][N],a[210000],b[210000],fac[MX+10],inv[MX+10];
int C(int x,int y){return (ll)fac[x]*inv[y]%Mod*inv[x-y]%Mod;}
int Pow(int x,int y){
	if(y<0)y+=Mod-1;
	int ret=1;
	while(y){
		if(y&1)ret=(ll)ret*x%Mod;
		x=(ll)x*x%Mod,y>>=1;
	}
	return ret;
}
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d%d",a+i,b+i);
		f[B-a[i]][B-b[i]]++;
	}
	for(int i=-S;i<=S;i++)
		for(int j=-S;j<=S;j++)
			f[B+i][B+j]=((ll)f[B+i][B+j]+f[B+i-1][B+j]+f[B+i][B+j-1])%Mod;
	fac[0]=1;
	for(int i=1;i<=MX;i++)fac[i]=(ll)fac[i-1]*i%Mod;
	inv[MX]=Pow(fac[MX],-1);
	for(int i=MX;i;i--)inv[i-1]=(ll)inv[i]*i%Mod;
	for(int i=1;i<=n;i++){
		ans=(ans+f[B+a[i]][B+b[i]])%Mod;
		ans=(ans-C(2*(a[i]+b[i]),2*a[i]))%Mod;
	}
	ans=(ans*ll((Mod+1)/2)%Mod+Mod)%Mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 64512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    ll n;
    cin >> n;
    vector<int> a(n);
    for (auto &e : a) {
        cin >> e;
    }
    ll ans = 0;
    for (int i = 1; i + 1 < n; ++i) {
        ans += (a[i - 1] < a[i] && a[i] < a[i + 1]);
        ans += (a[i - 1] > a[i] && a[i] > a[i + 1]);
    }
    cout << ans;
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting, graph is not a tree/connected
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

N, K = map(int, input().split())

if K == 1:
    print(0)
else:
    print(N - K)


Measured memory_bytes: 3444
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	char c[1025];
	char* a;
	int i,n,p=0,l,f=0;
	gets(c);
	 n=strlen(c);
	 for (i=0;i<n;i++) if (c[i]=='.' || c[i]==',' || c[i]==' ') c[i]='\0';
	 while (p<n) {
		 a=&c[p]; l=strlen(a); p+=l+1;
		 if (l>2 && l<7) { if (f==0) { cout << a; f=1;} else cout << ' ' << a;}
         }
	 cout << endl;
	 return 0;
}

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

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    ll q,h,s,d,n;
    cin >> q >> h >> s >> d >> n;
    ll litter = min({q*4,h*2,s});
    cout << min(litter*n,n/2*d+n%2*litter) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;
namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        const double EPS = 1e-8;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };

        
        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var s1 = Console.ReadLine();
            var s2 = Console.ReadLine();
            int l1 = s1.Length;
            int l2 = s2.Length;
            var dp = new long[l1 + 1, l2 + 1];
            //s1->s2を考える　dp[i,j]=s1のi文字目までをs2のj文字目までと一致させるための操作回数
            for(var i = 0; i <= s1.Length; i++)
            {
                dp[i, 0] = i;
            }
            for(var j = 0; j <= s2.Length; j++)
            {
                dp[0, j] = j;
            }

            for(var i = 1; i <= l1; i++)
            {
                for(var j = 1; j <= l2; j++)
                {
                    int change = s1[i - 1] == s2[j - 1] ? 0 : 1;//変更する必要があるか

                    dp[i, j] = Min(dp[i - 1, j - 1] + change, Min(dp[i, j - 1] + 1, dp[i - 1, j] + 1));
                    //i-1,j-1文字目までにi文字目、j文字目を追加する ->　一致していればコスト増加はなし
                    //j文字目を追加する -> i文字目までをs2に一致させたあと、s1にj文字目と同じものを挿入する
                    //i文字目を追加する -> i-1文字目までをs2に一致させたあと、s1のi文字目を削除する
                }
            }

            Console.WriteLine(dp[l1, l2]);

            
            //Console.Out.Flush();
        }

    }

   

    

    

    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }
}



Measured memory_bytes: 23108
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n;
  cin>>n;
  string ans="ABC";
  if(n>=1000)ans="ABD";
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 125696
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = Integer.parseInt(sc.next());
        int N = Integer.parseInt(sc.next());
        int s = 0;
        for(int i = 0; i < N ;i++){
            s += Integer.parseInt(sc.next());
        }
        if(s >= H){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

using namespace std;

#define ll long long


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

    ll n;
    cin >> n;

    ll ans = 0;

    for (ll i = 1; n > 0; i *= 2) {
        ans += i;
        n /= 2;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"math/bits"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	q := getNextInt(scanner)
	b := uint64(0)
	for i := 0; i < q; i++ {
		t := getNextInt(scanner)
		switch t {
		case 0:
			x := getNextInt(scanner)
			fmt.Fprintln(writer, b>>uint(x)&1)
		case 1:
			x := getNextInt(scanner)
			b = b | (1 << uint(x))
		case 2:
			x := getNextInt(scanner)
			b = b & (math.MaxUint64 ^ (1 << uint(x)))
		case 3:
			x := getNextInt(scanner)
			b = b ^ (1 << uint(x))
		case 4:
			if b == math.MaxUint64 {
				fmt.Fprintln(writer, 1)
				continue
			}
			fmt.Fprintln(writer, 0)
		case 5:
			if b == 0 {
				fmt.Fprintln(writer, 0)
				continue
			}
			fmt.Fprintln(writer, 1)
		case 6:
			if b == 0 {
				fmt.Fprintln(writer, 1)
				continue
			}
			fmt.Fprintln(writer, 0)
		case 7:
			fmt.Fprintln(writer, bits.OnesCount64(b))
		case 8:
			fmt.Fprintln(writer, b)
		}
	}
}



Measured memory_bytes: 3896
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	String a,b,c;
	public void solve() {
		a = next();
		b = next();
		c = next();

		if(a.charAt(a.length()-1) == b.charAt(0) && b.charAt(b.length()-1) == c.charAt(0)){
			out.println("YES");
		}else{
			out.println("NO");
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include<stdio.h>
#define ll  long long int
#define M 300002
#define N 1000000000000000003
#define endl "\n"
using namespace std;
////////////////////////// data structures : priority queue, deque ,set , multiset, maps...........etc.........;;;;;;;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll dp[3003][3004]={0};
    ll n;cin>>n;
    ll arr[3005]={0};
    for(ll i=1;i<=n;i++)
    {
        cin>>arr[i];dp[i][i]=arr[i];
    }
    for(ll i=1;i<n;i++)
    {
        for(ll j=1;j<=n&&j+i<=n;j++)
        {
            dp[j][i+j]=max(dp[j][j]-dp[j+1][i+j],dp[i+j][i+j]-dp[j][i+j-1]);
        }
    }
    cout<<dp[1][n]<<endl;
    return 0;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  vector<int> R(N);
  for(int i=0; i<M; i++){
    int p;
    string S;
    cin >> p >> S;
    if(S=="AC") A.at(p-1)++;
    if(S=="WA" && A.at(p-1)==0) R.at(p-1)++;
  }
  int AC=0;
  for(int i=0; i<N; i++) if(A.at(i)>0) AC++;
  int Pn=0;
  for(int i=0; i<N; i++){
    if(A.at(i)>0) Pn+=R.at(i);
  }
  cout << AC << ' ' << Pn << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        sc.close();
        double area = r*r*Math.PI;
        double length = 2.0*r*Math.PI;
        System.out.print(String.format("%.5f",area) + " ");
        System.out.print(String.format("%.5f",length));
    }
}


Measured memory_bytes: 28132
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
    int q, com, x;
    string key;
    map<string, int> M;
    cin >> q;
    
    rep(i, q)
    {
        cin >> com >> key;
        
        if (com == 0)
        {
            cin >> x;
            M[key] = x;
        }
        else if (com == 1)
        {
            cout << M[key] << endl;
        }
        else
        {
            M.erase(key);
        }
    }
}



Measured memory_bytes: 27676
using System;

namespace ConsoleApp22
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] array = line.Split(' ');
            int n = int.Parse(array[0]);
            int m = int.Parse(array[1]);

            string li = Console.ReadLine();
            string[] ar = li.Split(' ');

            int[] arr = new int[m];
            for (int index = 0; index < m; index++)
            {
                int num = int.Parse(ar[index]);
                arr[index] = num;
            }

            int sum = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                sum += arr[i];
            }

            if (sum > n)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(n - sum);
            }
        }
    }
}


Measured memory_bytes: 28480
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<map>
#include<iostream>
#include<string.h>
#include<queue>
#include<set>

using namespace std;


set< string >res;
map< string, vector< string > >mmset;
map< string, bool >visited;

int N;
char buf[20];
int main(){
    string fst = "";
    while(true){
        cin>>N; if(N==0)break;
        res.clear();
        mmset.clear();
        visited.clear();
        for(int i=0;i<N;i++){
            int p = 0; char buf1; while((buf1 = getchar())&&buf1!=':'){
                buf[p++] = buf1;
            }
            string t = string(buf,p);
//             cout << "header: " << t << "!" << endl;
            if(i==0) fst = t;
            char inc; p = 0; while((inc = getchar()) && inc!='\n' && inc!='\r'){
                if(inc == ',' || inc == '.'){
                    string tt = string(buf, p);
                    mmset[t].push_back(tt);
//                     cout<<"found: "<<tt<<endl;
                    p = 0;
                } else {
                    buf[p++] = inc;
                }
            }
        }
        queue< string >workingset;
        workingset.push(fst);
        while(!workingset.empty()){
            string pivot = workingset.front(); workingset.pop();
            if(visited[pivot])continue;
            if(mmset.find(pivot)==mmset.end()){
                res.insert(pivot);
                visited[pivot] = true;
            } else {
                for(auto i = mmset[pivot].begin(); i!=mmset[pivot].end(); i++){
                    workingset.push(*i);
                }
                visited[pivot] = true;
            }
        }
        printf("%d\n",res.size());
    }
    return 0;
}

Measured memory_bytes: 3344
/**
 * Created by hiramekun at 20:43 on 2019-12-08.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    string rev(s);
    reverse(all(rev));
    ll ans = 0;
    rep(i, s.size() / 2) {
        if (s[i] != rev[i]) ans++;
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

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

    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        ans += a - 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdio.h>
using namespace std;
const int MAXN = 5000;
int s[MAXN];
struct Point
{
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
};
struct Line
{
    Point p1, p2;
    Line() {}
    Line(Point p1, Point p2): p1(p1), p2(p2) {}

} lie[MAXN];

typedef Point Vector;
Vector operator +(Vector A, Vector B)
{
    return Vector(A.x + B.x, A.y + B.y);
}
Vector operator -(Vector A, Vector B)
{
    return Vector(A.x - B.x, A.y - B.y);
}
Vector operator *(Vector A, double p)
{
    return Vector(A.x * p, A.y * p);
}
Vector operator /(Vector A, double p)
{
    return Vector(A.x / p, A.y / p);
}
Vector operator -(Vector A)
{
    return  Vector(-A.x, -A.y);
}

double torad(double deg)//角度换弧度
{
    return deg / 180 * acos(-1.0);
}

const double EPS = 1e-10;
int dcmp(double x)
{
    if(fabs(x) < EPS) return 0;
    else return x < 0 ? -1 : 1;
}

//向量点积
double Dot(Vector A, Vector B) 
{ 
    return A.x*B.x + A.y*B.y; 
}

//向量叉积
double Cross(Vector A, Vector B)
{
    return A.x * B.y - A.y * B.x;
}

const int INF = 1000005;
int par[INF], ran[INF];

//点在直线上的投影
Point GetLineProjection(Point P, Point A, Point B) {
    Vector v = B - A;
    return A+v*(Dot(v, P-A)/Dot(v, v));
}


int main()
{
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    Point p1=Point(x1,y1);
    Point p2=Point(x2,y2);
    int n;
    cin>>n;
    while(n--)
    {
        double x,y;
        cin>>x>>y;
        Point p=Point(x,y);
        Point Pp=GetLineProjection(p,p1,p2);
        printf("%.10f %.10f\n",Pp.x,Pp.y);
    }
    return 0;
}





Measured memory_bytes: 3436
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int s[n],t[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        t[i]=s[i];
    }
    sort(t,t+n);
    int m1=t[n/2-1];
    int m2=t[n/2];
    for(int i=0;i<n;i++){
        if(s[i]<=m1)cout<<m2<<endl;
        else cout<<m1<<endl;
    }
}


Measured memory_bytes: 3712
#include <bitset>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

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

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

ll modminus(ll x, ll mod) {
  if (x < 0) {
    return mod - (-x % mod);
  }
  return x % mod;
}

int main() {
  ll input(n);
  string input(s);

  vector<ll> d(n);
  REP(i, n) d[i] = s[i] - '0';
  ll cnt = accumulate(d.begin(), d.end(), 0ll);
  ll pattern[] = {1, -1};
  if (cnt == 1) pattern[1] = 1;

  map<ll, vector<ll>> mods;
  for(auto v: pattern) {
    vector<ll> modd(n + 1, 1);
    modd[0] = 1 % (cnt + v);
    FOR(i, 1, n) modd[i] = (modd[i - 1] * 2) % (cnt + v);
    mods[cnt + v] = modd;
  }

  map<ll, ll> base;
  for(auto v: pattern) {
    base[cnt + v] = 0;
    REP(i, n) {
      if (d[i]) (base[cnt + v] += mods[cnt + v][n - i - 1]) %= (cnt + v);
    }
  }
  REP(i, n) {
    if (i != 0) d[i - 1] ^= 1;
    d[i] ^= 1;

    if (d[i] == 1) {
      // plus
      ll v = (base[cnt + 1] + mods[cnt + 1][n - i - 1]) % (cnt + 1);
      ll ans = 0;
      while (v) {
        v %= __builtin_popcount(v);
        ans++;
      }
      print(ans + 1);
    } else {
      // minus
      if (cnt == 1) {
        print(0);
        continue;
      }
      ll v = modminus(base[cnt - 1] - mods[cnt - 1][n - i - 1], cnt - 1) % (cnt - 1);
      ll ans = 0;
      while (v) {
        v %= __builtin_popcount(v);
        ans++;
      }
      print(ans + 1);
    }
  }
}


Measured memory_bytes: 9752
#include <stdio.h>
int main(){
  char a[20],b[20],c[20];
  scanf("%s",a);
  scanf("%s",b);
  scanf("%s",c);
  a[0]-=32;
  b[0]-=32;
  c[0]-=32;
  printf("%c%c%c",a[0],b[0],c[0]);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;

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

	int N;
	int hon[5] ={2,4,5,7,9};
	int pon[4]={0,1,6,8};
	int bon = 3;

	scanf("%d", &N);

	for(int i=0; i<5; i++){
		if(N%10==hon[i]){
			printf("hon\n");
			break;
		}
	}
	for(int i=0; i<4; i++){
		if(N%10==pon[i]){
			printf("pon\n");
			break;
		}
	}
	if(N%10==bon){
		printf("bon\n");
	}

	return 0;
}







Measured memory_bytes: 3764
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		int sum = 0;
		for(int i = 0 ; i < n ; i++) sum += a[i];
		Arrays.sort(a);
		if(sum % 10 == 0) {
			for(int i = 0 ; i < n ; i++) {
				if((sum - a[i]) % 10 == 0) continue;
				System.out.println(sum - a[i]);
				return;
			}
		} else {
			System.out.println(sum);
			return;
		}
		System.out.println(0);
	}
}


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

int main(){
    long long A,V,B,W,T;
    cin >> A >> V >> B >> W >> T;
    if(V<=W){
        cout << "NO" << endl;
    }else{
        if(A>B){
            if((A-B)<=(V-W)*T){
                cout << "YES" << endl;
            }else{
                cout << "NO" << endl;
            }
        }else{
            if((B-A)<=(V-W)*T){
                cout << "YES" << endl;
            }else{
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
typedef long long ll;
int cnt,d,mi[20];
int reverse(int x,int len){
	int ans=0;
	for (int i=1;i<=len;i++) ans=ans*10+x%10,x/=10;
	return ans;
}
int main()
{
	scanf("%d",&d);
	mi[0]=1;
	for (int i=1;i<=9;i++) mi[i]=mi[i-1]*10;
	ll ans=0;
	if (d%10){
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
			ll j=(i+d)%mi[bit];
			if (j%10==0) continue;
			ll ri=reverse(i,bit),rj=reverse(j,bit);
			if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
			if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
	}
	else{
		int pw=1;
		while (d%10==0) d/=10,pw*=10;
		pw=pw/10*9;
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
				ll j=(i+d)%mi[bit];
				ll ri=reverse(i,bit),rj=reverse(j,bit);
				if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
				if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
		ans*=pw;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var s int
	fmt.Scan(&s)
	fmt.Println(col(s))
}

func col(s int) int {
	num := make([]int, 1000000)
	var next, ans int
	num[0] = s
	for i := 1; i < 1000000; i++ {
		if s%2 == 0 {
			next = s / 2
		} else {
			next = 3*s + 1
		}
		for _, v := range num {
			if next == v {
				ans = i + 1
			}
		}
		if ans != 0 {
			break
		}
		num[i] = next
		s = next
	}
	return ans
}


Measured memory_bytes: 2816
"use strict";

process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    const tokens = input[0].split(' ').map(function(value) { return parseInt(value, 10); });
    const a = tokens[0];
    const b = tokens[1];
    const t = tokens[2];

    const ans = Math.floor(t / a) * b;

    console.log(ans);

    return 0;
}


Measured memory_bytes: 21192