akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  V<int> v(3);
  rep(i,0,3)cin>>v[i];
  sort(all(v));


  if(v[0]==v[1] && v[2]!=v[1]){
    cout<<"Yes"<<ENDL;
  }else if(v[0]!=v[1] && v[1]==v[2]){
    cout<<"Yes"<<ENDL;
  }else{
    cout<<"No"<<ENDL;
  }
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[3][1000005]={0},b[1000005]={0};
int main(){
	int n,m;
	cin>>n>>m>>a[0][0]>>a[1][0]>>a[2][0];
	for(int i=0;i<3;i++){
		for(int j=1;j<=a[i][0];j++)
			cin>>a[i][j];
	}
	sort(a[0]+1,a[0]+1+a[0][0]);
	sort(a[1]+1,a[1]+1+a[1][0]);
	sort(a[2]+1,a[2]+1+a[2][0]);
	int i=a[0][0]-n+1,j=a[1][0]-m+1,k=a[2][0];
	for(;i<=a[0][0];i++) b[++b[0]]=a[0][i];
	for(;j<=a[1][0];j++) b[++b[0]]=a[1][j];
	for(k=1;k<=a[2][0];k++) b[++b[0]]=a[2][k];
	sort(b+1,b+1+b[0]);
	unsigned long long ans=0,w=n+m;
//	cout<<"Wj"<<b[0]<<endl;
	while(w){
		w--;
//		cout<<"Wj:"<<b[b[0]]<<endl;
		ans+=b[b[0]--];
	}
	cout<<ans<<endl;
//	while(w<m+n){
//		w++;
//		if(i<=a[0][0]&&j<=a[1][0]){
//			if(a[0][i]<a[1][j]){
//				if(k>0&&a[2][k]>a[0][i]){
//					ans+=a[2][k--];
//				}
//				else ans+=a[0][i];
//				i++;
//			}
//			else{
//				if(k>0&&a[2][k]>a[1][j]){
//					ans+=a[2][k--];
//				}
//				else ans+=a[1][j];
//				j++;
//			}
//			continue; 
//		}
//		if(j<=a[1][0]){
//			if(k>0&&a[2][k]>a[1][j]){
//				ans+=a[2][k--];
//			}
//			else ans+=a[1][j++];
//			continue; 
//		}
//		if(i<=a[0][0]){
//			if(k>0&&a[2][k]>a[0][i]){
//				ans+=a[2][k--];
//			}
//			else ans+=a[0][i++];
//		}
//	}
	
	return 0;
}


Measured memory_bytes: 14592
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n, m;
    cin >> n >> m;
    vector<vector<li>> g(n);
    for (int i = 0; i < m; ++i) {
        li a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
    }

    vector<li> ans;
    for (int fr = 0; fr < n; ++fr) {
        queue<li> q;
        q.push(fr);

        vector<li> prev(n, -1);
        while (not q.empty()) {
            const li pos = q.front();
            q.pop();

            for (auto next : g[pos]) {
                if (next == fr) {
                    vector<li> tmpans;
                    tmpans.push_back(fr);
                    li p = pos;
                    while (p != fr) {
                        tmpans.push_back(p);
                        p = prev[p];
                    }
                    if (ans.empty() || tmpans.size() < ans.size()) {
                        ans = tmpans;
                    }
                    goto detected;
                } else if (prev[next] == -1) {
                    prev[next] = pos;
                    q.push(next);
                }
            }

        }
        detected:
        continue;
    }

    cout << (li) (ans.empty() ? -1 : ans.size()) << endl;
    for (auto v : ans) {
        cout << v + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 384
n_k = input()
n_k_list =n_k.split(' ')

N = int(n_k_list[0])
K = int(n_k_list[1])

h_list = [0] * N
for i in range(N):
    h_list[i] = int(input())

sorted_h_list = sorted(h_list)

min_dif = 1000000000
for i in range(N-K+1):
    start = i
    end = K - 1 + i

    end_v = sorted_h_list[end]
    start_v = sorted_h_list[start]
    dif = end_v - start_v

    if min_dif > dif:
        min_dif = dif

print(int(min_dif))

Measured memory_bytes: 8240
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const ll INF = 1e9;
inline ll read(){
	ll X = 0,w = 0 ;
	char ch = 0;
	while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
	while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
	return w ? -X : X;
}

ll a[100005];
ll b[100005];
ll c[100005];
vector<ll> dif;
int main() 
{
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(ll i=0;i<n;i++)
	{
		cin>>b[i];
		if(a[i]>b[i])
			dif.push_back(a[i]-b[i]);
	}
	sort(dif.begin(),dif.end());
	reverse(dif.begin(),dif.end());
	ll cnt=0;
	ll sum=0;
	for(ll i=0;i<n;i++)
	{
		if(b[i]>a[i])
		{
			sum+=b[i]-a[i];
			cnt++;
		}
	}
	if(cnt==0)
	{
		cout<<0<<endl;
		return 0;
	}
	ll sum2=0;
	for(ll i=0;i<dif.size();i++)
	{
		sum2+=dif[i];
		cnt++;
		if(sum2>=sum)
		{
			break;
		}
	}
	if(sum2<sum)
	{
		cout<<-1;
		return 0;
	}
	cout<<cnt;
    return 0;
}

Measured memory_bytes: 2296
#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(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    rep(i, N) cin >> v[i];

    sort(all(v));

    double tmp = v[0];
    rep(i, 1, N) {
        tmp = (tmp + v[i]) / 2;
    }

    write(tmp);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
vector<int> v;
int N;
int A[105000];
struct SegmentTree {
private:
    int n;
    vector<int> node;
 
public:
    SegmentTree() {
        int sz = 2e5;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = 0;
        for(int i=n-2; i>=0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
    }
 
    void update(int x, int val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = max(node[2*x+1], node[2*x+2]);
        }
    }
    // hannkaikukann 
    int getmax(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];
 
        int vl = getmax(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmax(a, b, 2*k+2, (l+r)/2, r);
        return max(vl, vr);
    }
};


int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        v.push_back(A[i]);
    }
    sort(v.begin(), v.end());
    SegmentTree seg;
    for(int i = 1; i <= N; i++) {
        auto itr = lower_bound(v.begin(), v.end(), A[i]);
        int val = distance(v.begin(), itr);
        int num = seg.getmax(val, N + 1);
        seg.update(val, num + 1);
    }
    cout << seg.getmax(0, N + 1) << endl;
    return 0;
}


Measured memory_bytes: 3192
const res = require('fs').readFileSync('/dev/stdin','utf8')
    .match(/^[\s\S]*?(?=\n0 0)/g)[0]
    .split('\n')
    .map(r=>r.split(' ')
        .map(Number))
    .map(([H,W])=>[...Array(H).keys()]
        .map((val,i,a)=>((!i || i===Math.max(...a)) ?'#':'.')
            .repeat(W)
            .replace(/(^\.|\.$)/g,'#'))
        .join('\n'))
    .join('\n\n')
    .concat('\n');
console.log(res)


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

int main(){

	double high, low, m;
	
	high = 0.0;
	low = 100000000.0;
	while(cin >> m){
		high = max(high, m);
		low = min(low, m);
	}

	printf("%lf\n", high - low);

	return 0;

}

Measured memory_bytes: 1232
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;

int main() {
	char c;
	static int counter[26];
	char s[1200];
	while (cin >> c) {
		if (isalpha(c) == false) continue;
		c = tolower(c);
		int n = c - 'a';
		++counter[n];
	}
	for (int i = 0; i < 26; ++i) {
		char idx = 'a' + i;
		cout << idx << " : " << counter[i] << endl;
	}
	return 0;
}



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

ll X, Y;

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

	int ans = 0;

	while (X<=Y)
	{
		X <<= 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = accumulate([0]+ A)
C = [(b-i)%K for i, b in enumerate(B)]
cnt = dict()
cnt[C[0]] = 1
res = 0
for i in range(1, N+1):
    if i >= K:
        cnt[C[i-K]] = cnt.get(C[i-K],0) - 1
    res += cnt.get(C[i], 0)
    cnt[C[i]] = cnt.get(C[i],0) + 1
print(res)


Measured memory_bytes: 139852
#include <iostream>

using namespace std;

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

	int ans = 100000;
	while(n--){
		ans*=1.05;
		if(ans%1000)
			ans=(ans/1000+1) * 1000;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 2992
#include<cstdio>
#include<cmath>
#include<algorithm> 
using namespace std;
char s[100005];
char t[100005];
int l1,l2;
int a[100001][26];//the first k after or equal i position
int p[100001];
int main()
{
	scanf("%s%s",s+1,t+1);
	for (l1=1;s[l1]!='\0';l1++) ;
	l1--;
	for (l2=1;t[l2]!='\0';l2++) ;
	l2--;
	for (int i=l1;i>=1;i--)
	{//s[i]-'a'
		p[s[i]-'a']=i;
		for (int k=0;k<26;k++)
		{
			if (s[i]-'a'==k)
			{
				a[i][k]=i;
			}
			else
			{
				if (p[k]==0) a[i][k]=l1+1;
				else a[i][k]=p[k];
			}
		}
	}
	long long curr=0,sum=0;
	int i;
	for (i=1;i<=l2;i++)
	{
		if (curr==l1)
		{
			curr=0; sum++;
		}
		if (a[curr+1][t[i]-'a']!=l1+1)
		{
			curr=a[curr+1][t[i]-'a'];
		}
		else
		{
			curr=0; sum++;
			if (a[curr+1][t[i]-'a']!=l1+1)
			{
				curr=a[curr+1][t[i]-'a'];
			}
			else
			{
				printf("-1");
				break;
			}
		}
	}
	if (i==l2+1)
	{
		printf("%lld",sum*l1+curr);
	}
	return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

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

    lint res = modpow(2, n);
    res--;

    lint inv[200050];
    inv[1] = 1;
    for (int i = 2; i <= max(a, b); i++) {
        inv[i] = inv[i-1] * modpow(i, MOD-2);
        inv[i] %= MOD;
    }

    lint nca = inv[a];
    for (int i = n; i >= n-a+1; i--) {
        nca *= i;
        nca %= MOD;
    }

    lint ncb = inv[b];
    for (int i = n; i >= n-b+1; i--) {
        ncb *= i;
        ncb %= MOD;
    }

    res -= nca;
    res -= ncb;
    while (res < 0) res += MOD;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;
long long get_ans(long long N_length,long long P_num,long long X){
	long long ans=0;;
	if(N_length==X)return P_num;
	
	if(N_length/2<=X){
		if(N_length/2+1<=X){
			ans++;
		}
		ans+=P_num/2;
		X-=N_length/2;
	}
	else{
	}
	N_length/=2;
	N_length-=1;
	P_num/=2;
	if(X!=0){
		X-=1;
		return ans + get_ans(N_length,P_num,X);
	}
	else{
		return ans;
	}
}


int main(){
	long long N,X;
	cin>>N>>X;
	long long P_num = 1;
	long long N_length=1;
	for(int i=0;i<N;i++){
		P_num=P_num*2+1;
		N_length=N_length*2+3;
	}
	cout<<get_ans(N_length,P_num,X)<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		
		if((a + b)%2 ==0) {
			System.out.println((a +b)/2);
		}else {
			System.out.println((a +b)/2 +1);			
		}
		
		// 出力
		System.out.println();
	}
}


Measured memory_bytes: 20052
#include<bits/stdc++.h>
using namespace std;
int main(){
  double n,a,b;
  cin>>n;
  while(n--){
    scanf("%lf:%lf",&a,&b);
    double c=abs(a*30+b/2-b*6);
    double d=min(c,360-c);
    if(d<30)cout<<"alert"<<endl;
    else if(d<90)cout<<"warning"<<endl;
    else cout<<"safe"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1260
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#define lli long long int
#define ll long long
#define mod 1000000007
#define pii pair<int,int>
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
	int N, d, e;
	int a = 0;
	int b = 0;
	int ans = 0;
	cin >> N;
	int c[N];
	rep(i, N){
		cin >> c[i];
		a += c[i];
	}
	rep(j, N){
		b += c[j];
		if(a/2 <= b){
			d = abs(b - (a-b));
			e = abs((b-c[j]) - (a-(b-c[j])));
			break;
		}
	}
	if(d < e){
		cout << d;
	}
	else{
		cout << e;
	}
	return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public const int MD = 1000000007;
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var m = int.Parse(line[0]);
        var n = int.Parse(line[1]);
        Console.WriteLine(power(m, n));
    }
    public static long power(long m, long n)
    {
        if (n == 0) return 1;
        return n % 2 == 0 ? power(m * m % MD, n / 2) : power(m * m % MD, n / 2) * m % MD;
    }
}


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

int main(){
    ll n,m,v,p;
    cin >> n >> m >> v >> p;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll ng = -1;
    ll ok = n;
    while(ok - ng > 1){
        ll mid = (ok + ng)/2;
        ll limit = a[mid] + m;
        if(limit < a[n-p]){
            ng = mid;
            continue;
        }
        ll sum = m + (p-1)*m + (mid)*m;
        for(int i = mid+1 ; i <= n-p; i++){
            sum += limit - a[i];
        }
        if(sum < m*v){
            ng = mid;
        }
        else{
            ok = mid;
        }
    }
    cout << n - ok << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define ll long long
using namespace std;
const int N=50;
int n;
char a[N][N];
ll f[N][N][N],ans;
ll calc(int l,int i,int r){
	if(l==r)return 1;
	if(l==i||i==r)return 0;
	if(f[l][i][r]!=-1)return f[l][i][r];
	ll tot=0;
	fo(j,l,i-1)
		fo(p,j,i-1)
			fo(q,i+1,r)
				fo(k,q,r)
					if(a[j][k]=='1')
						tot+=calc(l,j,p)*calc(q,k,r)*calc(p+1,i,q-1);
	return f[l][i][r]=tot;
}
int main(){
	scanf("%d",&n);n*=2;
	fo(i,1,n)scanf("\n%s",a[i]+1);
	memset(f,255,sizeof f);
	fo(i,2,n)if(a[1][i]=='1')ans+=calc(2,i,n);
	cout<<ans;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 A, B, C, K;
  cin >> A >> B >> C >> K;
  while (1 <= K && B <= A)
  {
    B *= 2;
    K--;
  }
  while (1 <= K && C <= B)
  {
    C *= 2;
    K--;
  }
  if (A < B && B < C)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int m = saori.saori_hayami();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[m];
		int[] d = new int[m];
		int[] ans = new int[n];
		for(int i = 0;i < n;i++){
			a[i] = saori.saori_hayami();
			b[i] = saori.saori_hayami();
		}
		for(int i = 0;i < m;i++){
			c[i] = saori.saori_hayami();
			d[i] = saori.saori_hayami();
		}
		int num = MAX;
		int e = 0;
		for(int i = 0;i < n;i++){
			num = MAX;
			e = 0;
			for(int j = 0;j < m;j++){
				if(num >  Math.abs(a[i]-c[j]) + Math.abs(b[i]-d[j])){
					num =  Math.abs(a[i]-c[j]) + Math.abs(b[i]-d[j]);
					e = j+1;
				}
			}
			ans[i] = e;
		}
		for(int i = 0;i < n;i++){
			System.out.println(ans[i]);
		}
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21204
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    
    ll N;
    cin >> N;
    string s;
    cin >> s;
    ll ans = 0;
    for(ll i = 1; i < s.size(); i++){
        ll tmp = 0;
        vector<ll>A(256, 0), B(256, 0);
        for(ll j = 0; j < i; j++)A[s[j]] = 1;
        for(ll j = i; j < s.size(); j++)B[s[j]] = 1;
        for(ll j = 0; j < 256; j++)if(A[j] && B[j])tmp++;
        ans = max(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, q = list(map(int, input().split(' ')))
stacks = [[] for i in range(n)]

for i in range(q):
    op = list(map(int, input().split(' ')))
    if op[0] == 0:
        stacks[op[1]].append(op[2])
    elif op[0] == 1:
        if len(stacks[op[1]]) != 0:
            print(stacks[op[1]][-1])
    elif op[0] == 2:
        if len(stacks[op[1]]) != 0:
            stacks[op[1]].pop()


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 1001001001;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef tuple<string, int, int> T;

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

    vector<tuple<ll, ll, ll >> xst(n);
    rep(i, n) {
        ll s, t, x;
        cin >> s >> t >> x;

        s = s - x;
        t = t - x;

        auto tp = tuple<ll, ll, ll>(x, s, t);
        xst[i] = tp;
    }
    sort(xst.begin(), xst.end());

    set<P> st;
    rep(i, q) {
        ll x;
        cin >> x;
        st.emplace(x, i);
    }

    vector<ll> ans(q, -1);
    rep(i, n) {
        ll x = get<0>(xst[i]);
        ll s = get<1>(xst[i]);
        ll t = get<2>(xst[i]);

        auto it = st.lower_bound(P(s, 0));
        auto end = st.upper_bound(P(t - 1, q));
        while (it != end) {
            ans[it->second] = x;
            st.erase(it++);
        }
    }

    rep(i, q) {
        cout << ans[i] << endl;
    }

}



Measured memory_bytes: 20608
import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

# from functools import reduce
# from math import ceil, floor, log10, log2, factorial

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7

# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]

def main():
    """"ここに今までのコード"""
    N, M = [int(x) for x in input().split()]
    S = [int(x) for x in input().split()]
    T = [int(x) for x in input().split()]

    DP = [[0] * (M + 1) for _ in range(N + 1)]
    DP[0] = [1] * (M + 1)
    for n in range(1, N + 1):
        DP[n][0] = DP[n - 1][0]
        for m in range(1, M + 1):
            DP[n][m] = DP[n][m - 1] + DP[n - 1][m] - DP[n - 1][m - 1]
            DP[n][m] %= MOD
            if S[n - 1] == T[m - 1]:
                DP[n][m] += DP[n - 1][m - 1]
                DP[n][m] %= MOD
    print(DP[n][m])


if __name__ == '__main__':
    main()



Measured memory_bytes: 72540
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
#define Sort(a, n) sort(a, a+n);
#define reverse(a, n) 
using ll = long long;
using P = pair<int, int> ;
int a[10];
int main(){
  string s; cin >> s;
  int ans=0;
  int tans=0;
  rep(i, 3){
    if (s[i] == 'R') ans++;
    else ans = 0;
    tans = max(ans, tans);
  }
  cout << tans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
ll n, cnt; ll a[114514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	if (a[n - 1] - a[0] >= 2)puts("No");
	else if (a[n - 1] == a[0]) {
		if (n == a[0] + 1 || n >= a[0] * 2)puts("Yes");
		else puts("No");
	}
	else {
		rep(i, n - 1) {
			if (a[i] != a[i + 1])cnt = i;
		}
		ll ansa = cnt + 1;
		ll ansb = n - ansa;
		if (ansa - 1 + ansb / 2 < a[0])puts("No");
		else if (ansb == 1)puts("No");
		else if (ansa >= a[n - 1])puts("No");
		else puts("Yes");
	}
	getchar(); getchar(); return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d%d" ,&a,&b);         //??\???
	
	if(a>b)                       //a>b?????????
	{
		printf("a > b\n");
	}
	else if(a<b)                 //a<b?????????
	{
		printf("a < b\n");
	}
	else                         //a=b?????????
	{
		printf("a == b\n");
	}
	
	return 0;    //?????????
}

Measured memory_bytes: 580
N = input()



for x in ('+', '-'):
    for y in ('+', '-'):
        for z in ('+', '-'):
            res = int(N[0])
            
            if x == '+':
                res += int(N[1])
            else:
                res -= int(N[1])
                
            if y == '+':
                res += int(N[2])
            else:
                res -= int(N[2])
                
            if z == '+':
                res += int(N[3])
            else:
                res -= int(N[3])
                
            if res == 7:
                result = N[0] + x + N[1] + y + N[2] + z + N[3] + '=7'
                break
    
print(result)

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    stack<int> s1;
    deque<pair<int, int>> s2;
    string t;
    cin >> t;

    int sum = 0;
    rep(i, t.size())
    {
        if (t[i] == '\\')
        {
            s1.push(i);
        }
        else if (t[i] == '/' && s1.empty() != 1)
        {
            int ind = s1.top(), a = i - ind;
            s1.pop();
            sum += a;

            while (s2.empty() != 1 && s2.back().first > ind)
            {
                a += s2.back().second;
                s2.pop_back();
            }
            s2.push_back(make_pair(ind, a));
        }
    }

    int si = s2.size();
    OP(sum);
    cout << si;
    if (s2.empty() != 1)
    {
        rep(i, si)
        {
            cout << " " << s2.front().second;
            s2.pop_front();
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3252
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N, M, K; std::cin >> N >> M >> K;
  std::vector<int> A(N+1, 0), B(M+1, 0);
  int sum = 0;
  for(int i = 1; i <= N; ++i) {
    int a; std::cin >> a;
    sum += a; if(sum > K) sum = K+1;
    A[i] = sum;
  }
  sum = 0;
  for(int i = 1; i <= M; ++i) {
    int b; std::cin >> b;
    sum += b; if(sum > K) sum = K+1;
    B[i] = sum;
  }
  int ans = 0;
  int j = M;
  for(int i = 0; i <= N; ++i) {
    if(A[i] > K) break;
    while(A[i]+B[j] > K) --j;
    ans = std::max(ans, i+j);
  }
  fin(ans);
  return 0;
}


Measured memory_bytes: 5176
N = int(input())
town = []
for i in range(N):
    x,y = map(int,input().split())
    town.append([x,y])

ans = 0
for i in range(N-1):
    for j in range(i+1,N):
        x1,y1 = town[i]
        x2,y2 = town[j]
        ans += ((x1-x2)**2 + (y1-y2)**2)**(1/2)
ans *= 2
ans /= N

print(ans)


Measured memory_bytes: 38384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int A[] = new int[Integer.parseInt(br.readLine())];
		Scanner scanner = new Scanner(br.readLine());
		for(int i=0; i<A.length; i++) {
			A[i] = scanner.nextInt();
		}
		scanner.close();

		for(int i=0; i<A.length; i++) {
			int v = A[i];
			int j = i-1;
			while(j>=0 && A[j]>v) {
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = v;

			System.out.printf("%d", A[0]);
			for(int k=1; k<A.length; k++) {
				System.out.printf(" %d",A[k]);
			}
			System.out.println();
		}
	}

}



Measured memory_bytes: 41080
#![allow(unused_imports)]
#![allow(dead_code)]

use std::cmp;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    const INF: i64 = 1111111111111111111;
    input!{
        n: i64,
        k: i64,
    }
    let mut ans = k;
    for _ in 1..n {
        ans *= k - 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main (void) {

	int x, y;
	int i, j;

	while (1) {
		if (x+y == 0)
			break;
		scanf ("%d %d", &y, &x);
		for (j=0; j<y; j++) {
			for (i=0; i<x; i++) {
				if (j%2==0) {
					if (i%2==0)
						printf("#");
					if (i%2==1)
						printf(".");
				} else {
					if (i%2==0)
						printf(".");
					if (i%2==1)
						printf("#");
				}
			}
		if (x+y!=0)
			printf("\n");
		}
		if (x+y!=0)
			printf("\n");
	}

	return 0;
}

Measured memory_bytes: 572
input()
A = [int(h) for h in input().split()]
iph_dic = {}
pair_of_spies = 0

for i, h in enumerate(A):
    if i - h in iph_dic:
        pair_of_spies += iph_dic[i - h]
    if i + h in iph_dic:
        iph_dic[i + h] += 1
    else:
        iph_dic[i + h] = 1

print(pair_of_spies)

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

using namespace std;


void solve() {
    int n,m;
    cin >> n >> m;
    long long res;
    if (n>m) swap(n,m);
    if (n == 1) {
        if (m == 1) res = 1;
        else res = m-2;
    } else {
        res = 1ll*(n-2) * (m-2);
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	vector<int> s(n + 1);
	s[0] = 0;
	unordered_map<int,int> mp;
	REP(i, n) {
		cin >> a[i];
		a[i]--;
		s[i + 1] = (s[i] + a[i]) % k;
	}
	ll res = 0;
	REP(i, n + 1) {
		if (i < k) {
			res += mp[s[i]];
			mp[s[i]]++;
		} else {
			mp[s[i - k]]--;
			res += mp[s[i]];
			mp[s[i]]++;
		}
	}
	put(res);
	return 0;
}


Measured memory_bytes: 10056
//02
#include<iostream>
#include<string>
#include<set>

using namespace std;

int main(){
  int n;
  cin>>n;
  set<string> s;
  while(n--){
    string t;
    cin>>t;
    s.insert(t);
  }
  int m;
  cin>>m;
  bool open=false;
  while(m--){
    string t;
    cin>>t;
    if(s.count(t)==0){
      cout<<"Unknown "<<t<<endl;
    }else{
      open=!open;
      cout<<(open?"Opened by ":"Closed by ")<<t<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1232
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 10000000
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}

#define int ll
// #define endl '\n'

signed main() {
	// fast;

	int n;
	cin>>n;

	vector<int> v(n);
	for(int i=0;i<n;i++) cin>>v[i], v[i]--;

	int st = -1;
	vector<int> ans;
	set<int> set1;
	for(int i=0;i<n;i++) set1.insert(i);
	// ans.pb(0);

	int hate[n] = {};
	for(int i=0;i<n;i++) hate[v[i]]++;

	set<pii> hatred;
	for(int i=0;i<n;i++) hatred.insert({hate[i],i});

	for(int i=0;i<n;i++) {
		if(i==n-3) {
			int c1 = *set1.begin();
			int c2 = *next(set1.begin());
			int c3 = *next(next(set1.begin()));

			if(v[st]!=c1&&v[c1]!=c2&&v[c2]!=c3) {
				ans.pb(c1); ans.pb(c2); ans.pb(c3);
			}
			else if(v[st]!=c1&&v[c1]!=c3&&v[c3]!=c2) {
				ans.pb(c1); ans.pb(c3); ans.pb(c2);
			}
			else if(v[st]!=c2&&v[c2]!=c1&&v[c1]!=c3) {
				ans.pb(c2); ans.pb(c1); ans.pb(c3);
			}
			else if(v[st]!=c2&&v[c2]!=c3&&v[c3]!=c1) {
				ans.pb(c2); ans.pb(c3); ans.pb(c1);
			}
			else if(v[st]!=c3&&v[c3]!=c1&&v[c1]!=c2) {
				ans.pb(c3); ans.pb(c1); ans.pb(c2);
			}
			else if(v[st]!=c3&&v[c3]!=c2&&v[c2]!=c1) {
				ans.pb(c3); ans.pb(c2); ans.pb(c1);
			}

			break;
		}
		// cout<<"----\n"; for(auto x: hatred)cout<<x.f<<" "<<x.s<<endl;
		auto it1 = prev(hatred.end());
		// if(i==n-1) cout<<"$$$$"<<(*it1).f<<" "<<(*it1).s<<endl;
		if((*it1).f>n-i-1) break;
		// cout<<"$"<<(*it1).f<<" "<<n-i-1<<endl;
		if((*it1).f==n-i-1 && v[st]!=(*it1).s) {
			if(v[st]==(*it1).s) break;
			st = (*it1).s;
			hatred.erase(it1);

			set1.erase(st);
			ans.pb(st);
			// cout<<">>"<<i<<" "<<st<<endl;

			hatred.erase({hate[v[st]],v[st]});
			hate[v[st]]--;
			if(set1.count(v[st])) hatred.insert({hate[v[st]],v[st]});

			continue;
		}
		// cout<<"#"<<st<<endl;

		auto it = set1.begin();
		while(it!=set1.end()) {
			int ptr = *it;
			if(st!=-1&&v[st]==ptr) it++;
			else break;
		}
		if(it==set1.end()) break;
		// cout<<">"<<i<<" "<<*it<<endl;

		st = *it;
		// if(*it==1) cout<<hate[v[st]]<<","<<v[st]<<endl;
		hatred.erase({hate[v[st]],v[st]});
		hate[v[st]]--;
		if(set1.count(v[st])) hatred.insert({hate[v[st]],v[st]});
		hatred.erase({hate[st],st});
		set1.erase(it);
		ans.pb(st);
	}

	if(ans.size()!=n) {
		cout<<-1;
		return 0;
	}
	for(auto x: ans) cout<<x+1<<" ";
}

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

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> p;
  tools::read(p, N);
  std::sort(p.begin(), p.end());
  std::cout << std::accumulate(p.begin(), p.begin() + (N - 1), static_cast<i64>(0)) + p.back() / 2 << std::endl;
  return 0;
}

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


int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int i,j,k,l=0,m,n,p,x,y,sum=0,cnt=0,diff;
    long double aa=0.0,bb;
    cin>>n;
    long long int A[n];
    cout<<setprecision(10);
    for(i=0;i<n;i++)
    {
        cin>>A[i];
        aa+=(long double)(1*1.000000)/A[i];
    }
    bb=(long double)(1*1.0000)/aa;
    cout<<bb<<endl;

}


Measured memory_bytes: 256
Public Class Program
  Shared Sub Main()
    Dim nk As Integer() = Cin.IntArr()
    Dim n As Integer = nk(0)
    Dim k As Integer = nk(1)
    Dim p As Integer() = Cin.IntArr()
    Dim ex(0 To n - 1) As Double
    For i As Integer = 0 To n - 1
      ex(i) = (1 + p(i)) / 2
    Next
    Dim exSum As Double = 0
    For i As Integer = 0 To k - 1
      exSum += ex(i)
    Next
    Dim ans As Double = exSum
    For i As Integer = k To n - 1
      exSum = exSum + ex(i) - ex(i - k)
      ans = Math.Max(ans, exSum)
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 29788
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define MOD 1000000007
typedef long long ll;

int main() {
	ll n,a[200001];
	scanf("%lld",&n);
	ll sum[200001] = {};
	rep(i, 0, n) {
		scanf("%lld", &a[i]);
	}
	ll ans = 0;
	for (ll i = n - 1; i > 0; i--) {
		sum[i - 1] =( sum[i] + a[i] )% MOD;
	}
	rep(i, 0, n) {
		ans += (a[i] * sum[i]) % MOD;
		ans %= MOD;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 5276
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main() {
    int a[6]={0},n;
    double h;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>h;
        if(h<165.0)a[0]++;
        else if(h<170.0)a[1]++;
        else if(h<175.0)a[2]++;
        else if(h<180.0)a[3]++;
        else if(h<185.0)a[4]++;
        else a[5]++;
    }
    for(int i=0;i<6;i++){
        cout<<i+1<<":";
        for(int j=1;j<=a[i];j++){
            cout<<"*";
        }
        cout<<endl;
    }
    return 0;
}



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

int main(){
  int64_t N,A,B;
  cin >> N >> A >> B;
  int64_t d,f;
  d = N/(A+B);
  f = N%(A+B);
  int64_t ans;
  if(f<=A){
    cout << d*A+f <<endl;
    
  }
  else{
    cout << d*A+A <<endl;
  }
  
}


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



int main(){
  double W,H,x,y;
  cin >> W >> H >> x >> y;
  double area = W * H / 2;
  int able = 0;
  if(W/2 == x && H/2 == y) able = 1;
  printf("%lf %d\n", area, able);
  return 0;
}

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

int main()
{
    int w,h,n;
    cin >> w >>h >>n;
    int a[n][2];
    for(int i=0;i<n;i++)
        cin >> a[i][0] >> a[i][1];
    int now[2]={a[0][0],a[0][1]};
    int s=0;
    for(int i=0;i<n-1;i++){
        int next[2]={a[i+1][0],a[i+1][1]};
        if(now[0]<next[0]&&now[1]<next[1]){
            s+=min(abs(now[0]-next[0]),abs(now[1]-next[1]));
            int m=min(abs(now[0]-next[0]),abs(now[1]-next[1]));
            now[0]+=m;
            now[1]+=m;
        }
        else if(now[0]>next[0]&&now[1]>next[1]){
            s+=min(abs(now[0]-next[0]),abs(now[1]-next[1]));
            int m=min(abs(now[0]-next[0]),abs(now[1]-next[1]));
            now[0]-=m;
            now[1]-=m;
        }
        s+=abs(now[0]-next[0])+abs(now[1]-next[1]);
        now[0]=next[0];
        now[1]=next[1];
    }
    cout << s <<endl;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N, K;
  cin>>N>>K;
  vector<Int> A(N);
  cin>>A;
  A.insert(A.begin(), 0);
  Int ans = 0;
  map<Int, Int> cnt;
  deque<Int> his;
  Int s = 0;
  for(Int i=0;i<=N;i++){
    s += A[i];
    Int val = (s - i)%K;
    ans += cnt[val];
    cnt[val]++;
    his.push_back(val);
    while((Int)his.size() >= K) cnt[his.front()]--, his.pop_front();
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 17128
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int a = sc.nextInt();
		String s = sc.next();
		int b = sc.nextInt();
		System.out.println(s.equals("+") ? a + b : a - b);
	}
}

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

int main() {
  long double a, b, x, y;
  cin >> a >> b >> x >> y;
  long double ans = a * b / 2;
  if (x == a / 2 && y == b / 2)
    cout << setprecision(20) << ans << " " << 1 << endl;
  else
    cout << setprecision(20) << ans << " " << 0 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llinf (1ll<<62)
#define BG(x) ((x).begin())
#define ED(x) ((x).end())
#define rBG(x) ((x).rbegin())
#define rED(x) ((x).rend())
#define mp(a, b) make_pair((a), (b))

ll t;
ll n, k;
ll a[200005];
map<ll, ll> depth;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
//	cin >> t;
	t = 1;
	
	for(int _ = 1; _ <= t; _++) {
	//	cout << "Case #" << _ << ": ";
		
		cin >> n >> k;
		for(int i = 1; i <= n; i++)
			cin >> a[i];
		
		ll now = 1, d = 0;
		while(k) {
			if(depth.count(now)) {
				ll diff = d - depth[now];
				
			//	cout << k << ' ' << diff << ' ' << now << '\n';
				
				k %= diff;
				while(k--) {
					now = a[now];
				}
				break;
			}
			depth[now] = d;
			now = a[now];
			d++;
			k--;
		}
		cout << now << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 15212
#include<stdio.h>
#include<string.h>
int main(){
  char s[101];
  int ans = 1, l;
  scanf("%s", s);
  l = strlen(s);
  for(int i = 0; i < l; ++i){
    if(i % 2 == 0 && s[i] == 'L') ans = 0;
    if(i % 2 == 1 && s[i] == 'R') ans = 0;
  }
  if(ans) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n, m;
	cin >> n >> m;
	map<int, int> mp;
	rep(i,m) {
		int a, b;
		cin >> a >> b;
		mp[a]++;
		mp[b]++;
	}
	for (auto p: mp) {
		if (p.second % 2 != 0) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 7700
#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
int n,k,a[200005],t,ans=0,i;
int main()
{
	scanf("%d %d",&n,&k);
	for(i=1; i<=n; i++){
		scanf("%d",&t);
		a[t]++; 
	}
	sort(a,a+n+1);
	for(i=n; i>=n-k+1; i--)
		a[i]=0;
//	for(i=1; i<=n; i++)
//		printf("%d ",a[i]);
	for(i=1; i<=n; i++)
		ans+=a[i];
	printf("\n%d\n",ans);
	return 0;
} 

Measured memory_bytes: 1024