akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    string s;
    cin >> s;

    // 処理
    bool flg = false;
    if (s.size() % 2 == 0) {  //奇数はfalse
        for (int i = 0; i < s.size(); i++) {
            if (count(all(s), s[i]) % 2 == 0) {
                flg = true;
            } else {
                flg = false;
                break;
            }
        }
    }

    // 出力
    if (flg) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#define N 10005
#define LL long long
#define inf 1<<29
#define eps 1e-7
#define rep(i,a,b) for (int i=a;i<=b;i++)
using namespace std;
vector<int>v[100005];
int get_sg(int u,int pre){
    int ret=0;
    for(int i=0;i<v[u].size();i++){
        if(v[u][i]!=pre)
            ret^=(1+get_sg(v[u][i],u));
    }
    rep(i,1,1000);
    return ret;
}
int main(){
    rep(i,1,1000);
    int t,n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            v[i].clear();
        for(int i=1;i<n;i++){
            int x,y;
            scanf("%d%d",&x,&y);
            v[x].push_back(y);
            v[y].push_back(x);
        }
        if(get_sg(1,-1))
            puts("Alice");
        else
            puts("Bob");

    return 0;
}


Measured memory_bytes: 11904
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(Q)]

graph = [[] for _ in range(N)]
for ai, bi, ci in abc:
    graph[ai - 1].append((bi - 1, ci))
    graph[bi - 1].append((ai - 1, ci))

MY_INF = 10 ** 18
import heapq

q = [(0, K - 1)]
d = [MY_INF] * N
d[K - 1] = 0
while len(q) > 0:
    dist, src = heapq.heappop(q)
    for dst, c_tmp in graph[src]:
        dist_tmp = dist + c_tmp
        if d[dst] > dist_tmp:
            d[dst] = dist_tmp
            heapq.heappush(q, (dist_tmp, dst))

for xi, yi in xy:
    print(d[xi - 1] + d[yi - 1])
    

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

int main() {
  long long x;
  cin >> x;
  long long ans = 0;
  while (x >= 500) {
    x = x - 500;
    ans += 1000;
  }
  while (x >= 5) {
    x = x - 5;
    ans += 5;
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
using namespace std;
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)

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

    ll N, A, B;
    string S;
    cin >> N >> A >> B >> S;

    ll pass = 0;
    ll foreign = 0;
    vector<ll> ans;
    for (auto p : S) {
        if (p == 'a') {
            if (pass < A+B) {
                cout << "Yes\n";
                pass += 1;
            } else {
                cout << "No\n";
            }
        } else if (p == 'b') {
            if ((pass < A+B) && (foreign < B)) {
                cout << "Yes\n";
                pass += 1;
                foreign += 1;
            } else {
                cout << "No\n";
            }
        } else cout << "No\n";
    }
}

Measured memory_bytes: 848
#include<stdio.h>
int main()
{
//    char s[1000];
    int n;
    while (~scanf("%d",&n))
    {
//        printf("ABC%d\n",s);
        int ans=0;
        int a[123]={1,2,4,8,16,32,64};
        for(int i=0; i<=6; i++)
        {
            if(n>=a[i])
            {
                ans=a[i];
            }
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int input,output;
	double a=0.0;
	scanf("%d",&input);
	
	a = (double)input/2.0;
	if( a > (double)(input/2) ){
		a = a + 1.0;
	}
	output = (int)a;
	printf("%d\n",output);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int n;
  string s1,s2,ans;
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s1; 
    cin >> s2;
    ans = "";
    int m = max(s1.size(),s2.size());
    while(m>s1.size()) s1 = '0' + s1;
    while(m>s2.size()) s2 = '0' + s2;

    int carry = 0;
    for(int j=m-1; j>=0; j--){
      char ch = ((s1[j]-'0') + (s2[j]-'0') + carry)%10 + '0';
      carry = ((s1[j]-'0') + (s2[j]-'0') + carry)/10;
      ans += ch; //反転してしまうが…
    }
    if(carry) ans += (carry+'0');
    reverse(ans.begin(),ans.end()); //元通り

    //頭の0を削除していく
    while(ans.size()>1 && ans[0] == '0') ans.erase(ans.begin());
    if(ans.size() > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int dy[2] = {1,0};
int dx[2] = {0,1};
int h,w;
vector<string>s(10);


int main(){
    ll n, h;
    cin >> n >> h;
    vector<ll>a(n), b(n);
    ll max_a = 0;
    rep(i, n){
        cin >> a[i] >> b[i];
        max_a = max(max_a, a[i]);
    }

    ll res = 0;
    sort( ALL(b), greater<ll>() );

    rep(i, n){
        if(max_a < b[i]){
            res++;
            h -= b[i];
            if(h <= 0)break;
        }
    }

    if(h > 0){
        res += h / max_a;
        if(h % max_a != 0)res++;
    }
    cout << res << endl;
}



Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,k,N,K,ans=0;
  string s;
  cin>>N>>K;
  vec v(N);
  rep(i,N)cin>>v[i];
  vrsort(v);
  rep(i,N-K+1){
    ans+=(v[i]+mod)%mod*modncr(N-i-1,K-1)%mod;
    ans%=mod;
  }
  reverse(all(v));
  rep(i,N-K+1){
    ans-=(v[i]+mod)%mod*modncr(N-i-1,K-1)%mod;
    ans+=mod;
    ans%=mod;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
using ll = long long;
using namespace std;
int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
int main(){
    int n;cin>>n;
    ll ans=0;
    rep1(i,n) rep1(j,n) rep1(k,n){
        ans+=gcd(gcd(i,j),k);
    }
    cout<<ans<<endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define out(n) cout << (n) << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

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

  int d, e;
  rep(i, 0, b) {
    cin >> d >> e;
    c[--d]++;
    c[--e]++;
  }

  rep(i, 0, a) {
    out(c[i]);
  }
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val S = sc.next
    val ymd = S.split("/").map(_.toInt)

    if (ymd(0) <= 2019 && ymd(1) <=4 && ymd(2) <= 30) "Heisei" else "TBD"
  }
}


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

int main(void) {
	std::vector<char> stations;
	for (int i = 0; i < 3; i++) {
		char temp;
		std::cin >> temp;
		stations.push_back(temp);
	}
	if (stations[0] == stations[1] && stations[1] == stations[2]) {
		std::cout << "No";
	}
	else {
		std::cout << "Yes";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b;
  cin>>a>>b;
  if(a%b==0)
    cout<<-1<<endl;
  else
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
#define rep(i,a)  for(ll i=0; i< a; i++)
#define pb push_back
#define vl vector<ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
const ll N=1e5+5;
int main()
{
	fast;ll t;t=1;;
	while(t--)
	{
		ll n;cin>>n;std::vector<ll> a(n);for(ll i=0;i<n;i++)cin>>a[i];
		sort(a.begin(),a.end());if(n==1){cout<<"0";return 0;}
		std::vector<ll> v;v.push_back(a.back());a.pop_back();
		while(1)
		{
			if(v.size()==n-1)break;
			v.push_back(a.back());if(v.size()==n-1)break;
			v.push_back(a.back());if(v.size()==n-1)break;
			a.pop_back();
		}
		ll sum=0;
		for(ll i=0;i<v.size();i++)sum+=v[i];cout<<sum;

	}
}

Measured memory_bytes: 6888
#include <cstdio>
#include <algorithm>
long long s,ans;//s和ans要开long long
int n,a[200003];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=2;i<=n;i++){
        s=(s+a[i-1])%1000000007;//求前i-1的前缀和
        ans=(ans+s*a[i])%1000000007;//加上s*a[i]，两个都要取模
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e18 + 8;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 998244353;


int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    string t;
    cin >> t;
    for(int i = 0; i < t.size(); i++)
        if(t[i] == '?')
            t[i] = 'D';
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3780
#include<iostream>

using namespace std;

int main() {

    char s[1000] = {0};

    while (1) {

        cin >> s;

        if(s[0] == '0') {
            break;
        }

        int answer = 0;

        int i = 0;
        while (1) {
            if ('0' <= s[i] && s[i] <= '9') {
                answer += s[i] - '0';
            } else {
                break;
            }
            i++;
        }

        cout << answer << endl;

    }

    return 0;
}


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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

int n;
int before = 0,cnt = 0;
int main() {
    scanf("%d",&n);
    vector<int> d(n);
    rep(i, 0, n) cin >> d[i];
    
    sort(d.begin(),d.end());

    rep(i,0,d.size()){
        if(d[i] > before){
            cnt++;
        }
        before = d[i];
    }
    pout(cnt);
    return 0;
}

Measured memory_bytes: 256
// J4180449 三宅亮輔
// 問題名
// - allocation
// 問題URL
// - https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_4_D
// 所要時間
// - 30分
// 学んだこと
//  二分探索のやりかたを学んだ
//  lbを最初1に初期化しておりansが1になるケースで弾かれて悩んだ
//  荷物を積める作業で累積和を二分探索すればさらに計算量を減らせそうだと思った

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
set<string> s;
int N;
int main() {
    cin >> N;
    for(int i = 0; i < N; i++) {
        string a, b;
        cin >> a >> b;
        if(a == "insert")
            s.insert(b);
        else
            cout << ((s.count(b) > 0) ? "yes" : "no") << endl;
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long ull;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int MOD = (int)1e9 + 7;
const int N = (int)2e5 + 911;

int mult(int a, int b){ 
  return (a * 1ll * b) % MOD;
}

int add(int a, int b){
  a += b;
  if(a >= MOD) a -= MOD;
  return a;
}

int powr(int n, int k){
  if(k == 0) return 1;
  int p = powr(n,k/2);
  p = mult(p, p);
  if((k&1)) p = mult(p, n);
  return p;
}

int fac[N];

int ncr(int n, int k){
  return mult(fac[n],mult(powr(fac[k],MOD-2),powr(fac[n-k],MOD-2)));
}

int f[N];
int g[N];

int main(){
  fastIO;
  fac[0]=1;
  for(int i = 1; i < N ; i ++ ){
    fac[i]=mult(fac[i-1],i);
  }
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  for(int i = 1; i <= 2*n-1; i ++ ){
    f[i]=mult(i,mult(100,powr(100-c,MOD-2)));
  }
  int i100 = powr(a+b, MOD-2);
  int ia, ib;
  for(int i = n; i <= 2 * n - 1; i ++ ){
    g[i]=ncr(i-1,n-1);
    ia = mult(powr(mult(a,i100),n),powr(mult(b,i100),i-n));
    ib = mult(powr(mult(b,i100),n),powr(mult(a,i100),i-n));
    g[i] = mult(g[i], add(ia, ib));
  }
  int ans = 0;
  for(int i = n; i <= 2 * n - 1; i ++ ){
    ans = add(ans, mult(g[i],f[i]));
  }
  cout << ans << "\n";
  return 0;
}


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

#define  fi first
#define se second

int d[32][32], a[600][600];

bool rem[3];
bool col[32];

vector< pair<int,pair<int,int> > > ans;

void f(int x,int n,int c){
    
    int t;
    
    for(int i=1;i<=c;i++){
        t = 0;
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
              if( (j+k)%3 == x ) t += d[a[j][k]][i];  
            }
        }
        
        ans.push_back({ t,{x,i} });
    }
    
    
}

int main() {
    int n, c, i, j, k;
    cin >> n >> c;
    
    
    for(i=1;i<=c;i++){
        for(j=1;j<=c;j++){
            cin>>d[i][j];
        }
    }
    
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            cin>>a[i][j];
        }
    }
    
    for(i=0;i<3;i++){
        f(i,n,c);
    }
    
    sort(ans.begin(),ans.end());
    
    
    int S = ans.size();
    int res = INT_MAX;
    
    for(i=0;i<S-2;i++){
        for(j=i+1;j<S-1;j++){
            for(k=j+1;k<S;k++){
                if( ans[i].se.fi!=ans[j].se.fi && ans[j].se.fi!=ans[k].se.fi && ans[i].se.fi!=ans[k].se.fi && ans[j].se.se!=ans[k].se.se && ans[i].se.se!=ans[k].se.se && ans[j].se.se!=ans[i].se.se ){
                    res = min(res,ans[i].fi+ans[j].fi+ans[k].fi);
                }
            }
        }
    }
    
   
   
    cout<<res;
    return 0;
}

Measured memory_bytes: 1408
K,S=map(int,input().split())
c=0
for x in range(K+1):
    for y in range(K+1):
        if S-x-y>=0 and S-x-y<=K:
            c+=1
        """
        for z in range(K+1):
            if x+y+z==S:
                c+=1
        """
print(c)


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



int main() {
    string S;
    cin >> S;
    int n = S.length();
    int n_2 = n / 2;
    int ans = 0;
    for (int i = 0; i < n_2; i++) {
        if (S[i] != S[n - i -1]) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
N,M=map(int,input().split())
A=[]
for i in range(N):
  a=input()
  A.append(a)
B=[]
for j in range(M):
  b=input()
  B.append(b)
for k in range(N-M+1):
  for l in range(N-M+1):
    z=0
    for m in range(M):
      try:
        if B[m]==A[k+m][l:l+M]:
          z+=1
      except:
        sys.stderr.write(f"{k,l,m}")
        pass
    if z==M:
      print("Yes")
      sys.exit()
print("No")

Measured memory_bytes: 9144
#include "bits/stdc++.h"

using namespace std;

template <class T>
struct Edge {
  using w_type = T;
  Edge(int u, int v, w_type w): u(u), v(v), w(w) { }
  int u, v;
  w_type w;
  bool operator<(const Edge<w_type> & rhs) const {
    if (w != rhs.w) { return w < rhs.w; }
    if (u != rhs.u) { return u < rhs.u; }
    return v < rhs.v;
  }
  bool operator>(const Edge<w_type> & rhs) const {
    return rhs < *this;
  }
};

class DisjointSet {
public:
  DisjointSet(const unsigned n_sets): n_sets_(n_sets) {
    parent_.reserve(n_sets);
    rank_.reserve(n_sets);
  }
  void MakeSet(const unsigned x) { parent_[x] = x; rank_[x] = 0; }
  void Union(const unsigned lhs, const unsigned rhs) {
    Link(FindSet(lhs), FindSet(rhs));
  }
  void Link(const unsigned lhs, const unsigned rhs) {
    if (rank_[lhs] > rank_[rhs]) { parent_[rhs] = lhs; }
    else {
      parent_[lhs] = rhs;
      if (rank_[lhs] == rank_[rhs]) { ++rank_[rhs]; }
    }
  }
  unsigned FindSet(const unsigned x) {
    if (x != parent_[x]) { parent_[x] = FindSet(parent_[x]); }
    return parent_[x];
  }

private:
  unsigned n_sets_;
  vector<unsigned> parent_;
  vector<unsigned> rank_;
};

template <class Edge>
decltype(auto) Kruskal(vector<Edge> & edges,
                 typename vector<Edge>::size_type node_num) {
  using size_type = typename vector<Edge>::size_type;
  using w_type = typename Edge::w_type;

  w_type weight_sum{0};
  size_type edge_num = 0;
  DisjointSet dis_set(node_num);
  for (size_type i = 0; i < node_num; ++i) { dis_set.MakeSet(i); }
  sort(edges.begin(), edges.end(), greater<Edge>());
  for (auto & e: edges) {
    if (dis_set.FindSet(e.u) != dis_set.FindSet(e.v)) {
      weight_sum += e.w;
      dis_set.Union(e.u, e.v);
      ++edge_num;
    }
    if (edge_num == node_num - 1) { break; }
  }

  // Impossible
  // if (edge_num != node_num - 1) { cout << "IMPOSSIBLE\n"; }
  return weight_sum;
}

int main(int argc, char const *argv[]) {
  using w_type = double;

  const w_type kInf = numeric_limits<w_type>::max();

  vector<pair<int, int>> nodes;
  vector<Edge<w_type>> edges;
  w_type len_total = 0;
  unsigned V, E;
  cin >> V >> E;
  for (unsigned i = 0; i < V; ++i) {
    int x, y;
    cin >> x >> y;
    nodes.emplace_back(x, y);
  }
  for (unsigned i = 0; i < E; ++i) {
    unsigned u, v;
    cin >> u >> v;
    --u;
    --v;
    w_type w = hypot(nodes[u].first - nodes[v].first,
                     nodes[u].second - nodes[v].second);
    edges.emplace_back(u, v, w);
    len_total += w;
  }
  cout << fixed << setprecision(3) << len_total - Kruskal(edges, V) << endl;
  return 0;
}

Measured memory_bytes: 3616
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
    const numbers = line.split(' ').map(Number);

    // Edit from here
    let a = numbers[0];
    let b = numbers[1];

    if ( a === 0 && b === 0 ) { break; }

    if ( a > b ) {
        const tmp = a;
        a = b;
        b = tmp;
    } 

    const output = a + ' ' + b;
    // to here
    
    console.log(output);
    
}


Measured memory_bytes: 18840
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (n); (i) >= (f); (i)++)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define input(x) x; cin >> x;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

long long M = 1000000007;

int calc_index(int *a, int n){
  int t[n];
  copy(a, a + n, t);
  sort(t, t + n);
  int x;
  FOR(i, 1, n){
    if(t[i - 1] == t[i]){
      x = t[i];
      break;
    }
  }

  int flg = 1;
  int result = n - 1;
  rep(i, n){
    if(a[i] == x){
      result += i * flg;
      flg *= -1;
    }
  }
  return result;
}

long facts[100002];
void c_fact(){
  facts[0] = 1;
  long result = 1;
  FOR(i, 1, 100002){
    result *= i;
    if(result > M){
      result %= M;
    }

    facts[i] = result;
  }
}

long long fact(long a){
  return facts[a];
}

long long powmod(long long a, long long b){
  if(b == 0) return 1;
  if(b & 1) return (powmod(a, b - 1) % M) * a % M;
  else{
    long long d = powmod(a, b / 2);
    return d * d % M;
  }
}

long c(long a, long b){
  if(b > a) return 0;
  return fact(a) * (powmod((fact(b) * fact(a - b) %M), M - 2) % M) % M;
}

int main(){
  c_fact();

  int input(n);
  int list_input(a, n + 1);

  int out = calc_index(a, n + 1);

  FOR(i, 1, n + 1){
    long r = c(n + 1, i) - c(out, i - 1);
    if(r < 0) r += M;
    cout << r%M << endl;
  }
  cout << 1 << endl;
}


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

int main(){
  int N, Q;
  cin >> N >> Q;

  string S;
  cin >> S;

  vector<int> ac_cnt(N + 1);
  ac_cnt[0] = ac_cnt[1] = 0;
  for(int i = 2; i <= N; i++){
    ac_cnt[i] = ac_cnt[i - 1];
    if(S[i - 2] == 'A' && S[i - 1] == 'C'){
      ac_cnt[i]++;
    }
  }

  for(int q = 0; q < Q; q++){
    int l, r;
    cin >> l >> r;
    l--; r--;
    int ans = ac_cnt[r+ 1] - ac_cnt[l];
    if(l > 0 && S[l - 1] == 'A' && S[l] == 'C'){
      ans--;
    }
    cout << ans << endl;

  }
}


Measured memory_bytes: 1472
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	int32_t res = 0;
	in >> N;
	if (N <= 3) {
		res += 100000 * (4-N);
	}
	int a;
	in >> a;
	if (a <= 3) {
		res += 100000 * (4-a);
	}
	if (N == 1 && a == 1) {
		res += 400000;
	}
	out << res << endl;

	return 0;
}
#endif


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    string S;
    int ans = 0;
    cin >> S;
    for(int i = 0; i < S.size(); i++) {
        if(S[i] == '1') ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=998244353;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll mod_pow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll N; cin>>N;
    ll ans=1;
    ll tmp_max=0;
    vector<ll> num(N,0);
    rep(i,N){
        ll tmp; cin>>tmp;
        chmax(tmp_max,tmp);
        if(i==0){
            if(tmp!=0){
                cout<<0<<endl;
                return 0;
            }
            else num[tmp]++;
        }
        else{
            if(tmp==0){
                cout<<0<<endl;
                return 0;
            }
            else{
                num[tmp]++;
            }
        }
    }
    rep1(i,tmp_max){
        if(num[i]==0){
            cout<<0<<endl;
            return 0;
        }
        else{
            ans*=mod_pow(num[i-1],num[i],MOD);
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4052
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    string str;
    cin >> str;
    int cnt=0;
    rep(i,3){
        if(str[i]=='1') cnt++;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n, a;
    cin >> n >> a;
    if(a >= n%500) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
n = int(sys.stdin.readline().rstrip("\n"))
l = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
l.sort()
ans = 0
for a in range(n):
    for b in range(a+1,n):
        for c in range(b+1,n):
            if l[a] != l[b] and l[b] != l[c] and l[a] != l[c]:
                if l[a] + l[b] > l[c]:
                    ans += 1
print(ans)

Measured memory_bytes: 73076
#include <bits/stdc++.h>
#define ll long long int
#define Fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

int main() {
    Fast
    
    int n,k; cin>>n>>k;
    int arr[n]; for(int &i:arr) cin>>i;

    int mun=INT_MAX; for(int i:arr) mun=min(mun, i);
    int mux=INT_MIN; for(int i:arr) mux=min(mux, i);

    int dp[k+1]; dp[0]=0;
    memset(dp, 0, sizeof(dp));
    for(int i=1; i<=k; i++) {
        for(int p:arr) {
            if(i-p>=0) if(dp[i-p]==0) dp[i]=1;
        }
    }
    

    !dp[k]?cout<<"Second":cout<<"First";
    //for(int i:dp) cout<<i<<" ";

}

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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n;
  cin >> n;
  vt<i64> a(n);
  rep(i, 0, n) cin >> a[i];

  vvt<i64> dp(n + 1, vt<i64>(2, -LINF));
  dp[0][0] = 0;
  rep(i, 0, n) {
    dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);
    dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
  }
  cout << dp[n][0] << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define ll long long
# define F first
# define S second
# define pb push_back
#define INF 1e9 + 7
 
const int N = 1e4 + 5;
typedef vector<int>vi;
typedef pair<int,int>ii;
typedef pair<int,ii>iii;
int arr[N],n;
int bs(int x){
  int l=0, r=n, m;
  while(r-l > 1){
    m = (l + r) / 2;
    if(arr[m] < x) l = m;
    else r = m;
  }
  return l;
}
int main() {
  string s;
  while(cin >> s){
    int ans = 0;
    for(int i=0;i<s.size()/2;i++)
      if(s[i]!=s[s.size()-1-i])
        ans ++;
    cout << ans << endl;
  }    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
//jika 3 dan 5 membagi == fixxbuzz
//jika dibagi 3 doang ==fizz
//jika dibagi 5 doang == buzz
//jika ttidak a =i
//pakai long long int katanya warning overflow?
long long sum = 0;
int n;
scanf("%d",&n);
for(int i =1;i<=n;i++){
	if(i%3==0 || i%5 == 0 ){
		continue;
	}
	else{
		sum += i;
	}
}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 1684
//
//  main.cpp
//  codeforces
//
//  Created by cfhaiteeh on 21/5/2018.
//  Copyright © 2018 cfhaiteeh. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#define  LL long long

using namespace  std;
const int maxn=123456;

int n,H;
void init(){
    
    
}
LL ans;
//r 2e9
LL br(LL l,LL r,LL P,LL len){
    LL MIN=0;
    while(l<=r){
        LL mid=(l+r)/2;
        LL t1=(1+mid-1)*(mid-1)+mid-P;
        t1=n-t1;
        if(t1<0){
            r=mid-1;
        }
        else{
            LL x=t1/mid;
            if(t1%mid!=0)x++;
            LL need=(mid-1)*2+1-len;
            need+=x;
            
            if(MIN==0)MIN=need;
            else MIN=min(MIN,need);
            l=mid+1;
        }
    }
    return MIN;
}
void play(){
   
}
void pri(){
    printf("%lld\n",ans);
    
}
char ch[3*123456];
int ai[3*123456];
int bi[3*123456];
int main() {
    // insert code here...
    
    //   cout<<p*p/2<<endl;
    while(scanf("%d",&n)!=EOF){
        scanf("%s",ch+1);
        int be=0;
        memset(ai,0,sizeof(ai));
        memset(bi,0,sizeof(bi));
        for(int i=1;i<=n;i++){
            if(ch[i]=='W'){
                be++;
            }
            ai[i]=be;
        }
        be=0;
        for(int i=n;i>=1;i--){
            if(ch[i]=='E'){
                be++;
            }
            bi[i]=be;
        }
        int MIN=1e9;
        for(int i=1;i<=n;i++){
            MIN=min(MIN,ai[i-1]+bi[i+1]);
        }
        printf("%d\n",MIN);
    }
    return 0;
}


Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<vector>
#include<cstdlib>
using namespace std;

void split(string str, vector<string> &vc, char delim){

	string s;

	for(int i=0; i<str.length(); i++){
		if(str[i] != delim){
			s += str[i];
		}
		else {
			vc.push_back(s);
			s = "";
		}
	}
	vc.push_back(s);
	
}

int main(){

	int v[99][50], cnt;
	string str;
	vector<string> vc;
	
	cnt = 0;
	while(getline(cin, str)){
		vc.clear();
		split(str, vc, ',');
		for(int i=0; i<vc.size(); i++){
			v[cnt][i] = atoi(&vc[i][0]);
		}
		cnt++;
	}
	
	for(int i=1; i<cnt; i++){
		if(i < (cnt + 1) / 2){
			for(int j=0; j<=i; j++){
				if(j == 0) {
					v[i][j] += v[i-1][0];
				}
				else if(j == cnt){
					v[i][j] += v[i-1][j-1];
				}
				else {
					v[i][j] += max(v[i-1][j-1], v[i-1][j]);
				}
			}
		}
		else {
			for(int j=0; j<cnt-i; j++){
				v[i][j] += max(v[i-1][j], v[i-1][j+1]);
			}
		}
	}

	cout << v[cnt-1][0] << endl;

	return 0;

}

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

using namespace std;

typedef long long ll;
typedef long double ld;

int uradi(int x){
    if(x%3 == 0) return 2*(x/3);
    return 1 + 2*(x/3);
}

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    string s;
    cin >> s;
    int tren = 1;
    int res = 0;
    int n = s.size();
    int i;
    for(i=1; i<n; i++){
        if(s[i] == s[i-1]) tren++;
        else{
            res += uradi(tren);
            if(tren%3 == 2){
                res++;
                i++;
            }
            //if(tren < 3) res++;
            tren = 1;
        }
    }
    if(i == n) res += uradi(tren);
    //if(tren < 3) res++;
    cout << res;
    return 0;
}


Measured memory_bytes: 720
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

dic = {}
for elem in a:
    if elem not in dic:
        dic[elem] = 1
    else:
        dic[elem] += 1

cnt = 0
for k in dic.keys():
    if dic[k] > k:
        cnt += dic[k]-k
    elif dic[k] < k:
        cnt += dic[k]

print(cnt)


Measured memory_bytes: 17780
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

//static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000;
//#define PI 3.14159265358979323846
//
//int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
//
//int findSumDigits(int s) {
//    int num = 0;
//    int temp = 0;
//    while (s) {
//        temp = s % 10;
//        num += temp;
//        s = s / 10;
//    }
//    return num;
//}
//
//int countDivisorNum(int n) {
//    int count = 0;
//    for (int i = 1; i <= n; i++) {
//        if (n % i == 0) {
//            count++;
//        }
//    }
//    return count;
//}

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n, 0) cin >> s[i];
    ll c[4];
    c[0] = 0;
    c[1] = 0;
    c[2] = 0;
    c[3] = 0;

    rep(i, n, 0) {
        if (s[i] == "AC") {
            c[0]++;
        }
        if (s[i] == "WA") {
            c[1]++;
        }
        if (s[i] == "TLE") {
            c[2]++;
        }
        if (s[i] == "RE") {
            c[3]++;
        }
    }

    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;

    return 0;
}

Measured memory_bytes: 6424
using System;
using System.Linq;
using System.Text;

namespace ALDS1_2_C {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            string[] A = Console.ReadLine().Split(' ');
            string[] B = (string[])A.Clone();
            string[] stable = A.OrderBy(c => c[1]).ToArray();

            // BubbleSort(A)
            for (int i = 0; i < n; i++) {
                for (int j = n - 1; j > i; j--) {
                    if (A[j][1] < A[j - 1][1]) {
                        string temp = A[j];
                        A[j] = A[j - 1];
                        A[j - 1] = temp;
                    }
                }
            }

            // SelectionSort(B)
            for (int i = 0; i < n; i++) {
                int minj = i;
                for (int j = i; j < n; j++) {
                    if (B[j][1] < B[minj][1])
                        minj = j;
                }
                string temp = B[i];
                B[i] = B[minj];
                B[minj] = temp;
            }
            
            Print(A);
            Console.WriteLine(A.SequenceEqual(stable) ? "Stable" : "Not stable");
            Print(B);
            Console.WriteLine(B.SequenceEqual(stable) ? "Stable" : "Not stable");
        }

        static void Print(string[] arr) {
            StringBuilder sb = new StringBuilder();
            sb.Append(arr[0]);
            for (int i = 1; i < arr.Length; i++) {
                sb.AppendFormat(" {0}", arr[i]);
            }
            Console.WriteLine(sb.ToString());
        }
    }
}

Measured memory_bytes: 9904
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val A = sc.nextInt
    val B = sc.nextInt

    if (A <= 8 && B <= 8)
      "Yay!"
    else
      ":("
  }
}


Measured memory_bytes: 27692
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(A, B):
    return (A * int(B * 1000)) // 1000


if __name__ == "__main__":
    A, B = tuple(input().split(" "))
    print(solve(int(A), float(B)))


Measured memory_bytes: 9476
#include<stdio.h>
int main()
{
    int a,b,c;

    scanf("%d%d%d",&a,&b,&c);

    if(a==b&&a==c){
        printf("No\n");
    }
    else if(a!=b&&a!=c&&b!=c){
        printf("No\n");
    }
    else if(a==b&&a!=c||b==c&&b!=a||a==c&&a!=b){
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 128
#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 EXIST(m,v) (m).find((v)) != (m).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.1415926535897932;
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; }

void Main(){
    int R,C,N; cin >> R >> C >> N;
    VI x, y, n;

    auto check = [&](int x1, int y1, int x2, int y2){
        bool flag1=false, flag2 = false;
        if(x1==0 || x1==R) flag1 = true;
        if(y1==0 || y1==C) flag1 = true;
        if(x2==0 || x2==R) flag2 = true;
        if(y2==0 || y2==C) flag2 = true;
        return flag1 && flag2;
    };

    REP(i,N){
        int a,b,c,d; cin >> a >> b >> c >> d;
        if(check(a,b,c,d)){
            x.push_back(a); y.push_back(b);
            x.push_back(c); y.push_back(d);
            n.push_back(i); n.push_back(i);
        }
    }

    auto c = [&](int i, int j){
        int di = 0, dj = 0;

        if(x[i]==0) di += y[i];
        else if(x[i]==R) di += R+C+(C-y[i]);
        else{
            if(y[i]==0) di += R+C+C+(R-x[i]);
            else di += C+x[i];
        }

        if(x[j]==0) dj += y[j];
        else if(x[j]==R) dj += R+C+(C-y[j]);
        else{
            if(y[j]==0) dj += R+C+C+(R-x[j]);
            else dj += C+x[j];
        }

        return di<dj;
    };

    int K = x.size();
    VI p(K); REP(i,K) p[i] = i;
    sort(ALL(p), c);

    stack<int> stk;
    for(int i : p){
        if(stk.size() && stk.top()==n[i]) stk.pop();
        else stk.push(n[i]);
    }

    cout << (stk.empty() ? "YES" : "NO") << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 6864
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int n;

int main()
{
    read(n);
    std::cout << (n + 1) / 2 << std::endl;
    return 0;
}

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

int main() {
    ll N; cin >> N;
    vector<ll> v(N);
    map<ll, ll> m;
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
        if (m.count(v[i])) m[v[i]] += 1;
        else m[v[i]] = 1;
    }
    // memo
    map<ll, pair<ll, ll>> ans_map;
    ll whole_sum = 0;
    for (auto p: m) {
        ll key = p.first; ll value = p.second;
        if (value <= 1) ans_map[key] = make_pair(0, 0);
        else {
            ll full_value = value * (value-1) / 2;
            ll less_value = (value-1) * (value-2) / 2;
            ans_map[key] = make_pair(full_value, less_value);
            whole_sum += full_value;
        }
    }

    // ans
    for (auto i: v) {
        pair<ll, ll> p = ans_map[i];
        cout << whole_sum - p.first + p.second << endl;
    }
}

Measured memory_bytes: 18944
#include<stdio.h>
#define MAX 100000
#define NIL -1
struct Node {int p, l, r;};
struct Node T[MAX];
int getDepth(int ,int );
void print(int );
int n,D[MAX];

int main()
{
  int i,j,d,v,c,l,r;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      T[i].p=NIL;
      T[i].l=NIL;
      T[i].r=NIL;
    }

  for(i=0;i<n;i++)
    {
      scanf("%d %d",&v,&d);
      
      for(j=0;j<d;j++)
	{
	  scanf("%d",&c);
	  if(j==0)T[v].l=c;
	  else T[l].r=c;
	  l=c;
	  T[c].p=v;
	}
    }
  for(i=0;i<n;i++)
    {
      if(T[i].p==NIL)r=i;
    }
  getDepth(r,0);

  
  for(i=0;i<n;i++)print(i);
  return 0;
}


int getDepth(int u,int p)
{
  D[u]=p;
  if(T[u].r!=NIL)getDepth(T[u].r,p);
  if(T[u].l!=NIL)getDepth(T[u].l,p+1);
}

void print(int u)
{
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d,",T[u].p);
  printf(" depth = %d,",D[u]);

  if(T[u].p==NIL)printf(" root, ");
  else if(T[u].l==NIL)printf(" leaf, ");
  else printf(" internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r)
    {
      if(i)printf(", ");
      printf("%d",c);
    }
  printf("]\n");
}



Measured memory_bytes: 6372
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int N;
    cin >> N;
    long long x[N], y[N], h[N];
    long long X, Y, H;
    rep(i, N){
        scanf("%lld%lld%lld", &x[i],& y[i], &h[i]);
    }
    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            for(int k = 0; k < N; k++){
                if(h[k] != 0){
                    H = h[k] + abs(i - x[k]) + abs(j - y[k]);
                    break;
                }
            }
            for(int k = 0; k < N; k++){
                if(h[k] != 0){
                    if(H != h[k] + abs(i - x[k]) + abs(j - y[k]) )break;
                }else{
                    if(H > abs(i - x[k]) + abs(j - y[k]) )  break;
                }
                if(k == N - 1) cout << i << " " << j << " " << H << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#define endl "\n"
typedef long long int ll;
typedef unsigned long long int ull;
typedef float fl;
typedef long double ld;
using namespace std;
void solve()
{   int n; cin >> n;
    if (n>=30) cout << "Yes";
    else cout << "No";
}

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


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int i[5],a=0;
    for(;a<5;a++)cin>>i[a];
    sort(i,i+5,greater<int>());
    for(a=0;a<4;a++)cout<<i[a]<<' ';
    cout<<i[4]<<endl;
}

Measured memory_bytes: 1176
"use strict"
function main(arg) {
    var W = arg.trim().split("\n")[1].split(" ").map(Number)
    var N = W.length
    var ans = Number.MAX_SAFE_INTEGER
    for (var T = 1; T < N; T++) {
        var s1 = 0
        var s2 = 0
        for (var j = 0; j < N; j++) {
            var w = W[j]
            if (j <= T) {
                s1 += w
            } else {
                s2 += w
            }
        }
        ans = Math.min(ans, Math.abs(s1 - s2))
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372