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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int H, W;
  cin >> H >> W;
  vector<vector<char>> s(H, vector<char>(W));
  vector<vector<bool>> sb(H, vector<bool>(W, false));
  vector<int> x = {0, 0, -1, 1}, y = {1, -1, 0, 0};

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> s[i][j];
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (sb[i][j] == true) {
        continue;
      } else if (s[i][j] == '.') {
        sb[i][j] = true;
      } else {
        for (int k = 0; k < 4; k++) {
          if (i + y[k] >= 0 && i + y[k] < H && j + x[k] >= 0 && j + x[k] < W) {
            if (s[i + y[k]][j + x[k]] == '#') {
              sb[i + y[k]][j + x[k]] = true;
              sb[i][j] = true;
            }
          }
        }
      }
      if (sb[i][j] == false) {
        cout << "No" << '\n';
        return 0;
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cerr << sb[i][j];
    }
    cerr << '\n';
  }

  cout << "Yes" << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int comp(const void *a, const void *b) {
	return *(long int*)a - *(long int*)b;
}
int Min(int a, int b) {
	if (a < b)return a;
	else return b;
}

int main(void) {
	long int n, c, k, t[100000], limit, s, bus = 0;
	scanf("%ld %ld %ld", &n, &c, &k);
	for (int i = 0; i < n; i++) {
		scanf("%ld", &t[i]);
	}
	qsort(t, n, sizeof(long int), comp);

	for (int i = 0;i < n;i = s) {
		limit = t[i] + k;
		s = i;
		while (limit >= t[s] && s < n)s++;
		s = i + Min(s - i, c);
		bus++;
	}
	printf("%d\n", bus);
	
}

Measured memory_bytes: 1788
// abc135_a
// #include <bits/stdc++.h>
#include <iostream>
using namespace std;
 
int main(void){
	long long A, B;
	cin >> A >> B;
	if (A % 2 != B % 2) {
		cout << "IMPOSSIBLE" << endl;
	}
	else {
		cout << (A + B) / 2 << endl;
	}

}

Measured memory_bytes: 256
//g++ main.cpp -I /usr/local/include/ac-library
#include<cmath>

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

stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll N,A;

int main(){
    cin>>N;
    multiset<ll> a;
    rep(i,N) cin>>A, a.insert(A);
    ll ans = 0, two = (1LL<<31);
    while(!a.empty()){
        auto ite = a.end();
        --ite;
        ll comp = *ite;
        a.erase(ite);
        while(two > comp * 2) two /= 2;
        ite = a.find(two - comp);
        if(ite != a.end()){
            ++ans;
            a.erase(ite);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 13012
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;

int main()
{
	string S;
	cin >> S;
	if (S[0] == S[1] && S[1] == S[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
#define maxv 100001
#define che 1LL<<32
#define mod 1000000007
int main()
{
    ll n,l;
    cin>>n>>l;
    ll a[n];
    ll i,j,sum=0;
    for(i=0;i<n;i++)
    {
        a[i]=l+i;
        sum+=a[i];
    }
    ll mini=LLONG_MAX,ans;
    for(i=0;i<n;i++)
    {
        ll x=sum-a[i];
        if(abs(sum-x)<mini)
        {
            mini=abs(sum-x);
            ans=sum-a[i];
        }
    }
    cout<<ans<<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;
using P = pair<int, int>;


int main() {
  int x;
  cin >> x;
  
  if(x >= 30){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


}



Measured memory_bytes: 3636
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // StringTokenizer st = new StringTokenizer(br.readLine());
        // long n = Long.parseLong(st.nextToken());
        String c = br.readLine();
        if(c.charAt(0)=='a' || c.charAt(0)=='e' || c.charAt(0)=='i'|| c.charAt(0)=='o'|| c.charAt(0)=='u')
            System.out.println("vowel");
        else
            System.out.println("consonant");



        
    }
}


Measured memory_bytes: 21076
import math

A, B, H, M = map(int, input().split())

kakudo = 360-abs((60*H+M)*0.5-M*6)
k = math.radians(kakudo)
if(kakudo != 180):
    ans = A**2+B**2-2*A*B*math.cos(k)
    print(ans**0.5)
else:
    print(A+B)

Measured memory_bytes: 9512
#include <stdio.h>

int main()
{
	int n;
	int a[105];
	int deb[2];
	bool app = true;
	scanf("%d", &n);
	for (int i = 0; i != n; i++) 
	{
		scanf("%d", &a[i]);
	}

	for (int i = 0; i != n; i++) 
	{
		if (!(a[i] % 2))
		{
			deb[0] = a[i] % 3;
			deb[1] = a[i] % 5;
			if (!(a[i] % 3)) {
				continue;
			}
			else if (!(a[i] % 5)) {
				continue;
			}
			else {
				app = false;
			}
		}
	}

	app ? printf("APPROVED") : printf("DENIED");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int high[11];
  rep(i,10)cin>>high[i];
  sort(high,high+10);reverse(high,high+10);
  rep(i,3)cout<<high[i]<<endl;
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define int long long
#define F(i,L,R) for(int i=L;i<R;++i)
#define FE(i,L,R) for(int i=L;i<=R;++i)
#define getI(a) scanf("%lld",&a)
#define getII(a,b) scanf("%lld%lld",&a,&b)
#define getIII(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define VgetI(n) int (n); scanf("%lld",&(n))
#define VgetII(n,m) int (n),(m); scanf("%lld%lld",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define qq cout<<"QQ\n";
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define INF 2000000000
main(){
	int n;
	while(~getI(n)) printf("%lld\n",(1000-n%1000ll)%1000);
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 using v_i = vector<int>;
 using v_ll = vector<ll>;
 using v_s = vector<string>;
 const int INF = 2147483647;

 int main(){
     int n;
     cin >> n;
     deque<int> dq;
     rep(i,n){ 
         ll input;
         cin >> input;
         dq.push_back(input);
     }
     ll a=0;
     ll b=0;
     while(!dq.empty()){
        if(a<=b) {
            ll now = dq.front();
            dq.pop_front();
            a+=now;
        }
        else{
            ll now = dq.back();
            dq.pop_back();
            b+=now;
        } 
     }
     cout << abs(a-b) << endl;
     return 0;
 }

     //int nin = *max_element(a.begin(),p.end());
    //int nax = *max_element(a.begin(),p.end())-p.begin();
    //int min_index = min_element(p.begin(),p.end())-p.begin();
     //sort(l.begin(),l.end(),greater<int>());
     //stringは",charは'
     //ちょっとあやしかったら立ち止まって考える
     //例外処理はreturn忘れずに
     //文字列連結 文字+="aa" でできる

Measured memory_bytes: 1024
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))


N,K=rl()
A=rl()

digit = len(format(max(max(A),K),'b'))+1
cnt = [[0,0] for _ in range(digit)]
for i in range(digit):
    for a in A:
        cnt[i][a>>(digit-1-i) & 1] += 1

dp = [[-1,-1] for _ in range(digit)]
dp[0][0]=0

#print(digit)
#print(cnt)


from itertools import product

for i, less in product(range(digit-1),(0,1)):
    if dp[i][less] == -1: continue
    #print('i:{},less:{}'.format(i,less))
    max_d = less or K>>(digit-1-i-1)&1
    #print('max_d',max_d)
    for d in range(max_d+1):
        #print(dp[i][less]*2 + cnt[i+1][1-d])
        dp[i+1][less or d<max_d] = max(dp[i+1][less or d<max_d], dp[i][less]*2 + cnt[i+1][1-d])


print(max(dp[-1]))


Measured memory_bytes: 14620
#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string n;
int sum=0;

// functions
void input(){
	cin >> n;
	return;
}

void solve(){
	for(int i=0; i<n.size(); i++) sum+=n[i]-'0';
	if(sum%9==0) cout << "Yes";
	else cout << "No";
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro

Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>

using namespace std;


int main()
{
	long n;
	cin >> n;
	long answer = 0;
	vector<long> b;
	long minus_answer = 0;
	long min = LONG_MIN;

	for (long i = 0; i < n; i++) {
		long k;
		cin >> k;
		answer += k;
		if (k < 0) {
			b.push_back(-k);
			minus_answer -= k;
		}
		if (min < -abs(k)) min = -abs(k);
	}

	if (b.size() % 2 == 0) {
		cout << answer + 2 * minus_answer << endl;
	}
	else {
		cout << answer + 2 * minus_answer - 2 * abs(min) << endl;
	}



    return 0;
}

Measured memory_bytes: 1400
n = gets.to_i
a = []
n.times{|i| a[i] = gets.to_i }

def a.lis
  l = []
  self.each do |ai|
    next l << ai if l.empty?
    l[-1] >= ai ? l[l.bsearch_index{|x| x >= ai}]=ai : l.push(ai)
  end
  l.length
end

puts a.lis



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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a)
#define INF 1e16
#define mod 1e9+7
//vvll v(n,vll(m)) n行m列
//A.erase(A.begin()+i) 配列Aのi番目を消せる
//std::binary_search(v.bgn,v.en,a);
//abs(a,b)   pow(a,n)  to_string  stoll
//auto Iter=lower_bound(v.bgn,v.en,a);
//lower//upper  co(*Iter)co(Iter-v.bgn);

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n;
  cin>>n;
  V<ldb> v(n);
  FOR(i,0,n){
    cin>>v[i];
  }
  SORT(v);
  ldb bns,ans;
  bns=(v[0]+v[1])/2;
  if(n>2){
  FOR(i,2,n){
    bns=(bns+v[i])/2;
  }
  }
  co(bns);
}


Measured memory_bytes: 256
N,K = map(int,input().split())
dA=[list(map(int,input().split())) for i in range(2*K)]

d = []
A = []
for i in range(2*K):
    if i % 2 == 0:
        d.append(int(dA[i][0]))
    else:
        A.append(dA[i])

A2 = []
for i in range(K):
    for j in range(len(A[i])):
        A2.append(A[i][j])
sets = set(A2)
print(N-len(sets))

Measured memory_bytes: 9220
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N, K;
	cin >> N >> K;
	bool can = true;
	if (N % 2 == 0) {
		if (K > N / 2) {
			can = false;
		}
	}
	else {
		if (K > N / 2 + 1) {
			can = false;
		}
	}
	if (can)cout << "YES" << endl;
	else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
 lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;

    while(t--)
    {
        lld n,x,m;
        cin>>n>>x>>m;
        lld ans=x;
        MOD=m;
        lld a=x;
        map<lld,lld>ar;
        map<lld,lld>br;
        ar[x]=1;
        br[x]=x;
        for(i=2;i<=min(3000000ll,n);i++)
            {
                a=mul(a,a);
                if(a==0)
                    {
                        cout<<ans<<endl;
                        return 0;
                    }
                else
                if(ar[a]!=0)
                    {   //cout<<a<<" "<<ar[a]<<" "<<br[a]<<" "<<i<<endl;
                        ans+=a;
                        lld sum=ans-br[a];
                        lld turn=i-ar[a];
                        lld left=n-i;
                        ans+=(left/turn)*sum;
                        left=left%turn;
                        for(i=0;i<left;i++)
                        {
                            a=mul(a,a);
                            ans+=a;

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

                    }
                else
                    ans+=a,ar[a]=i,br[a]=ans;
            }
        cout<<ans<<endl;
    }
}





Measured memory_bytes: 9788
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> a(n, 0);
    for (ll i = 0; i < q; i++)
    {
        ll tmp;
        cin >> tmp;
        tmp--;
        a[tmp]++;
    }
    for (ll i = 0; i < n; i++)
    {
        ll p = k - (q - a[i]);
        if (p > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

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

using namespace std;
typedef long long ll;
const int Maxn = 1e6 + 5;
int N, Q, M, Cnt;
int A, B, C;
ll Ans;
struct Node
{
    int A, B, C;
    bool operator < (const Node &Temp) const
    {
        return C < Temp.C;
    }
}Edge[Maxn];
int H[Maxn], F[Maxn];

int Find(int X)
{
    if (X == F[X]) return X;
    return F[X] = Find(F[X]);
}

int main()
{
    memset (H, 127, sizeof H);
    scanf ("%d %d", &N, &Q);
    for (int i = 1; i < N; ++i) F[i] = i;
    for (int i = 0; i < Q; ++i)
    {
        scanf ("%d %d %d", &A, &B, &C);
        Edge[++Cnt] = Node{A, B, C};
        H[A + 1] = min(H[A + 1], C + 1);
        H[B + 1] = min(H[B + 1], C + 2);
    }
    for (int i = 1; i < (N << 1); ++i) H[i] = min(H[i], H[i - 1] + 2);
    for (int i = 1; i < (N << 1); ++i)
    {
        A = i % N, B = (i - 1) % N;
        Edge[++Cnt] = Node{A, B, H[i]};
    }
    sort (Edge + 1, Edge + Cnt + 1);
    for (int i = 1; i <= Cnt; ++i)
    {
        A = Edge[i].A, B = Edge[i].B, C = Edge[i].C;
        int FA = Find(A), FB = Find(B);
        if (FA != FB) Ans += C, F[FA] = FB;
    }
    printf ("%lld\n", Ans);
}

Measured memory_bytes: 15528
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i % k == 0) return cout << "OK", 0;
    }
    cout << "NG";

    return 0;

}


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

int toIdx(char s){
    if(s == 'S') return 0;
    if(s == 'H') return 1;
    if(s == 'C') return 2;
    if(s == 'D') return 3;
}

char toSuit(int i){
    if(i == 0) return 'S';
    if(i == 1) return 'H';
    if(i == 2) return 'C';
    if(i == 3) return 'D';
}

int main(){
    string sep = "####################";
    int n;
    cin >> n;
    int rooms[4][3][10] = {0};
    for(int i =0;i<n;++i){
        int b,f,r,v;
        cin >> b >> f >> r >> v;
        rooms[b-1][f-1][r-1] += v;
    }

    for(int i=0;i<4;++i){
        if(i != 0) cout << sep << endl;
        for(int j=0;j<3;++j){
            for(int k=0;k<10;++k){
                cout << " " << rooms[i][j][k];
            }
            cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3180
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] abc = sc.next().toCharArray();
    if (abc[0] == abc[1] && abc[1] == abc[2]) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }
  }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	string S,T;
  	cin>>S>>T;
  	int count=0;
  	rep(i,S.size()){
     	if(S[i]!=T[i])count++;
    }
  
  	cout<<count<<endl;
}

Measured memory_bytes: 3916
#include<bits/stdc++.h>
#define N 2005
using namespace std;
char s[N];
int n,m,q;
int c[N][N];
int hl[N][N],zl[N][N];
int pre[N][N],pred[N][N];
int xx[4]={-1,0,1,0},yy[4]={0,-1,0,1};
void prework(){
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			pre[i][j]=pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1]+c[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if(c[i][j]==0) continue;
			for(int k=0;k<4;k++){
				int nr=i+xx[k],nc=j+yy[k];
				if(1<=nr&&nr<=n&&1<=nc&&nc<=m&&c[nr][nc]==1){
					pred[i][j]++;
					if(k==2) hl[i][j]++;
					else if(k==3) zl[i][j]++;
				}
			}
		}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			pred[i][j]+=pred[i-1][j]+pred[i][j-1]-pred[i-1][j-1],
			hl[i][j]+=hl[i][j-1],zl[i][j]+=zl[i-1][j];
}
int query(int cl,int cr,int rt,int rb){
	int totc=0,totd=0;
	totc=pre[rb][cr]-pre[rb][cl-1]-pre[rt-1][cr]+pre[rt-1][cl-1];
	totd=pred[rb][cr]-pred[rb][cl-1]-pred[rt-1][cr]+pred[rt-1][cl-1];
	totd-=hl[rt-1][cr]-hl[rt-1][cl-1];
	totd-=hl[rb][cr]-hl[rb][cl-1];
	totd-=zl[rb][cl-1]-zl[rt-1][cl-1];
	totd-=zl[rb][cr]-zl[rt-1][cr];
	
	return totc-totd/2;
}
int main(){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++){
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
			c[i][j]=s[j]-'0';
	}
		
	prework();
	for(int i=1;i<=q;i++){
		int cl,cr,rt,rb;
		scanf("%d%d%d%d",&rt,&cl,&rb,&cr);
		printf("%d\n",query(cl,cr,rt,rb));
	}
	return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define um(a,b) unordered_map<a,b>
#define vv(a) vector<a>
#define pp(a,b) pair<a,b>
int main(){
FIO
   char ch;
   cin>>ch;
   if(ch>='a'&&ch<='z'){
    cout<<"a"<<endl;
   }else{
    cout<<"A"<<endl;
   }

}


Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;

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

  	bool flag1 = true;
    bool flag2 = false;
    for (int i = 0; i < T.size(); i++) {
        for (int j = i + S.size() - T.size(); j >= i ; j--) {
            flag1 = true;
            if (T[i] == S[j] || S[j] == '?') {
                for (int k = j - i; k < j + T.size(); k++) {
                    if (T[k - j + i] == S[k] || S[k] == '?') {
                        continue;
                    } 
                    else {
                        flag1 = false;
                        break;
                    }
                }
                if (flag1) {
                    for (int k = j - i; k < j + T.size(); k++) { 
                        S[k] = T[k - j + i];
                    }
                    flag2 = true;
                    i += 100;
                }
            }
        }
    }

    if (flag2) {
        for (int i = 0; i < S.size(); i++) {
            if (S[i] == '?') {
                S[i] = 'a';
            }
        }
        cout << S << endl;
    }
    else {
        cout << "UNRESTORABLE" << endl;
    }
}

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

class UnionFind {
  public:
    UnionFind(int n = 0) {
      init(n);
    }
    void init(int n) {
      p_.resize(n);
      std::iota(p_.begin(), p_.end(), 0);
    }
    int find(int x) {
      if (x == p_[x]) return x;
      return p_[x] = find(p_[x]);
    }
    void unite(int x, int y) {
      x = find(x);
      p_[x] = find(y);
    }
  private:
    std::vector<int> p_;
};

int main() {
  int n, m, k;
  std::vector<std::vector<int>> l, inv;
  std::cin >> n >> m;
  l.resize(n);
  inv.resize(m);
  for (int ni = 0; ni < n; ++ni) {
    std::cin >> k;
    l[ni].resize(k);
    for (int ki = 0; ki < k; ++ki) {
      std::cin >> l[ni][ki];
      inv[l[ni][ki] - 1].push_back(ni);
    }
  }
  UnionFind uf(n);
  for (int mi = 0; mi < m; ++mi) {
    if (not inv[mi].empty()) {
      for (std::size_t ii = 1; ii < inv[mi].size(); ++ii) {
        uf.unite(inv[mi][0], inv[mi][ii]);
      }
    }
  }
  for (int ni = 1; ni < n; ++ni) {
    if (uf.find(0) != uf.find(ni)) {
      std::cout << "NO" << std::endl;
      return 0;
    }
  }
  std::cout << "YES" << std::endl;
  return 0;
}

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

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

LIST = [[0, 0] for _ in range(N)]
WA = 0
AC = 0
for i in range(M):
    P, S = input().split()
    if LIST[int(P)-1][0] == 0:
        if S == "AC":
            LIST[int(P)-1][0] = 1
        else:
            LIST[int(P)-1][1] += 1
for i in range(N):
    if LIST[i][0] == 1:
        AC += 1
        WA += LIST[i][1]
print("{} {}".format(AC, WA))


Measured memory_bytes: 13172
#include<iostream>
#include<list>
#include<vector>
#include<string>
#include<cmath>

using namespace std;

int main(){
  	int n;
    cin >> n;
	vector<int> p(n, 0);
  	for (int i = 0; i < n; i++){
      cin >> p[i];
    }
    int count = 0;
  
    for (int i = 0; i < n-2; i++){
      bool conditionA = p[i+1] > p[i] && p[i+1] < p[i+2];
      bool conditionB = p[i+1] < p[i] && p[i+1] > p[i+2];
      if (conditionA || conditionB){
        count++;
      }
    }
  
    cout << count << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <tuple>

int main() {
  size_t M, N;
  scanf("%zu %zu", &M, &N);

  std::vector<std::string> C(M);
  std::vector<std::vector<std::pair<size_t, size_t>>> pos(26);
  int alph = 1 << 27;
  for (size_t i = 0; i < M; ++i) {
    char buf[512];
    scanf("%s", buf);
    C[i] = buf;
    for (size_t j = 0; j < N; ++j) {
      if (C[i][j] != '.') {
        int a = C[i][j] - 'A';
        pos[a].emplace_back(i, j);
        alph |= 1 << a;
      }
    }
  }

  std::vector<std::vector<int>> flags(26);
  for (size_t k = 0; k < 26; ++k) {
    if (pos[k].empty()) {
      flags[k] = {1 << 27};
      continue;
    }
    size_t imax, imin, jmax, jmin;
    std::tie(imin, imax) = std::minmax(pos[k][0].first, pos[k][1].first);
    std::tie(jmin, jmax) = std::minmax(pos[k][0].second, pos[k][1].second);
    size_t di = imax - imin;
    size_t dj = jmax - jmin;

    if (di + dj == 1) {
      flags[k] = {1 << 27};
      continue;
    }

    if (imax == imin) {
      int f = 0;
      for (size_t j = jmin+1; j < jmax; ++j) {
        if (C[imin][j] != '.')
          f |= 1 << (C[imin][j] - 'A');
      }
      flags[k].push_back(f);
    } else if (jmax == jmin) {
      int f = 0;
      for (size_t i = imin+1; i < imax; ++i) {
        if (C[i][jmin] != '.')
          f |= 1 << (C[i][jmin] - 'A');
      }
      flags[k].push_back(f);
    } else {
      int f0 = 0;
      int f1 = 0;
      int f2 = 0;
      int f3 = 0;

      for (size_t j = jmin+1; j < jmax; ++j) {
        if (C[imin][j] != '.') f0 |= 1 << (C[imin][j] - 'A');
        if (C[imax][j] != '.') f1 |= 1 << (C[imax][j] - 'A');
      }
      for (size_t i = imin+1; i < imax; ++i) {
        if (C[i][jmin] != '.') f2 |= 1 << (C[i][jmin] - 'A');
        if (C[i][jmax] != '.') f3 |= 1 << (C[i][jmax] - 'A');
      }

      if (pos[k][0].second < pos[k][1].second) {
        flags[k] = {f0|f3, f1|f2};
        if (C[imin][jmax] != '.') flags[k][0] |= 1 << (C[imin][jmax] - 'A');
        if (C[imax][jmin] != '.') flags[k][1] |= 1 << (C[imax][jmin] - 'A');
      } else {
        flags[k] = {f0|f2, f1|f3};
        if (C[imin][jmin] != '.') flags[k][0] |= 1 << (C[imin][jmin] - 'A');
        if (C[imax][jmax] != '.') flags[k][1] |= 1 << (C[imax][jmax] - 'A');
      }
    }
  }

  // for (int i = 0; i < 26; ++i) {
  //   for (auto& fs: flags[i]) {
  //     fprintf(stderr, "%c:", 'A'+i);
  //     for (int j = 0; j < 26; ++j) {
  //       if (fs >> j & 1)
  //         fprintf(stderr, " %c", 'A'+j);
  //     }
  //     fprintf(stderr, "\n");
  //   }
  // }

  int res = 0;
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < 26; ++j) {
      if (!(alph >> j & 1)) continue;
      for (int rm: flags[j]) {
        if (rm & alph) continue;
        alph ^= 1 << j;
        // fprintf(stderr, "Removed %c\n", 'A'+j);
        res += 2;
        flags[j].clear();
        break;
      }
    }
  }

  printf("%d\n", res);
}



Measured memory_bytes: 3112
def resolve():
    n, k = map(int, input().split())
    g = list(map(int, input().split()))
    disc = [-1]*(n+1)
    s = []
    v = 1
    c = 0
    while disc[v] == -1:
        disc[v] = len(s)
        s.append(v)
        v = g[v-1]
        c = len(s) - disc[v]
    l = len(s)
    if l > k:
        print(s[k])
    else:
        r = (k - disc[v]) % c
        for i in range(r):
            v = g[v-1]
        print(v)
resolve()

Measured memory_bytes: 32388
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
l=[]
for i in range(N):
    l.append([A[i],3])
    l.append([B[i],2])
    l.append([C[i],1])
l.sort()
a=0
c=N
s=0
for i in range(3*N):
    if l[i][1]==3:
        a+=1
    elif l[i][1]==2:
        s+=a*c
    else:
        c-=1
print(s)

Measured memory_bytes: 129260
let () =
    let (w, h, x, y, r) = 
    	Scanf.sscanf(read_line()) "%d %d %d %d %d" (fun a b c d e -> ( a, b, c, d, e) ) in
    let is_within = x - r >= 0 && y - r >= 0 && x + r <= w && y + r <= h in
    Printf.printf "%s\n" (if is_within then "Yes" else "No")


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

int main()
{
	double a,b,f;
	int c, d,e,r;
	cin >> a >> b;
	c = a; e = b;

	d = c / e;
	r = c%e;
	f = a / b;

	printf("%d ",d);
	printf("%d ",r);
	printf("%.8lf\n",f);

	return 0;
}

Measured memory_bytes: 3280
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;

int euqlid(int a, int b){
 int tmp;
 if(a>b){
  tmp=a;
  a=b;
  b=tmp;
 }
 if(a<=0)return b;
 
 return euqlid(a,b%a);
}

int main(void){
 int a,N,ans;
 vector<int> A;
 cin>>N;
 for(int i=0; i<N; i++){
  cin>>a;
  A.push_back(a);
 }
 ans=A[0]; 
 for(int i=1; i<N; i++){
  ans=euqlid(ans,A[i]); 
 }
 cout<<ans<<endl;
 return 0;
}

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

int calS(int field[5][5],int si,int sj){
	int max = 0;

	for(int width=5-sj;width>0;width--){
		int S = 0;
		bool flg = true;

		for(int i=si;flg && i<5;i++){
			for(int j=sj;j<sj+width;j++){
				if(field[i][j] == 0){
					flg = false;
					break;
				}
			}
			if(flg) S += width;
			else break;
		}

		if(max < S) max = S;
	}

	return max;
}

int solve(int field[5][5]){
	int max = 0;

	for(int i=0;i<5;i++){
		for(int j=0;j<5;j++){
			if(field[i][j] == 1){
				int S = calS(field,i,j);
				if(S > max) max = S;
			}
		}
	}
	return max;
}

int main(void){
	int n;
	int field[5][5];

	cin>>n;
	while(n--){
		for(int i=0;i<5;i++){
			for(int j=0;j<5;j++){
				cin>>field[i][j];
			}
		}

		cout<<solve(field)<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string s;
  cin >> s;
  rep(i,sz(s)) {
    cout << "x";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())

from collections import defaultdict
cost = [[float("inf") for i in range(10)] for j in range(10)]
for i in range(10):
    cl = list(map(int,input().split()))
    for j in range(10):
        cost[i][j] = cl[j]

# cost[i][j]: 頂点v_iから頂点v_jへ到達するための辺コストの和
for k in range(10):
    for i in range(10):
        for j in range(10):
            cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])

ans = 0
for _ in range(h):
    al = list(map(int,input().split()))
    for a in al:
        if a == -1:
            continue
        ans += cost[a][1]

print(ans)

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

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<int> vec(N, -1);
    int flag_err = 0;
    for(int i=0; i<M; i++) {
        int s, c;
        cin >> s >> c;
        if(vec.at(N-s) == -1) {
            vec.at(N-s) = c;
        } else if(vec.at(N-s) != c) {
            flag_err = 1;
            break;
        }
    }

    for(int i=0; i<N-1; i++)
        if(vec.at(i) == -1) vec.at(i) = 0;
    if(N>=2) {
        if(vec.at(N-1) == -1) vec.at(N-1) = 1;
        if(vec.at(N-1) == 0) flag_err = 1;
    } else {
        if(vec.at(N-1) == -1) vec.at(N-1) = 0;
    }

    int ans = -1, pw = 1;
    if(flag_err == 0) {
        ans = 0;
        for(int i=0; i<N; i++) {
            ans += vec.at(i) * pw;
            pw *= 10;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define end cout<<'\n';
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll n,k;
    cin>>n>>k;
    ll a[n];
    f(i,n)
        cin>>a[i];
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(ll i=2;i<n;i++)
    {
        dp[i]=INT_MAX;
        for(ll j=1;j<=k;j++)
        {
            if((i-j)<0)
                break;
            ll x=(dp[i-j]+abs(a[i]-a[i-j]));
            dp[i]=min(dp[i],x);
        }
    }
    //f(i,n)
   //     cout<<dp[i]<<' ';
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <utility> // pair のため
#include <algorithm> // sort のため
#include <iostream>
using namespace std;

int T, N, K, X[100000+10], A[100000+10];
int main() {
    cin >> T; // データセットの数を読み込む
    for (int t=0; t<T; ++t) {
        // 家と発電機の数を読み込む
         cin >> N >> K;
        for (int i=0; i<N; ++i) cin >> X[i]; // 家の位置を入力
        for (int i=0; i<100010;i++) A[i]=0; //init A
        for (int i=1; i<N; ++i) A[i-1] = X[i]-X[i-1]; // 家と家の間
        // 配列 A を整列する
        sort(A ,A+N-1);
        // 配列 A の先頭 max(0,N-1-(K-1)) 個の和を出力する
        int ans = 0;
        int temp = N - K;
        if (temp > 1) {
            for (int i=0; i<temp; ++i){
                ans += A[i];
            }
        }
        else if (temp == 1) {            
        ans = A[0];    
        }
        
        else {
            ans = 0;
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3876
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {

    ll A,B;
    cin >> A >> B;
    ll out = B-A;
    if(B%A==0) out = A+B;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
//    ? WHY YOU OPEN THIS ?    //
 
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
#define PAIR    pair<int,int>
#define Vector  vector<int>
#define MAP     map<int,int>
#define pb      push_back
#define mk      make_pair
#define MOD     1e9+7 
#define all(a)  begin(a),end(a)
#define F       first
#define S       second
 
#define FOR(i, a, b)     for(int i = a; i < b; i++)
#define ROF(i, a, b)     for(int i = a; i>= b; i--)
#define check(c)       cout<<#c<<" : "<<c<<endl;
#define check2(a, b)    cout<<#a<<" : "<<a<<" | "<<#b<<" : "<<b<<endl;
#define check3(a, b, c)  cout<<#a<<" : "<<a<<" | "<<#b<<" : "<<b<<" | "<<#c<<" : "<<c<<endl;
#define SWIFT          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

void testCase(){
    // int n; cin >> n;
    // int a[n]; FOR(i, 0, n) cin >> a[i];

	int n; cin >> n;
	int a[n]; FOR(i, 0, n) cin >> a[i];

	int ans = 0;
	FOR(i, 0, n){
		FOR(j, i + 1, n){
			FOR(k, j + 1, n){
				// int b[3] = {a[i], a[j], a[k]}
				if(a[i] + a[j] > a[k]  and a[j] + a[k] > a[i] and a[k] + a[i] > a[j] and a[i] != a[j] and a[j] != a[k] and a[i] != a[k]){
					ans += 1;
					// check3(i, j, k)
				}
				// sort(b, b + 3);
				// if(b[0] != b[1] and )
			}
		}
	}

	cout << ans << endl;
}
 
signed main(){
    SWIFT;
    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    int t = 1;
    // int t; cin >> t;
    while(t--){
        testCase();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

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

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int R, G, B, N;

int main(){
  cin >> R >> G >> B >> N;

  ll ans = 0;
  REP(r, N / R + 1) {
    REP(g, N / G + 1) {
      ll rem = N - r * R - g * G;
      if(rem >= 0 && rem % B == 0){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int A,B,C,D,E,F,q,x,y;
    cin>>A>>B>>C>>D>>E>>F;
    cin>>q;
    for (int i=0;i<q;i++) {
        cin>>x>>y;
        if (x==A&&y==B) {
            cout<<C<<endl;
        } else if (x==A&&y==C) {
            cout<<E<<endl;
        } else if (x==A&&y==D) {
            cout<<B<<endl;
        } else if (x==A&&y==E) {
            cout<<D<<endl;
        } else if (x==B&&y==A) {
            cout<<D<<endl;
        } else if (x==B&&y==C) {
            cout<<A<<endl;
        } else if (x==B&&y==D) {
            cout<<F<<endl;
        } else if (x==B&&y==F) {
            cout<<C<<endl;
        } else if (x==C&&y==A) {
            cout<<B<<endl;
        } else if (x==C&&y==B) {
            cout<<F<<endl;
        } else if (x==C&&y==E) {
            cout<<A<<endl;
        } else if (x==C&&y==F) {
            cout<<E<<endl;
        } else if (x==D&&y==A) {
            cout<<E<<endl;
        } else if (x==D&&y==B) {
            cout<<A<<endl;
        } else if (x==D&&y==E) {
            cout<<F<<endl;
        } else if (x==D&&y==F) {
            cout<<B<<endl;
        } else if (x==E&&y==A) {
            cout<<C<<endl;
        } else if (x==E&&y==C) {
            cout<<F<<endl;
        } else if (x==E&&y==D) {
            cout<<A<<endl;
        } else if (x==E&&y==F) {
            cout<<D<<endl;
        } else if (x==F&&y==B) {
            cout<<D<<endl;
        } else if (x==F&&y==C) {
            cout<<B<<endl;
        } else if (x==F&&y==D) {
            cout<<E<<endl;
        } else if (x==F&&y==E) {
            cout<<C<<endl;
        }
    }
    
}



Measured memory_bytes: 3076
/* 
 Author:N_o_o_B 
 Created:September 28 2019 17:07:59
*/
#include <bits/stdc++.h>
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define endl '\n'
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    int k;
    cin >> k;
    vi h(n);
    fori(i,n) cin >> h[i];
    int ans=0;
    fori(i,n) ans+=(h[i]>=k);
    cout << ans << endl;



    time_taken();
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int main() {
	int bal,x,c[4],k[4],a[4]={1,5,10,50},flag=0;
	while(1){
		cin>>bal;
		bal=bal*-0.1;
		if(bal==0)return 0;
		if(flag==1)cout<<endl;
		cin>>c[0]>>c[1]>>c[2]>>c[3];
		for(int i=0;i<3;i++){
			if(bal>=0)x=(a[i+1]-bal%a[i+1])/a[i];
			else x=bal%a[i+1]*-1/a[i];
			if(c[i]>=x){
				k[i]=x;
				while(k[i]<=c[i]-a[i+1]/a[i])k[i]+=a[i+1]/a[i];
				bal+=a[i]*k[i];
			}
			else{
				k[i]=0;
				bal-=(a[i+1]/a[i]-x)*a[i];
			}
		}
		if(bal<0)k[3]=(bal-49)/50*-1;
		else k[3]=0;
		for(int i=0;i<4;i++){
			if(k[i]==0)continue;
			else cout<<a[i]*10<<" "<<k[i]<<endl;
		}
		flag=1;
	}
} 

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
    int h, w;
    int i, j;

    while (1){
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0){
            break;
        }else{
            /*1行目*/
            for (j = 1; j <= w; j++){
                printf("#");
            }
            printf("\n");
            /*2 ~ (h -1) 行目*/
            for (i = 2; i <= h - 1; i++){
                printf("#");
                for (j = 2; j <= w - 1; j++){
                    printf(".");
                }
                printf("#\n");
            }
            /*h行目*/
            for (j = 1;j <= w; j++){
                printf("#");
            }
            printf("\n\n");
        }
    }

    return 0;
}

Measured memory_bytes: 1016
// ALDS1_1_C 素数

#include <iostream>
#include <math.h>

using namespace std;

bool IsPrime(int);

int main()
{
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++){
    int inputNum;
    cin >> inputNum;
    if (IsPrime(inputNum))
      ans++;
  }

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

bool IsPrime(int num){
  if (num == 2)
    return true;
  if (!(num % 2))
    return false;
  int max = (int)sqrt(num);
  for (int i = 3; i <= max; i += 2){
    if (!(num % i)) return false;
  }
  return true;
}



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

int main() {
  long long a,b,k;
  cin>>a>>b>>k;
  if(k<=a)cout<<a-k<<" "<<b<<endl;
  else if(k<a+b)cout<<0<<" "<<a+b-k<<endl;
  else cout<<0<<" "<<0<<endl;
}

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

#define MAX_N 100005

int n ,k;
vector <int> adj[MAX_N];

int ans = 0;
int dfs(int u ,int p=1){
	int mx = 0;
	for(int v : adj[u]) 
		mx = max(mx ,dfs(v ,u));
	//cout << u << " = " << mx << endl;
	if(mx+1 == k && p != 1){
		ans++;
		return -1;
	}
	return mx+1;
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int p,i=1; i<=n; i++){
		scanf("%d",&p);
		if(i == 1)
			ans += (p != 1);
		else
			adj[p].push_back(i);
	}
	
	dfs(1);
	printf("%d\n",ans);
}


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

int main()
{
	int N;
	cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; i++)
	{
		cin >> H[i];
	}
	int ans = 0;
	int i = 0;
	while (i < N)
	{
		vector<int> part;
		part.push_back(H[i]);
		while (i < N - 1 && H[i+1] <= H[i])
		{
			part.push_back(H[i + 1]);
			i++;
		}
		for (int i = 0; i < part.size(); i++)
		{
			cerr << part[i] << " ";
		}
		int n = part.size()-1;
		cerr <<"n= " << n << endl;
		ans = max(ans, n);
		i++;
	}	
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n,num;
	string s;
	list<int> A;
	cin>>n;
	for(int i = 1 ;i <= n ; i++){
		cin>>s;
		if(s[0]=='i') {
			cin>>num;
			A.push_front(num);
		}
		else if(s[6]=='F') A.pop_front();
		else if(s[6]=='L') A.pop_back();
		else if(s[0]=='d'){
			cin>>num;
			for(list<int>::iterator it=A.begin();it!=A.end();it++){
				if(*it==num) {
					A.erase(it);
					break;
				}
			}
		}

	}
	int i =0;
	for(list<int>::iterator it=A.begin();it!=A.end();it++){
		if(i++) cout<<" ";
		cout<<*it;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 34240