akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define ll  long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define main() int main()
#define ff1(i,n) for(int i=1;i<=n;++i)
#define ff0(i,n) for(int i=0;i<n;++i)
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define fir first
#define sec second
#define debug(x) cout<<x<<'\n'
#define sa(a) scanf("%d", &a)
#define sab(a, b) scanf("%d%d", &a, &b)
#define pa(a) printf("%d",a)
#define pab(a,b) printf("%d%d",a,b)
#define pii pair<int,int>
using namespace std;

#define maxn 1000005
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a%mod;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans%mod;
}
main()
{  
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}
 

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

int N,A,B;
int h[100000];

bool canKill(int T){
    int C=A-B;
    long long cnt=0;
    for(int i=0;i<N;i++){
        cnt+=(h[i]>=B*T?(h[i]-B*T)/C:0);
        if((h[i]-B*T)%C>0) cnt++;
        if(cnt>T) return false;
    }
    return true;
}

int main(){
    cin >> N >> A >> B;
    int min=1000000000,max=0;
    for(int i=0;i<N;i++){
        cin >> h[i];
        if(min>h[i]) min=h[i];
        if(max<h[i]) max=h[i];
    }

    int t0=min/A-1,t1=max/B+1;
    if(t0<0) t0=0;
    while(t1-t0>1){
        int m=(t1+t0)/2;
        if(canKill(m)) t1=m;
        else t0=m;
    }
    cout << t1 << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    ll x, k, d;
    cin >> x >> k >> d;
    
    x = max(x, -x);
    ll ans;
    if (k < rup(x, d)) {
        ans = x - d * k;
    }
    else {
        ll d1 = d - (x % d);
        ll d2 = x % d;
        ll n = x / d;
        if (k % 2 == n % 2)
            ans = d2;
        else
            ans = d1;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int n;
inline void CountingSort(vi a, vi &b, int k) {
	vi c(k + 1, 0);
	rep(i, 0, n) {
		++c[a[i]];
	}
	rep(i, 1, k + 1) {
		c[i] += c[i - 1];
	}
	rrep(i, n - 1, -1) {
		b[--c[a[i]]] = a[i];
	}
}
int main() {
	cin >> n;
	vi a(n); rep(i, 0, n) cin >> a[i];
	vi b(n);
	CountingSort(a, b, *max_element(all(a)));
	rep(i, 0, n) {
		cout << b[i] << (i + 1 == n ? "\n" : " ");
	}
	return 0;
}

Measured memory_bytes: 26268
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define me(a,b) memset(a,b,sizeof(a))
#define INIT() std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int MAX_N=10+5;
const int MAX_M=100000+5;
const int INF=0x7fffffff;
const int inf=1000000000;
const double EPS=1e-6;
const ull base=123;
const ll mod=1e9+7;
const double pi=4*atan(1.0);
int main()
{
	int n;
	cin>>n;
	cout<<(n^1)<<endl;
	//system("pause");
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

ll calc(string s, string t){
    ll res=0;
    ll tmp=0;
    t+='+';
    // cout<<t<<endl;
    for(int i=0;i<s.size();i++){
        if(t[i]=='-'){
            tmp*=10;
            tmp+=s[i]-'0';
        } else {
            tmp*=10;
            tmp+=s[i]-'0';
            res+=tmp;
            tmp=0;
        }
    }
    // cout<<res<<endl;
    return res;
}


int main(void) {
    
    string s;
    int n;
    cin>>s;
    n=s.size();
    ll ans=0;
    for(int i=0;i<pow(2,n-1);i++){
        string t="";
        ll tmp=i;
        while(tmp>0){
            if(tmp%2==0)t+='-';
            else t+='+';
            tmp/=2;
        }
        while(t.size()<n-1)t+='-';
        reverse(all(t));
        ans+=calc(s,t);
    }
    fin(ans);
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
typedef pair<double,long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}
string shrink(string s,char c) {
	string t;
	for (ll k = 0; k < s.length() - 1; k++) {
		if (s[k] == c)t += c;
		else if (s[k + 1] == c)t += c;
		else t += s[k];
	}
	return t;
}

int main() {
	ll cnt = 0, mCnt = INF;
	string s,t="";
	cin >> s;
	for (char i = 'a'; i <= 'z'; i++) {
		t = s;
		cnt = 0;
		while (count(all(t),i) != t.length()) {
			if (count(all(t), i) == 0) {
				cnt = INF;
				break;
			}
			t = shrink(t, i);
			cnt++;
		}
		mCnt = min(cnt,mCnt);
	}
	cout << mCnt << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N = 1e5+5;
int n,a[N],b[N],a1,a2,b1,b2;
int main(){
	n=gi();
	for (int i=1;i<=(n>>1);++i) ++a[gi()],++b[gi()];
	for (int i=1;i<=100000;++i){
		if (a[i]>a[a1]) a2=a1,a1=i;
		else if (a[i]>a[a2]) a2=i;
		if (b[i]>b[b1]) b2=b1,b1=i;
		else if (b[i]>b[b2]) b2=i;
	}
	if (a1^b1) printf("%d\n",n-a[a1]-b[b1]);
	else printf("%d\n",min(n-a[a1]-b[b2],n-a[a2]-b[b1]));
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int cnt[100];
int main() {
    int N,Q;
    while(scanf("%d %d",&N,&Q),N) {
        memset(cnt,0,sizeof(cnt));
        for(int i=0;i<N;i++) {
            int M;
            scanf("%d",&M);
            for(int i=0;i<M;i++) {
                int d;
                scanf("%d",&d);
                cnt[d]++;
            }
        }
        int ans=0;
        for(int i=1;i<100;i++) {
            if(cnt[i]>=Q) {
                if(cnt[ans]<cnt[i]) ans=i;
            }
        }
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s[1]=='R')
	{
		if(s[0]=='R'&&s[2]=='R')
			cout<<3;
		else if(s[0]=='R'||s[2]=='R')
			cout<<2;
		else
			cout<<1;
	}
	else
	{
		if(s[0]=='R'||s[2]=='R')
			cout<<1;
		else
			cout<<0;
	}
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  ull n; cin>>n;
  if(n%2==0) cout<<0.5d<<endl;
  else cout<<(double)(n/2+1)/n<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

#define int long long

pair<int,int> gf(int n){
	vector<int> v ;
	while(n){
		v.push_back(n%10) ;
		n/=10 ;
	}
	return {v.back(),v[0]} ;
}

int32_t main(){
	int a[11][11] = {} ;
	int n ;
	cin >> n ;
	for(int i = 1 ; i <= n ; i++){
		pair<int,int> p = gf(i) ;
		a[p.first][p.second]++ ;
	}
	int ans = 0 ;
	for(int i = 1 ; i <= 10 ; i++){
		for(int j = 1 ; j <= 10 ; j++){
			ans += a[i][j]*a[j][i] ;
		}
	}
	cout << ans ;
	return 0 ;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main (void){
int a,b,C;
double rad,S,L,h,c;
double PI = acos(-1);  

scanf("%d %d %d",&a,&b,&C);
rad = C * PI / 180;

S=(a*b*sin(rad))/2;
c=sqrt(a*a+b*b-2*a*b*cos(rad));
L=a+b+c;
h=2*S/a;

printf("%f\n", S);
printf("%f\n", L);
printf("%f\n", h);

return(0);
}


Measured memory_bytes: 2100
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int ans=0;
	if(a<0)ans=-a*c+d,a=0;
	b-=a;
	ans+=b*e;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main(){
	int W,H,t[50][50],dp[50][50];
	char ch;
	cin>>H>>W;
	scanf("%c",&ch);
	for(int i=0;i<H;i++){

		for(int j=0;j<W;j++){
					scanf("%c",&ch);
			t[i][j]=ch-'0';
		}
		scanf("%c",&ch);
	}
	dp[0][0]=t[0][0];
	for(int i=1;i<W;i++){
		dp[0][i]=dp[0][i-1]+t[0][i];
	}
	for(int i=1;i<H;i++){
		dp[i][0]=dp[i-1][0]+t[i][0];
	}
	for(int i=1;i<H;i++){
		for(int j=1;j<W;j++){
				dp[i][j]=t[i][j]+min(dp[i-1][j],dp[i][j-1]);
		}
	}
	cout<<dp[H-1][W-1]<<endl;
}

Measured memory_bytes: 1208
#include<iostream>
#include<algorithm>
using namespace std;
int a[200005];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main()
{
    int h,n;
    cin>>h>>n;
    vector<int> a(n,0);
    rep(i,n) cin>>a[i];
    ll ans=accumulate(a.begin(),a.end(),0);
    if(ans>=h)cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct coord { ll x, y; };

int main() {
  ll N; cin >> N;
  coord c[N]; rep(i,N) cin >> c[i].x >> c[i].y;
  coord mc[N]; rep(i,N) { mc[i].x = c[i].x + c[i].y; mc[i].y = c[i].x - c[i].y; }
  ll xma = -1*LLINF, xmi = LLINF, yma = -1*LLINF, ymi = LLINF;
  rep(i,N) {
    xma = max(xma, mc[i].x); xmi = min(xmi, mc[i].x);
    yma = max(yma, mc[i].y); ymi = min(ymi, mc[i].y);
  }

  ll result = max(xma-xmi, yma-ymi);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 9864
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()



int main() {
	ll H, W, h, w;
	cin >> H >> W;
	cin >> h >> w;
	cout << H * W - h * W - w * H + h * w << endl;
}

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

int main(){
    int N;  cin >> N;
    map<char, int> mp;
    while(N--){
        char s;  cin >> s;
        mp[s]++;
    }
    if(mp.size() == 3){
        cout << "Three" << endl;
    }else{
        cout << "Four" << endl;
    }
}


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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
  IO;
  int num = 1;
 int n, k; cin >> n >> k;
 for (int i = 0; i < n; ++i) {
     num = min(num * 2, num + k);
 }
 cout << num << 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(Math.abs(a-b) <=2){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }


    }

}


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

int main(void){
	int N,P=1,a;
	long long cnt=0;
	cin>>N;
	rep(i,N){
		cin>>a;
		if(P>a)continue;
		else if(P==a){
			P++;
		}else{
			if(a%P==0)cnt--;
			cnt+=a/P;
			if(P==1)P=2;
		}
	}
	cout<<cnt<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//ll MOD = 1e9+7;
ll MOD = 998244353;

#define vec     vector<int>
#define vecll   vector<ll>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------

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


  rep(i,n-m+1){
    rep(j,n-m+1){
      bool ok=true;
      rep(k,m){
        string tmp=a[i+k].substr(j,m);
        //prt3("-> ", tmp, b[k]);
        if(tmp!=b[k]) ok=false;
      }
      if(ok){prt("Yes"); return 0;}
    }
  }

  prt("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;

	vector<int> v = { a,b,c };
	sort(v.begin(), v.end());
	cout << v[2] * 10 + v[1] + v[0] << endl;
	return 0;
}

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

int main() {
	char ch;
	int cnt[26] = {};

	while (cin >> ch) {
		ch = tolower(ch);
		if (isalpha(ch)) {
			cnt[ch - 'a']++;
		}
	}
	for (int i = 0; i < 26; i++) {
		printf("%c : %d\n",i+'a',cnt[i]);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

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

    int cnt = 0;
    for(int i=0; i<n; i++){
        int height;
        cin >> height;
        if(height >= k){
            cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int ope[101];
char com[100];
int top = 0;
 
void push(int x) {
  top++;
  ope[top] = x;  
  
}
 
 
int pop() {
  top--;
  return ope[top+1];
   
}
 
   
   
 
   
int main() {
  int a,b = 0;
  int result;
  int c;
  int d,e;
   
  while(scanf("%s",com) != EOF) {
     
    if(com[0] == '+'){ 
      push(pop() + pop());
    }
    else if(com[0] == '-'){
      d = pop();
      e = pop();
      push(e - d);
    } else if(com[0] == '*') {
      push(pop() * pop());
    }   else {
      push(atoi(com));
    }
     
  }
 
  printf("%d\n",pop());
 
  return 0;
   
}


Measured memory_bytes: 2084
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for(int i = x; i < n; i++)

int main()
{
  const string joi = "JOI";
  
  string str;
  cin >> str;

  int ans = 0;
  for(int i=0; i < str.size(); )
    {
      int cs[3] = {0};

      rep(j, 3) for(; i < str.size() && str[i] == joi[j]; i++) cs[j]++;
      
      if(cs[0] >= cs[1] && cs[2] >= cs[1]) ans = max(ans, cs[1]);
    }

  cout << ans << endl;
}

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

/*                        [Template]                        */
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define let auto
#define of :
#define all(y) y.begin(), y.end()
#define present( x, y ) x.find( y ) != x.end()
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
int mod = (int)1e9 + 7 ;
#define inf (int)1e18
/************************************************************/


signed main(){
	string s ; cin >> s ;
	int len = s.size() ;
	int sum = 0 ;
	for( int i = 0 ; i < len ; i++ ){
		sum += ( s[i] - '0' ) ;
	}
	cout << ( sum % 9 == 0 ? "Yes" : "No" ) ;
	return 0 ;
}

Measured memory_bytes: 3760
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val cs = IntArray(n)
    val ss = IntArray(n)
    val fs = IntArray(n)

    repeat(n - 1) {
        val (c, s, f) = readLine()!!.split(' ').map { it.toInt() }
        cs[it] = c
        ss[it] = s
        fs[it] = f
    }

    repeat(n) {
        var t = 0
        t += ss[it] + cs[it]
        for (i in it + 1 until n - 1) {
            if (t < ss[i]) t = ss[i]
            if (t % fs[i] != 0) t += fs[i] - t % fs[i]
            t += cs[i]
        }
        println(t)
    }

}


Measured memory_bytes: 37928
#include<stdio.h>
#include<string.h>
int main(void){
    int a[100];
    int N, i, count=0;

    scanf("%d", &N);

    for(i=1; i<N+1; i++){
        scanf("%d",&a[i]);
        if((i & 1) == 1){
            if((a[i] & 1) == 1){
                count++;
            }
        }
    }

    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 1736
n = int(input())
import heapq
a = []
heapq.heapify(a) # リストを変換
z = []
for i in range(n):
    ai = int(input())
    z.append(ai)
    if i < 2:
        heapq.heappush(a, ai)
    else:
        t = heapq.heappop(a)
        #print(ai, t)
        heapq.heappush(a, max(ai, t))

x2 = heapq.heappop(a)
x1 = heapq.heappop(a)

for zi in z:
    if x1 != zi:
        print(x1)
    else:
        print(x2)



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

#define int long long

signed main() {
	// your code goes here
	string a,b;
	cin>>a>>b;
	int c,d;
	cin>>c>>d;
	string j;
	cin>>j;
	if(j==a)c--;
	else d--;
	cout<<c<<" "<<d;
	return 0;
}


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

int main() {
  int n;
  cin>>n;
  int size = 55556;
  int numbers[size];
  for (int i=0; i<size; i++) numbers[i] = 1;
  numbers[0] = numbers[1] = 0;
  int idx = 2;
  while (idx < size) {
    if (numbers[idx] == 0) {
      ++idx;
      continue;
    }
    for (int j=2*idx; j<size; j+=idx) numbers[j] = 0;
    ++idx;
  }
  int cnt =0;
  for (int i=0; i<size && cnt < n; i++) {
    if (numbers[i] == 1) {
      if (i % 5 == 1) {
        ++cnt;
        cout<<i<<" ";
      }
    }
  }
  cout<<endl;
}

Measured memory_bytes: 512
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		long m=0;
		long ans=0;
		long sum=0;
		long j=1000000000;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			sum+=a[i];
			if(a[i]>b[i]){
				j=Math.min(j,b[i]);
			}
		}
		if(j==1000000000){
			System.out.println(0);
		}else{
			System.out.println(sum-j);
		}
	}
}


Measured memory_bytes: 48160
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	string S;
	int cnt = 0;
	cin >> S;
	int size = S.size();
	for (int i = 0; i < size; i++) {
		//i % 2 == 0 が0
		if (i % 2 == 0) {
			if (S[i]=='1')cnt++;
		}
		else if (S[i] == '0')cnt++;

	}
	cout << min(cnt, size - cnt) << endl;





	return(0);
}

Measured memory_bytes: 512
#include <iostream>
#define rep(i,n) for(inti=0;i<(n);i++)
using namespace std;

int main() {
    while (true) {
        int h, w;
        cin >>h>> w;
        if (h == 0 && h == w) {
            break;
        }
       for(int j=0;j<w;j++) cout << "#";
    cout << endl;
    for(int i=1;i<h-1;i++){
      cout << "#";
      for(int j=1;j<w-1;j++) cout << ".";
      cout << "#" << endl;
    }
    for(int j=0;j<w;j++) cout << "#";
    cout << endl << endl;
  }
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
long p[20][20];
inline void solve(void){
  long N,D;
  in(N,D);
  rep(i,N){
    rep(j,D){
      in(p[i][j]);
    }
  }
  long ans=0;
  up(i,0,N-2){
    up(j,i+1,N-1){
      double d=0;
      rep(k,D)d+=pow(p[i][k]-p[j][k],2);
      if((long)sqrt(d)==sqrt(d))ans++;
    }
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
import math
while 1:
	n=input()
	if n==0:break
	l=map(int,raw_input().split())
	sum=0
	for i in l:sum+=i
	a=float(sum)/n
	sum2=.0
	for i in l:sum2+=(i-a)**2
	print math.sqrt(sum2/n)

Measured memory_bytes: 6640
#include<bits/stdc++.h>
#define ll long long
#define st stack<ll>
#define v vector<ll>
#define s set<ll>
#define p pair<ll,ll>
#define mp map<char,ll>
#define us unordered_set<ll>
#define pq priority_queue<ll>
#define q queue<ll>
#define pb push_back
#define pf push_front
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	boost;
	char s1[11],s2[11];
	cin>>s1>>s2;
	size_t n=strlen(s2);
	ll count=0;
	for(int i=0;i<n-1;i++)
	{
		if(s1[i]==s2[i])
		{
			count++;
		}
		else
		{
			break;
		}
	}
	if(count==n-1)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
//#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <set>
#include <map>
#include <string.h>
#include <iomanip>
#include <utility>
#include <bitset>
#include <random>
#pragma warning(disable:4996)
using namespace std;


const int MAXN = 2e5 + 5, INF = 1e9;



int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, ans = -1;
	long double T, A, d = 1e9;
	cin >> n >> T >> A;
	for (int i = 0; i < n; ++i) {
		long double x;
		cin >> x;
		if (fabs(T - x * 0.006 - A) < d) {
			d = fabs(T - x * 0.006 - A);
			ans = i;
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static int sim(char[][] s, int n, int d, int start){
		int t = start;
		for(int i=0;i<d;i++){
			if(t>0&&s[i][t-1]=='1')t--;
			else if(t<n-1 && s[i][t]=='1')t++;
		}
		return t;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int m = sc.nextInt()-1;
			int g = sc.nextInt()-1;
			int d = sc.nextInt();
			char[][] s = new char[d][n-1];
			for(int i=0;i<d;i++)s[i]=sc.next().toCharArray();
			if(sim(s,n,d,m)==g){
				System.out.println(0);
				continue;
			}
			boolean ok = false;
			for(int i=0;i<d;i++){
				for(int j=0;j<n-1;j++){
					if(ok || s[i][j]=='1')continue;
					boolean left, right;
					if(j==0||s[i][j-1]=='0')left = true;
					else left = false;
					if(j==n-2||s[i][j+1]=='0')right = true;
					else right = false;
					if(left&&right){
						s[i][j]='1';
						if(sim(s,n,d,m)==g){
							System.out.println((i+1)+" "+(j+1));
							ok = true;
							break;
						}
						s[i][j]='0';
					}
				}
			}
			if(!ok)System.out.println("1");
		}
	}
}

Measured memory_bytes: 12000
n, m = gets.split(' ').map(&:to_i)
xs = gets.split(' ').map(&:to_i)
xs.sort!
distances = (1...xs.length).map {|i| [i, xs[i] - xs[i - 1]] }
distances << [xs.length, 1 << 31]
distances.sort! {|a, b| b[1] <=> a[1] }

indexes = distances[0, [n, distances.length].min].map {|d| d[0] }
indexes.sort!

sum = 0
s = 0
indexes.each do |i|
  sum += xs[i - 1] - xs[s]
  s = i
end
puts sum



Measured memory_bytes: 23924
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            String S = Console.ReadLine();
            String[] line = S.Split(' ');
            int A = int.Parse(line[0]);
            int B = int.Parse(line[1]);
            int C = int.Parse(line[2]);

            Console.WriteLine(C + " " + A + " " + B);

        }
    }
}

Measured memory_bytes: 11092
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {
	private	static	BufferedReader		br      = null;
	private	static	ArrayList<Integer>	borders = null;

	static {
		br      = new BufferedReader(new InputStreamReader(System.in));
		borders = new ArrayList<Integer>();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		parseBorder();
		short[]	sum = createSumList();

		int nLen = borders.size();
		for (int n = 0; n < nLen; n++) {
			System.out.println(sum[borders.get(n)-1]);
		}
	}

	private static void parseBorder() {
		int	nNum = 0;
		while((nNum = parseNum()) != 0) {
			borders.add(nNum);
		}
	}

	private static int parseNum() {
		int		num    = 0;
		String	strNum = parseStdin();

		if (strNum != null) {
			num = Integer.parseInt(strNum);
		}

		return num;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}

	private static short[] createSumList() {
		short[]				aSum   = null;
		ArrayList<Integer>	prime = new ArrayList<Integer>();
		boolean				bPrime = true;
		int					nPrime = 0;
		Object[]			aWork  = borders.toArray();
		int					nPr1   = 0;
		int					nPr2   = 0;
		int					nLen   = 0;
		int					nMax   = 0;

		Arrays.sort(aWork);
		nMax = (Integer)aWork[aWork.length - 1];

		prime.add(2);
		for(int nNum = 3; nNum <= nMax; nNum += 2) {
			bPrime = true;

			for (int nLoop = 0; nLoop < prime.size(); nLoop++) {
				nPrime = prime.get(nLoop);
				if (nPrime <= (int)Math.sqrt((double)nNum)) {
					if (nNum % nPrime == 0) {
						bPrime = false;
						break;
					}
				}
				else {
					break;
				}
			}

			if (bPrime) {
				prime.add(nNum);
			}
		}

		aSum = new short[nMax];
		nLen = prime.size();
		for (int a = 0; a < nLen; a++) {
			nPr1 = prime.get(a);
			if (nPr1 > nMax / 2 + nMax % 2) {
				break;
			}
			for (int b = a; b < nLen; b++) {
				nPr2 = prime.get(b);
				if (nPr1 + nPr2 > nMax) {
					break;
				}
				aSum[nPr1 + nPr2 - 1]++;
			}
		}

		return aSum;
	}
}

Measured memory_bytes: 33456
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int A,B,C;

int main(){
	cin>>A>>B>>C;
	cout<<A<<' '<<B<<' '<<3*C-A-B<<endl;
	cout<<4*C-2*A-B<<' '<<C<<' '<<2*A+B-2*C<<endl;
	cout<<A+B-C<<' '<<-B+2*C<<' '<<-A+2*C<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define INF 500050
#define Max 1e9
using namespace std;
int a[INF],b[INF],c[INF];
int n,k,ans=0;
int minn=Max;
int main()
{
	cin >> n;
	
	for(int i=1; i<n; i++) {
		cin>>b[i];
	}
	ans = b[1]+b[n-1];
	for(int i=2; i<n; i++) {
		ans += min(b[i-1],b[i]);
	}
	cout<<ans<<endl;
	
	return 0;
}

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

struct bitTree{
		int n;
		vector<int>tree;
		bitTree(){};
		bitTree(int n_){
			n=n_;
			tree.resize(n+1,0);
		};
		void add(int k,int x){
			while(k<=n){
				tree[k]+=x;
				k+=k&-k;
			}
		}		
		int sum(int k){
			int ret=0;
			while(k>=1){
				ret+=tree[k];
				k-=k&-k;
			}
			return ret;
		}
};


int main(){
	int n,q;cin>>n>>q;
	bitTree bt(n);
	while(q--){
		int x,y,z;cin>>x>>y>>z;
		if(x==0)bt.add(y,z);
		else cout<<bt.sum(z)-bt.sum(y-1)<<endl;
	}

}


Measured memory_bytes: 3132
N = int(input())
words = input()
word = words.split(' ')
new_word = []

for i in range(2 * N):
    if i % 2 == 0:
        new_word.append(word[0][i//2])
    else:
        new_word.append(word[1][i//2])
    
print("".join(new_word))


Measured memory_bytes: 2940
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int n,k,c;
	std::cin >> n >> k >> c;
	std::string s;
	std::cin >> s;
	std::vector<int> v,v2;
	{
		rep(i,n) {
			if(s[i]=='o') {
				v.emplace_back(i);
				i+=c;
			}
		}
		std::reverse(all(s));
		rep(i,n) {
			if(s[i]=='o') {
				v2.emplace_back(n-i-1);
				i+=c;
			}
		}
		std::reverse(all(s));
		std::reverse(all(v2));
	}
	if(v.size()>k) return 0;
	rep(i,k) if(v[i]==v2[i]) print(v[i]+1);
	return 0;
}


Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,sum=0,sum2=0;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        sum+=a;
        sum2+=a*a;
        sum2%=mod;
        sum%=mod;
    }
    sum=sum*sum%mod;
    sum-=sum2;
    sum+=mod;
    sum%=mod;
    sum*=inv(2);
    sum%=mod;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	long long n,sum;
	scanf("%lld%lld",&n,&sum);
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n-i;j++){
			for(int k=0;k<=n-i-j;k++){
				if(i*1000+5000*j+10000*k==sum&&i+j+k==n){
					cout<<k<<" "<<j<<" "<<i<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"-1 -1 -1\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int A,B,C,K;

	scanf("%d%d%d", &A, &B, &C);
	scanf("%d", &K);

	if (A >= B && A >= C) {
		for (int i = 0; i < K; i++) {
			A = A * 2;
		}
	}
	else if (B >= A && B >= C) {
		for (int i = 0; i < K; i++) {
			B = B * 2;
		}
	}
	else if (C >= B && C >= A) {
		for (int i = 0; i < K; i++) {
			C = C * 2;
		}
	}

	int sum;
	sum = A + B + C;

	printf("%d", sum);




	return 0;
}

Measured memory_bytes: 256
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST         ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll           long long
#define ld           long double
#define pb           push_back
#define mp           make_pair
#define pii          pair<int,int>
#define mii          map<int,int>
#define vi           vector<int>
#define vll          vector<long long>
#define all(a)       (a).begin(),(a).end()
#define clz(a)       __builtin_clz(a) // count leading zeroes
#define ctz(a)       __builtin_ctz(a) // count trailing zeroes
#define popc(a)      __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul          1000000007
#define rep(i,a,b)   for(int i=a;i<b;i++)
#define rfor(i,a,b)  for(int i=a; i>=b; i--)
#define SIZE         1000005
#define F            first
#define S            second
#define mod          998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl         '\n'
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
     string s; cin>>s;
     unordered_map<char,int> ma;
     int n = s.length();
     priority_queue<int> p;
     for(auto i:s)
     {
        ma[i]++;
     }
     for(auto i:ma)
     {
        p.push(i.S);
     }
     if(n == 1) {cout<<"YES"; return;}
     if(p.size()==1) {cout<<"NO"; return;}
     if(n == 2) {cout<<"YES"; return;}
     int max1 = p.top();
     p.pop();
     int max2 = p.top();
     p.pop();
     if(n-max1-max2+1<max1) cout<<"NO";
     else cout<<"YES";
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 512
s = input()
ans = 'AC'
if s[0] == 'A' and (s[1]+s[-1]).islower() == True:
    ss = list(s[2:-1])
    cnt = 0
    for t in ss:
        if t == 'C':
            cnt += 1
        elif t.islower() == False:
            ans = 'WA'
    if cnt != 1:
        ans = 'WA'
else:
    ans = 'WA'
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define itn int

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    itn cnt = 0;
    for (char c : s) {
        if (c == 'x') cnt++;
    }
    
    cout << (cnt >= 8 ? "NO" : "YES") << endl;
}

Measured memory_bytes: 764
#include <iostream>

using namespace std;

int main() {
    //目標座標の積を代入
    long long N;
    cin >> N;
    long long ans = N - 1;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            long long distance = (i - 1) + ((N / i) - 1);
            ans = min(ans, distance);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = input()
a = map(int,raw_input().split())
b = map(int,raw_input().split())
c = map(int,raw_input().split())


s = 0
for i in xrange(n-1):
    s+= b[a[i]-1]
    
    if a[i] +1 == a[i+1]:
        
        s+= c[a[i]-1]
print s+b[a[-1]-1]

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.141592653589793238462643383279;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    ll X; cin >> X;
    for(ll B = -3000; B<=3000; B++){
        for(ll A = -3000; A<=3000; A++){
            if(A*A*A*A*A-B*B*B*B*B == X){
                cout << A << " " << B << en;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main() {
    ll n;
    cin>>n;
    if(n%2){
        cout<<0<<endl;
        return 0;
    }
    ll five=0,two=0;
    int i=1;
    while(pow(5,i)<=n){
        five+=floorl(n/(powl(5,i)*2LL));
        i++;
    }
    cout<<five<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long n[50050],f[100050],zs,a,lefts,rights;
//n[]为辅助空间，里面处理完全是质数；f[]用来前缀和，zs代表质数个数（欧拉线筛需要）
bool b[100050];
//标准的质数表
int main()
{
    b[0]=1,b[1]=1;//初始值
    for(int s=2;s<=100005;s++)//欧拉线筛
    {
        if(!b[s])//一个质数
        {
            n[zs++]=s;
        }
        for(int v=0;v<zs;v++)//处理
        {
            if(s*n[v]>100005)break;//超过了所求的质数范围
            b[n[v]*s]=true;//筛质数
            if(s%n[v]==0)break;//压成到O(n)的关键
        }
    }
    cin>>a;
    for(int s=2;s<=100005;s++)//前缀和
    {
        if(s%2==1&&b[s]==0&&b[(s+1)/2]==0)
        f[s]=1;
        f[s]+=f[s-1];
    }
    while(a--)//输入
    {
        cin>>lefts>>rights;
        cout<<f[rights]-f[lefts-1]<<endl;//前缀和的大法
    }
    return 0;
}

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

int main()
{
    int k, n;
    cin >> k >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int f = a[0];
    for (int i = 0; i < n - 1; i++) {
        a[i] = a[i + 1] - a[i];
    }
    a[n - 1] = k - a[n - 1] + f;
    sort(a, a + n);
    int ans = 0;
    for (int i = 0; i < n - 1; i++) ans += a[i];
    cout << ans << "\n";
}


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

int main(){
    int N;
    cin >> N;
    int L = N&(-N);
    if(N == L){
        cout << "No" << endl;
        return 0;
    }

    vector<pair<int, int>> ans;
    int M = N - (N%2 == 0);
    for(int i=2; i<=M; i++){
        ans.emplace_back(1, i);
        ans.emplace_back(N+i, i^1);
    }
    ans.emplace_back(N+1, N+3);
    if(N%2 == 0){
        ans.emplace_back(N, N-L+1);
        ans.emplace_back(2*N, L);
    }

    cout << "Yes" << endl;
    for(auto& p : ans) cout << p.first << " " << p.second << endl;
    return 0;
}


Measured memory_bytes: 4080
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let n:usize = read();
    if n%2 == 0{
	println!("{}",n);
    }else {
	println!("{}",2*n);
    }
}


Measured memory_bytes: 4352