akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
   int a,b,i;
   for(i=0;i<4;i++){
   scanf("%d %d",&a,&b);
   if(a==1){
   printf("%d\n",b*6000);
   }
   if(a==2){
   printf("%d\n",b*4000);
   }
   if(a==3){
   printf("%d\n",b*3000);
   }
   if(a==4){
   printf("%d\n",b*2000);
   }
   }
   return 0;
   }

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 200005;
int bit[MAX_N+1];
int nn = MAX_N; //　1-index
const ll INF = 1002003004005006001;

void adds(int a, int w){
    for(int x = a; x <= nn; x += x & -x) bit[x] += w;
}
int sums(int a){ // bit[1,a]の和を返す.
    int ret = 0;
    for(int x = a; x > 0; x -= x & -x) ret += bit[x];  
    return ret;
}

int main() {
    int n;
    ll k;
    cin >> n >> k;
    ll a[n+1] = {};
    ll sum[n+1] = {};
    srep(i,1,n+1){
        cin >> a[i];
        a[i] -= k;
        sum[i] = sum[i-1] + a[i];
    }

    ll ans = 0;

    vector<P> c;
    c.push_back(P(-INF,0));
    srep(i,1,n+1){
        c.push_back(P(sum[i], i));
    }
    sort(c.begin(), c.end());
    int f[n+1];
    rep(i,n+1){
        f[c[i].second] = i;
    }
    srep(i,1,n+1)adds(i, 1);

    rep(i,n){
        auto ite = lower_bound(c.begin(), c.end(), P(sum[i], 0));
        ans += sums(n) - sums(ite - c.begin() - 1);
        adds(f[i+1], -1);
    }

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



Measured memory_bytes: 7004
def main():
    N = int(input())
    inp = [list(map(int, input().split())) for _ in range(N)]

    for cx in range(0, 101):
        for cy in range(0, 101):
            hmax = 10 ** 10
            ha = 0
            for x, y, h in inp:
                m = abs(x-cx) + abs(y-cy)
                if h == 0:
                    hmax = min(hmax, m)
                else:
                    ht = m + h
                    if ht < 1:
                        ha = 0
                        break
                    if ha:
                        if ht != ha:
                            ha = 0
                            break
                    else:
                        ha = ht
            
            if ha:
                if ha <= hmax:
                    print(cx, cy, ha)
                    exit()


if __name__ == "__main__":
    main()

Measured memory_bytes: 42604
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#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 debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll 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;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans;
}
ll mul(ll a,ll b){//大数取模乘法防止溢出
    ll ans=0;
    a%=mod,b%=mod;
    while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }
    return ans;
}
//(b/a)%p=b*a^(p-2)%p
int pr(ll num){//判断素数
     if(num == 1) return 0;
     if(num ==2|| num==3 ) return 1 ;
     if(num %6!= 1&&num %6!= 5) return 0 ;
     int tmp =sqrt( num);
     for(int i= 5;i <=tmp; i+=6 )
          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
     return 1 ;
}
int Day(int y,int m, int d){
    if(m==1||m==2) { m+=12; y--; }
    int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
    return w+1;
}
inline int read() {
    int c = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        c = c * 10 + ch - '0';
        ch = getchar();
    }
    return c * f;
}

//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec

//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址

const int maxn=1e5+5;
int main(){
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d.at(i);

    if(n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    sort(d.begin(), d.end());
    int dif = d.at(n/2) - d.at(n/2 - 1);
    cout << dif << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
using ll = long long;


int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  map<string,int> m;
  ll ans = 0;
  rep(i,n){
    cin >> s.at(i);
    sort(s.at(i).begin(),s.at(i).end());
    if(!m.count(s.at(i)))m[s.at(i)]=1;
    else{
      ans+=m[s.at(i)];
      m[s.at(i)]++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> indeg(n);
  for (int&ai : a) {
    cin >> ai;
    ai--;
    indeg[ai]++;
  }

  set<int> left;
  set<pair<int,int>> deg;
  for (int i = 0; i < n; i++) {
    left.insert(i);
    deg.insert({indeg[i], i});
  }
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (deg.rbegin()->first == n-1-i) {
      ans.push_back(deg.rbegin()->second);
      deg.erase(*deg.rbegin());
      if (deg.size() && deg.rbegin()->first == n-1-i) {
	assert(n == 2);
	cout << -1 << endl;
	return 0;
      }
    } else {
      auto it = left.begin();
      if (ans.size() && *it == a[ans.back()]) ++it;
      ans.push_back(*it);
    }
    {
      int p = ans.back();
      //cout << p+1 << endl;
      left.erase(p);
      deg.erase({indeg[p],p});
      if (left.count(a[p])) {
	deg.erase({indeg[a[p]],a[p]});
	deg.insert({--indeg[a[p]],a[p]});
      }

      if (left.size() == 2) {
	int x = *left.begin(), y = *left.rbegin();
	if (a[x] == y && a[y] == x) {
	  int z = ans.back();
	  ans.pop_back();
	  if (!(ans.size() && a[ans.back()] == x || a[z] == y)) {
	    ans.push_back(x);
	    ans.push_back(z);
	    ans.push_back(y);
	  } else {
	    ans.push_back(y);
	    ans.push_back(z);
	    ans.push_back(x);
	  }
	  break;
	}
      }
    }
  }
  for (int i : ans) cout << i+1 << ' ';
  cout << endl;
}


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

const int MAXLEN = 1 << 17;

string S;

int is_pal(const string &s) {
  for (int i = 0, j = int(s.size()) - 1; i < j; ++i, --j) {
    if (s[i] != s[j]) {
      return 0;
    }
  }
  return 1;
}

signed main() {
  ios::sync_with_stdio(false);
  cin >> S;
  S = 'a' + S + 'a';
  string t;
  for (size_t i = 0; i < S.size(); ++i) {
    if (S[i] != 'x') {
      t += S[i];
    }
  }
  if (!is_pal(t)) {
    cout << -1 << endl;
    exit(0);
  }
  if (t.size() & 1) {
    vector<int> pos;
    static int c = 0;
    for (size_t i = 0; i < S.size(); ++i) {
      if (S[i] != 'x') {
        pos.emplace_back(c);
      }
      ++c;
    }
    long long ans = 0;
    for (int i = pos.size() / 2 - 1, j = pos.size() / 2 + 1; 0 <= i; --i, ++j) {
      ans += max(pos[i + 1] - pos[i] - 1, pos[j] - pos[j - 1] - 1)
        - min(pos[i + 1] - pos[i] - 1, pos[j] - pos[j - 1] - 1);
    }
    cout << ans << endl;
  } else {
    vector<int> pos;
    static int c = 0;
    for (size_t i = 0; i < S.size(); ++i) {
      if (S[i] != 'x') {
        pos.emplace_back(c);
      }
      ++c;
    }
    long long ans = 0;
    for (int i = pos.size() / 2 - 2, j = pos.size() / 2 + 1; 0 <= i; --i, ++j) {
      ans += max(pos[i + 1] - pos[i] - 1, pos[j] - pos[j - 1] - 1)
        - min(pos[i + 1] - pos[i] - 1, pos[j] - pos[j - 1] - 1);
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1260
#include <stdio.h>
#include <ctype.h>

int main(void){

  int N, K;
  scanf("%d%d", &N, &K);
  char S[N], ans[N];
  scanf("%s", S);

  S[K-1] = tolower(S[K-1]);
  printf("%s\n", S);

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){

  int n,m,l;
  int a[100][100],b[100][100];
  long long c[100][100];
  int i,j,k;

  scanf("%d%d%d",&n,&m,&l);

  

  for(i=0; i<n; ++i){
    for(j=0; j<l; ++j){
      c[i][j]=0;
    }
  }

  for(i=0; i<n; ++i){
    for(j=0; j<m; ++j){
      scanf("%d",&a[i][j]);
    }
  }

  for(i=0; i<m; ++i){
    for(j=0; j<l; ++j){
      scanf("%d",&b[i][j]);
    }
  }

  for(i=0; i<n; ++i){
    for(j=0; j<l; ++j){
      for(k=0; k<m; ++k){
	c[i][j]+=a[i][k]*b[k][j];
      }
    }
  }

  
  for(i=0; i<n; ++i){
    for(j=0; j<l; ++j){
      printf("%lld",c[i][j]);
      if(j!=l-1) printf(" ");
    }
    printf("\n");
  }



  return 0;
}



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

#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define foreach(i, k, n) for (int i = (k); (i) < (n); ++(i))

int main()
{
    int N;
    cin >> N;
    int L[N];
    repeat(i, N) cin >> L[i];
    sort(L, L+N);
    int ans = 0;
    int a, b, c;
    foreach (i, 0, N)
    foreach (j, i+1, N)
    foreach (k, j+1, N)
    {
        int a = L[i];
        int b = L[j];
        int c = L[k];
        bool ok = a < b + c && b < c + a && c < a + b;
        if (!ok) break;
        ans++;
    }
    cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> h(n+1,0);
    int h_max = 0;
    for(int i = 0; i < n; i++){
        cin >> h[i];
        h_max = max(h_max, h[i]);
    }
    int ans = 0;
    for(int i = 0; i < h_max; i++){
        int l = -1;
        for(int j = 0; j < n+1; j++){
            if(h[j] != 0 && l == -1){
                h[j]--;
                l = j;
            }
            else if(h[j] != 0 && l != -1){
                h[j]--;
            }
            else if(l != -1 && h[j] == 0){
                ans++;
                l = -1;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        sc.close();
        int r = 0, g = 0, b = 0, ans = 0;
        for (int i = 0; i < n; i++) {
            if (s.substring(i, i + 1).equals("R")) {
                r++;
            } else if (s.substring(i, i + 1).equals("G")) {
                g++;
            } else {
                b++;
            }
            for (int j = i + 1; j < n; j++) {
                int k = j + j - i;
                if (k < n && !s.substring(i, i + 1).equals(s.substring(j, j + 1))
                        && !s.substring(i, i + 1).equals(s.substring(k, k + 1))
                        && !s.substring(j, j + 1).equals(s.substring(k, k + 1))) {
                    ans++;
                }
            }
        }
        System.out.println((long)r * g * b - ans);
    }
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a == b+c || b == a+c || c == a+b) {
    cout << "Yes" << endl;
    }
  
  else cout << "No" << endl;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.1415926535

ll dp[3003][3003];
pair<ll,ll> mp[3003][3003];

int main() 
{
    FAST;
    string s,t,ans;
    cin>>s>>t;
    for(int i=1;i<=s.length();i++)
    {
        for(int j=1;j<=t.length();j++)
        {
            if(dp[i-1][j]>dp[i][j-1])
                mp[i][j]=mp[i-1][j];
            else
                mp[i][j]=mp[i][j-1];
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1] && dp[i-1][j-1]+1>dp[i][j])
            {
                dp[i][j]=dp[i-1][j-1]+1;
                mp[i][j]={i-1,j-1};
            }
        }
    }
    ll x=s.length(),y=t.length(),x1=0,y1=0;
    while(x!=0 && y!=0)
    {
        x1=mp[x][y].first;
        y1=mp[x][y].second;
        if(dp[x1][y1]+1==dp[x][y])
            ans.pb(s[x1]);
        x=x1;
        y=y1;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
    return 0;
}

Measured memory_bytes: 211584
/*

あけましておめでとうございます
今年もよろしくお願いいたします

おはようございます
H39_sweetです
Twitterが凍結されていますが
私は元気です
誰かこれみてくれ～ww

*/

#include<iostream>
#define lli long long int
#define ou(S) cout << S << endl
using namespace std;
int main(){
  lli x,t;
  cin>>x>>t;
  if(x>=t)ou(x-t);
  else ou(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	int w, n;
	cin >> w>> n;
	int temp[30];
	char s;
	int a[30], b[30];
	for (int i = 0;i < w;i++) {
		temp[i] = i + 1;
	}
	for (int i = 0;i < n;i++) {
		cin >> a[i] >> s >> b[i];
		int tempa;
			int tempb;
			tempa = temp[a[i]-1];
			tempb = temp[b[i]-1];
			temp[a[i]-1] = tempb;
			temp[b[i]-1] = tempa;
	}
	for (int i = 0;i < w;i++) {
		cout << temp[i] << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,p;
	cin>>n>>p;
	string s;cin>>s;
	ll ans=0;
	if(p==2){
		rep(i,n){
			if((s[i]-'0')%2==0){
				ans+=i+1;
			}
		}
		puta(ans);
		return 0;
	}
	if(p==5){
		rep(i,n){
			if((s[i]-'0')%5==0){
				ans+=i+1;
			}
		}
		puta(ans);
		return 0;
	}
	vl d(n+1,0),m(n+1,0);
	// vvb dp(n+1,vb(10000,0));//上i桁を見て、ここまでにj余らせることは可能か？
	// dp[0][0]=1;
	d[0]=1;
	d[1]=10%p;
	rep(i,n){
		if(i>0)d[i+1]=d[i]*10%p;
		m[i+1]=(m[i]+(s[n-1-i]-'0')*d[i])%p;
	}
	vl cnt(p+1,0);
	rep(i,n+1){
		ans+=cnt[m[i]];
		cnt[m[i]]++;
	}
	puta(ans);

	return 0;
}


Measured memory_bytes: 3732
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i, n){
        cin >> h[i];
    }
    vector<ll> dp(n, INF);
    dp[0] = 0;
    REP(i, n - 1){
        for(ll j = 1; j <= k; j++){
            if(i + j >= n) break;
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include <iostream>

#ifdef _MSC_VER
#define getchar_unlocked _getchar_nolock
#define printf printf_s
#endif

#define ll long long

int * vec;
ll ans = 0;
int n;
int * per;
ll * r;
ll * l;

void read_int_unlocked(int * out)
{
	static int c;
	*out = 0;
	c = getchar_unlocked();
	for (; '0' <= c && c <= '9'; c = getchar_unlocked())
		*out = (*out) * 10 + c - '0';
}

int main()
{
	read_int_unlocked(&n);
	vec = new int[n];
	int * start = vec;
	int * end = vec + n;
	for (int * i = start; i < end; i++)
		read_int_unlocked(i);
	
	per = new int[n];
	for (int * i = start; i < start + n; i++)
		*(per + (*i) - 1) = i - vec;

	r = new ll[n];
	for (auto i = r; i < r + n; i++)
		*i = 0;
	l = new ll[n];
	for (auto i = l; i < l + n; i++)
		*i = 0;

	int vsp;
	for (auto i = per; i < per + n - 1; i++)
	{
		vsp = *i;
		if ((vsp - l[vsp]) == 0)
		{
			ans += vec[vsp] * ((r[(vsp + r[vsp] + 1)] + 1) * (1 + l[vsp]));
			l[(vsp + r[vsp] + 1)] = (vsp + r[vsp] + 1);
		}
		else if ((vsp + r[vsp] + 1) == n)
		{
			ans += vec[vsp] * ((l[(vsp - l[vsp] - 1)] + 1) * (1 + r[vsp]));
			r[(vsp - l[vsp] - 1)] = n - (vsp - l[vsp]);
		}
		else
		{
			ans += vec[vsp] * ((l[vsp] + 1) * (r[(vsp + r[vsp] + 1)] + 1) + (r[vsp] + 1) * (l[(vsp - l[vsp] - 1)] + 1));
			r[(vsp - l[vsp] - 1)] = l[(vsp + r[vsp] + 1)] = r[vsp] + l[vsp] + 1;
		}
	}
	printf("%llu", ans);
	return 0;
}

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

using namespace std;

int main()
{
    double n, k, aux=0;
    long long i, x;
    cin >> n >> k;
    for(i=1; i<n+1; i++)
    {

        if(i<=k)
        {
            x=ceil(log2(k/i));
            aux=aux+(1/n)*pow(0.5,x);
        }
        else aux=aux+1/n;

    }
    cout << setprecision(14) << aux << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	int N;
	int a[100];
	int ans;
	int sum=0;
	double ave;
	double min=1000;
	cin>>N;
	for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)sum+=a[i];
    ave=(double)sum/N;
    for(int i=0;i<N;i++){
    	if(fabs(a[i]-ave)<min){
    		min=fabs(a[i]-ave);
    		ans=i;
    	}
    }
    cout<<ans<<endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    N *= 100;
    int tax = 108;
    for (int i = 0; i < N; ++i) {
        if((N <= tax * i) && (tax * i < N+100)) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << ":(" << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int S, h, m, s;
    
    scanf("%d", &S);
    h = S/3600;
    m = S%3600/60;
    s = S%60;
    printf("%d:%d:%d\n", h, m, s);
    
    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>
using namespace std;
#define ll long long int
vector<int> v;
int cur_cnt = 0;
int tar = 0;
ll re = 0;
bool run_flag = true;
#define _min(a, b) (a > b ? b : a)
#define _max(a, b) (a > b ? a : b)
void tran(int cur_l){
    for(int i = cur_l; i >= 0; --i){
        re *= 10;
        re += (ll)v[i];
    }
}
void dfs(int cur_l, int cur_pos, int last_num){
    if(run_flag == false)
        return;
    if(cur_pos < 0){
        cur_cnt++;
        if(cur_cnt == tar){
            tran(cur_l);
            // cout << v[0] << endl;
            run_flag = false;
        }
        return;
    }
    if(cur_pos == cur_l){
        for(int i = 1; i <= 9 && run_flag; ++i){
            v[cur_pos] = i;
            dfs(cur_l, cur_pos - 1, i);
        }
    }
    else{
        for(int i = _max(0, last_num - 1); i <= _min(9, last_num + 1) && run_flag; ++i){
            v[cur_pos] = i;
            dfs(cur_l, cur_pos - 1, i);
        }
    }
    return;
}
void init(){
    v.resize(13);
    for(int i = 0; i < 13; ++i){
        v[i] = 0;
    }
    run_flag = true;
    cur_cnt = 0;
}
int main(){
    init();
    cin >> tar;
    for(int i = 0; i < 13 && run_flag; ++i){
        dfs(i, i, 0);
    }
    cout << re << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
  	cin >> N;
  	int a[N];
  	int temp;
  	for(int i=0;i<N;i++){
      cin >> a[i];
    }
 
  	for(int loop=0;loop<N-1;loop++){
      for(int i=0;i<N;i++){
       if(i==N-1) continue;
       if(a[i] < a[i+1]){
         temp = a[i];
         a[i] = a[i+1];
         a[i+1] = temp;
       }
      }
    }
 /*
   	for(int i=0;i<N;i++){
      cout << a[i] << endl;
    }
  */
  	int Alice=0,Bob=0;
    for(int i=0;i<N;i+=2){
      Alice += a[i];
    }
  	for(int i=1;i<N;i+=2){
      Bob += a[i];
    }
  	cout << Alice - Bob << endl;
     
}
  

Measured memory_bytes: 256
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = (1 << 31) - 1;


int main() {
	int a[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	rep(i, 4) {
		rep(j, 4) {
			if (i == j) continue;
			rep(k, 4) {
				if (i == k || j == k) continue;
				rep(l, 4) {
					if (l == i || l == j || l == k) continue;
					if (a[i] == 1 && a[j] == 9 && a[k] == 7 && a[l] == 4) {
						cout << "YES" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



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

    P(min(n*a,b));
	return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int x;
   cin >> x;
   if(x/1800 > 0) cout << '1' << endl;
   else if(x/1600 > 0) cout << '2' << endl;
   else if(x/1400 > 0) cout << '3' << endl;
   else if(x/1200 > 0) cout << '4' << endl;
   else if(x/1000 > 0) cout << '5' << endl;
   else if(x/800 > 0) cout << '6' << endl;
   else if(x/600 > 0) cout << '7' << endl;
   else cout << '8' << endl;
}

Measured memory_bytes: 3624
import Foundation

let input = readLine()!
let inputArray = input.components(separatedBy: " ")
let A = Int(inputArray[0])!
let B = Int(inputArray[1])!
let C = Int(inputArray[2])!
let K = Int(inputArray[3])!
var max = 0

if A > K {
    print(K)
} else {
    max = A
    var remain = K - A
    if B > K {
        print(max)
    } else {
        remain -= B
        max -= remain
        print(max)
    }
    
}

Measured memory_bytes: 14172
"""
atcoder workspace
"""
from itertools import permutations

N, M, R = map(int, input().split())
Rlist = list(map(int, input().split()))

Dmat = [[1e9] * N for i in range(N)]

for i in range(N):
    Dmat[i][i] = 0

for i in range(M):
    f, t, c = map(int, input().split())
    Dmat[f-1][t-1] = c
    Dmat[t-1][f-1] = c

for i in range(N): #mid
    for j in range(N): #from
        for k in range(N): #to
            Dmat[j][k] = min(Dmat[j][k], Dmat[j][i] + Dmat[i][k])

ans = 1e9
for p in permutations(Rlist):
    ans = min(ans, sum([Dmat[p[i]-1][p[i+1]-1] for i in range(R-1)]))

print(ans)


Measured memory_bytes: 66008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  ll n;
  cin >> n;

  vector<ll> a(n);
  map<ll, ll> nmap;
  rep(i,n){
    cin >> a[i];
    nmap[a[i]]++;
  }
  ll ans = 0;
  for(auto i:nmap){
    ans += i.second * (i.second-1)/2;
  }
  rep(i,n){
    ll cnt = nmap[a[i]];
    ll tans = ans - cnt*(cnt-1)/2 + (cnt-1)*(cnt-2)/2;
    cout << tans << endl;
    
  }
  
  return 0;
    

}


Measured memory_bytes: 11136
#include<cstdio>
#include<iostream>
using namespace std;
const int maxn = 101;
int N;
int A[maxn];

int main(){
	cin >> N;
	for(int i = 0;i < N;i++){
		cin >> A[i];
	}
	
	int i,j;
	int count = 0;
	for(i = 0;i < N;i++){
		int min_num = A[i];
		int pos = i;
		for(j = i;j < N;j++){
			if(min_num > A[j]){
				min_num = A[j];
				pos = j;
			}
		}
		if(pos != i){
			int temp = A[i];
			A[i] = A[pos];
			A[pos] = temp;
			count++;
		}
	
	}
	
	for(i = 0;i < N - 1;i++)cout << A[i] <<" ";
	cout << A[N - 1] << endl;
	cout << count << endl;
	
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;

vector<int> ra(MX,0);
vector<int> par(MX,0);

vector<int> ra2(MX,0);
vector<int> par2(MX,0);

using P = pair<int, int>;
int find(int x) {
    if(par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x==y) return;
    if(ra[x]<ra[y]) {
        par[x] = y;
    }else {
        par[y] = x;
        if(ra[x]==ra[y]) {
            ra[x]++;
            
        }
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

void init(int n) {
    for(int i = 0; i < n; i++) {
        par[i] = i;
        ra[i] = 0;

    }
}

int a[MX];
int c[10][1000];

signed main(){
    string s;
    cin >> s;
    rep(i, s.length()) {
        if(i%2==0) {
            if(s[i]=='L') {
                cout << "No" << endl;
                return 0;
            }
        }else {
            if(s[i]=='R') {
                cout << "No" << endl;
                return 0;
            }
        }
        
    }


    cout << "Yes" << endl;

    return 0;

}



Measured memory_bytes: 31488
using System;
using System.Linq;

namespace ABC123A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int a = ConsoleInput.Int();
            int b = ConsoleInput.Int();
            int c = ConsoleInput.Int();
            int d = ConsoleInput.Int();
            int e = ConsoleInput.Int();
            int k = ConsoleInput.Int();

            if (e - a > k)
            {
                Console.WriteLine(":(");
                return;
            }
            Console.WriteLine("Yay!");
        }
    }
    
    
    internal static class ConsoleInput
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>

char w[9][6];

bool is_up(int x, int y){
	if(y <= 0){ return false; }
	return w[y*2-1][x] == '1';
}

bool is_down(int x, int y){
	if(y >= 4){ return false; }
	return w[y*2+1][x] == '1';
}

bool is_left(int x, int y){
	if(x <= 0){ return false; }
	return w[y*2][x-1] == '1';
}

bool is_right(int x, int y){
	if(x >= 4){ return false; }
	return w[y*2][x] == '1';
}

int main(void){
	char r[100];
	int st = 0;
	int px=0, py=0;
	for(int i=0;i<9;++i){
		scanf("%s", w+i);
	}

	r[st++] = 'R';
	px=1;

	while(px!=0 || py!=0){
		switch(r[st-1]){
		case 'U':
			if(is_left(px, py)){ r[st++] = 'L'; px--; }
			else if(is_up(px, py)){ r[st++] = 'U'; py--; }
			else if(is_right(px, py)){ r[st++] = 'R'; px++; }
			else{ r[st++] = 'D'; py++; }
			break;
		case 'R':
			if(is_up(px, py)){ r[st++] = 'U'; py--; }
			else if(is_right(px, py)){ r[st++] = 'R'; px++; }
			else if(is_down(px, py)){ r[st++] = 'D'; py++; }
			else{ r[st++] = 'L'; px--; }
			break;
		case 'D':
			if(is_right(px, py)){ r[st++] = 'R'; px++; }
			else if(is_down(px, py)){ r[st++] = 'D'; py++; }
			else if(is_left(px, py)){ r[st++] = 'L'; px--; }
			else{ r[st++] = 'U'; py--; }
			break;
		case 'L':
			if(is_down(px, py)){ r[st++] = 'D'; py++; }
			else if(is_left(px, py)){ r[st++] = 'L'; px--; }
			else if(is_up(px, py)){ r[st++] = 'U'; py--; }
			else{ r[st++] = 'R'; px++; }
			break;
		default:
			puts("error");
			break;
		}
		//printf("%d,%d\n",px,py);
	}
	r[st] = '\0';
	puts(r);
	//getchar();getchar();
	return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n,a,b;
	int x[1000];
	cin>>n>>a>>b;
	set<int> s;
	int ans=0;
	rep(i,n){
		int x;
		cin>>x;
		if ((x<a||b<=x) && s.count(x)==0){
			s.insert(x);
			ans++;

		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

int n, x;
struct info {
	int perf, lo, up, x;
	bool operator<(const info& a)const {
		return perf > a.perf;
	}
	bool operator>(const info& a)const {
		return perf < a.perf;
	}
};
vector<info>v(114514);
int sum[114514];
signed main() {
	cin >> n >> x;
	int nega = 0;
	rep(i, n) {
		cin >> v[i].x >> v[i].lo >> v[i].up;
		v[i].perf = v[i].lo * v[i].x + (x - v[i].x) * v[i].up;
		nega += v[i].x * v[i].lo;
	}
	sort(all(v));
	rep(i, n) {
		sum[i + 1] += sum[i];
		sum[i + 1] += v[i].perf;
	}
	int ng = -1, ok = n * x;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		int ma = 0;
		rep(i, n) {
			int memo;
			if (i < mid / x) {
				memo = sum[mid / x + 1] - v[i].perf;
			}
			else {
				memo = sum[mid / x];
			}
			if (mid % x <= v[i].x) {
				memo += v[i].lo * (mid % x);
			}
			else {
				memo += v[i].lo * v[i].x;
				memo += (mid % x - v[i].x) * v[i].up;
			}
			chmax(ma, memo);
		}
		if (nega <= ma)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}


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

typedef long long ll;

#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define clr(a, b) memset(a, b, sizeof(a))
#define forn(i, n) for(int i=0; i<(int)(n); ++i)
#define forab(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    clock_t tStart = clock();
#endif
    string s;
    cin >> s;
    forn(i, s.length())
        cout << 'x';
    cout << "\n";
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * (clock() - tStart)/ CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)

	var sum int
	for a := 1; a <= k; a++ {
		for b := 1; b <= k; b++ {
			for c := 1; c <= k; c++ {
				// a,b
				abGcd := gcd(a, b)

				// a,b,c
				abcGcd := gcd(abGcd, c)

				sum += abcGcd
			}
		}
	}
	fmt.Print(sum)
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


Measured memory_bytes: 1776
#include <stdio.h>
#define N 45

main(){
  int n, i;
  int F[N];

  scanf("%d", &n);

  F[0] = 1;
  F[1] = 1;

  for( i = 2; i <= n; i++){
    F[i] = F[i-2] + F[i-1];
  }

  printf("%d\n", F[n]);

  return 0;

}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 2e5+5;

ll n , a[N];

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

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

    for(int i=1; i<=n; i++)
    {
        cout << (a[n]^(a[i]^a[i-1])) << ' ';
    }

    return 0;
}

Measured memory_bytes: 5152
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c,k,ans=0;
	cin>>a>>b>>c;
	cin>>k;
	int MAX=max(max(a,b),c);
	ans=a+b+c-MAX+MAX*pow(2,k);
	printf("%d\n",ans);
	return 0;
 } 

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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if(count(begin(S), end(S), 'R') > count(begin(S), end(S), 'B')) {
    puts("Yes");
  } else {
    puts("No");
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i_, __start, __end) for(ll i_=(ll)__start; i_<(ll)__end; i_++)
#define print(_a) cout << _a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");


int main(){
    ll n, a, b;
    cin >> n;
    if(n == 1){
      print("Hello World");
    }else if(n == 2){
      cin >> a >> b;
      print(a + b);
    }
   
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        if(i==k-1)
        {
            char c=s[i];
            putchar(tolower(c));
        }
        else
        cout<<s[i];
    }
    
}

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

int main(){
	int n;
	int pm, pe, pj;
	while(cin >> n, n){
		for(int i=0; i < n; i++){
			cin >> pm >> pe >> pj;

			if(pm == 100 || pe == 100 || pj == 100) cout << 'A' << endl;
			else if(90 <= (pm + pe) / 2) cout << 'A' << endl;
			else if(80 <= (pm + pe + pj) / 3) cout << 'A' << endl;
			else if(70 <= (pm + pe + pj) / 3) cout << 'B' << endl;
			else if(50 <= (pm + pe + pj) / 3 && (80 <= pm || 80 <= pe)) cout << 'B' << endl;
			else cout << 'C' << endl;
		}
	}
}

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

int main() {
    int n;
    cin >> n;
    map<char, int> num;
    for (int i = 0; i < n; i++) {
        char s;
        cin >> s;
        num[s]++;
    }
    if (num.size() == 3) {
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;using ull=unsigned ll;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
#define cut(n, Min, Max) max(min(n,Max),Min)
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int N, M;
void func()
{
    cin>>N;
    string tmpstr;
    int array[5]={};
    rep(i, 0, N) {
        cin>>tmpstr;
        if (tmpstr[0]=='M')++array[0];
        else if (tmpstr[0]=='A')++array[1];
        else if (tmpstr[0]=='R')++array[2];
        else if (tmpstr[0]=='C')++array[3];
        else if (tmpstr[0]=='H')++array[4];
    }
    ll ans=0;
    rep(i, 0, 5) {
        rep(j, i+1, 5) {
            rep(k, j+1, 5) {
                ans+=(ll)array[i]*(ll)array[j]*(ll)array[k];
            }
        }
    }
    cout<<ans<<endl;
}
int main()
{
    func();
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
#include <climits>
#include <cfloat>

struct BitSet {
	int to_int;
	BitSet operator+(const int value) const {
		return BitSet{ to_int | (1 << value) };
	}
	bool is_contains(const int value) const {
		return (to_int & (1 << value)) != 0;
	}
};
struct Point {
	double x, y;
	double distance(const Point& that) const {
		return std::sqrt((x - that.x) * (x - that.x) + (y - that.y) * (y - that.y));
	}
};
double solve(const BitSet set, const int end_a, const int end_b, const std::vector<std::vector<Point>>& lines, std::vector<std::vector<std::vector<double>>>& memo) {
	auto& res = memo[set.to_int][std::max(end_a, end_b)][std::min(end_a, end_b)];
	if (res >= 0) return res;
	else {
		res = DBL_MAX;
		for (auto i = 0; i < lines.size(); ++i) if (!set.is_contains(i)){
			auto temp = std::min({
				solve(set + i, end_a, i * 2 + 1, lines, memo) + lines[i][0].distance(lines[end_b / 2][end_b % 2]),
				solve(set + i, end_a, i * 2, lines, memo) + lines[i][1].distance(lines[end_b / 2][end_b % 2]),
				solve(set + i, end_b, i * 2 + 1, lines, memo) + lines[i][0].distance(lines[end_a / 2][end_a % 2]),
				solve(set + i, end_b, i * 2, lines, memo) + lines[i][1].distance(lines[end_a / 2][end_a % 2])
				});
			if (temp < res) res = temp;
		}
		if (res == DBL_MAX) return res = 0;
		return res;
	}
}
int main() {
	int count = 1;
	std::cout << std::setprecision(9) << std::fixed;
	while (true) {
		int n; std::cin >> n; if (n == 0) return 0;
		std::vector<std::vector<Point>> lines(n, std::vector<Point>(2)); for (auto& line : lines) for (auto& point : line) std::cin >> point.x >> point.y;
		std::vector<std::vector<std::vector<double>>> memo(1 << n, std::vector<std::vector<double>>(2 * n));
		for (auto i = 0; i < memo.size(); ++i) for (auto j = 0; j < memo[i].size(); ++j) memo[i][j] = std::vector<double>(j, -1);
		double line_length = 0;
		for (const auto& line : lines) line_length += line[0].distance(line[1]);
		std::cout << "Case " << count++ << ": " << solve(BitSet{ 1 }, 0, 1, lines, memo) + line_length << std::endl;
	}
}


Measured memory_bytes: 68108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	if((b-a)%2==0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
}

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

int main()
{
    char a;
    cin >> a;
    if (isupper(a))
    {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'a' << endl;
    }
    return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

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

	int cnt = 0;
	for (int i = 0; i < S.length(); ++i) {
		int judge = S[i] - 'a';
		if (i >= 2 && i < S.length() - 1 && S[i] == 'C') {
			cnt++;
		}
		else if (judge < 0 && S[i] != 'C' && S[i] != 'A') {
			cout << "WA" << endl;
			return 0;
		}
	}
	if (S[0] == 'A' && cnt == 1) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256