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

string longestCommonSubsequence(string &s1, string &s2){

    int n = s1.size(), m = s2.size();
    // When building the answer, use the DP table itself
    // For each state check from which state we have arrived to the current state
    // If arrived from a diagonal state that means we need to include the
    // current character
    int dp[n+1][m+1];
    for(int i=0; i<=n; i++)
        dp[i][0] = 0;
    for(int j=0; j<=m; j++)
        dp[0][j] = 0;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++){
            if(s1[i-1] == s2[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }

    // Now we need to build the actual answer
    // Start from last cell
    // and check from which cell we reached that cell

    string ans;
    int i = n, j = m;
    while(i>0 and j>0){
//        if(dp[i][j] == dp[i-1][j])
//            i--;
//        else if(dp[i][j] == dp[i][j-1])
//            j--;
//        else{
//            // That means we have reached here from diagonally so include the
//            // current character
//            ans.push_back(s1[i-1]);
//            i--;
//            j--;
//        }
        if(s1[i-1]==s2[j-1]){
            // That means we have reached here from diagonally so include the
            // current character
            ans.push_back(s1[i-1]);
            i--;
            j--;
        }
        else if(dp[i][j] == dp[i-1][j])
            i--; // We have come here from the above row
        else
            j--;
    }

    reverse(ans.begin(), ans.end());
    return ans;
}

int main()
{
 string s1, s2;
 cin>>s1>>s2;
 string ans = longestCommonSubsequence(s1, s2);
 cout<<ans;
 return 0;
}



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

std::vector<int> vec;
int n, a, sum = 0;
bool all_10 = true;

int main() {
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> a;
        if (a % 10 != 0) {
            all_10 = false;
        }
        sum += a;
        vec.push_back(a);
    }
    if (all_10) {
        std::cout << 0 << std::endl;
        return 0;
    }
    if (sum % 10 != 0) {
        std::cout << sum << std::endl;
        return 0;
    }
    std::sort(vec.begin(), vec.end());
    for (int j = 0; j < n; j++) {
        if (vec[j] % 10 != 0) {
            sum -= vec[j];
            break;
        }
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := n

	var s int
	for ; m > 0; m /= 10 {
		s += m % 10
	}
	if s == 0 {
		fmt.Println("No")
	}
	if n%s == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)


class z_algotirhm{
	private:
		int n;
		int z_table[2000001];
	public:
		z_algotirhm(){}
		void make_array(const string &S){
			n = S.size();
			int l=0,r=0;
			z_table[0]=n;
			for(int k=1; k<n; k++){
				if(k>r){
					int i;
					for(i=0; i+k<n; i++)if(S[i]!=S[k+i])break;
					z_table[k]=i;
					if(r<i+k-1){
						r=i+k-1;
						l=k;
					}
				}else{
					if(z_table[k-l]<r-k+1){
						z_table[k]=z_table[k-l];
					}else{
						int i;
						for(i=0; i+k<n; i++)if(S[i]!=S[k+i])break;
						z_table[k]=i;
						if(r<i+k-1){
							r=i+k-1;
							l=k;
						}
					}
				}
			}
		}
		void find(const string &P, const string &T, vector<int>& ans){
			int m = P.size();
			string S = P+"$"+T;
			make_array(S);
			for(int k=m; k<n; k++){
				if(z_table[k]>=m)ans.push_back(k);
			}
		}
		int get(int id){return z_table[id];}
};

void Zsearch(const std::string& T, const std::string& P, std::vector<int>& ans){
	std::string S = P + "$" + T;
	std::vector<int> z(S.length(), 0);
	int L = 0, R = 0;
	for(int i=1; i<S.length(); i++){
		if(i>R){
			L = R = i;
			while(R<S.length() && S[R-L] == S[R]) R++;
			z[i] = R-L;
			R--;
		}else{
			int k = i-L;
			if(z[k] < R-i+1){
				z[i] = z[k];
			}else{
				L = i;
				while(R<S.length() && S[R-L] == S[R]) R++;
				z[i] = R-L;
				R--;
			}
		}
	}
	
	for(int i=P.length()+1; i<S.length(); i++){
		if(z[i] == P.length()){
			ans.push_back( i-(P.length()+1) );
		}
	}
}

string t,p;
vector<int> ans;

void init(){
	cin>>t>>p;
}

int main(void){
	init();
	Zsearch(t,p,ans);
	rep(i,ans.size())cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 13308
#include <bits/stdc++.h>
using namespace std;
#define ll long long int



int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> p(n);
    for(ll i = 0; i < n; i++) cin >> p[i];
    vector<double> exp(n);
    for(ll i = 0; i < n; i++){
        exp[i] = (p[i] + 1) / 2.0;
    }
    double ans = 0;
    for(ll i = 0; i < k; i++) ans += exp[i];
    double temp = ans;
    for(ll i = 1; i + k - 1 < n; i++){
        temp -= exp[i - 1];
        temp += exp[i + k - 1];
        ans = max(ans, temp);
    }

    printf("%.10f\n", ans);


}

Measured memory_bytes: 3328
m, d = gets.split.map(&:to_i)

ans = 0
(1..m).each do |i|
  (1..d).each do |j|
    d1 = j/10
    d10 = j%10
    if d1 >= 2 && d10 >= 2 && i == d1 * d10
      ans += 1
    end
  end
end

puts ans


Measured memory_bytes: 3836
#include <stdio.h>

int hindo[101] = {0};

int main(void){
  int a, b, c;
  int cnt = 0;
  scanf("%d %d %d", &a, &b, &c);
  hindo[a] = 1, hindo[b] = 1, hindo[c] = 1;
  for (int i = 1; i <= 100; i++){
    if(hindo[i] == 1) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
  

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

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

//dp[i][j] i個目までの魔法を使ってjの体力を削るのに必要な魔力
const int INF = 1000000000;

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

    vector<int> dp(h+1, INF);
    dp[0] = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        rep(j,h){
            int nj = min((int)j+a,h);
            dp[nj] = min(dp[nj], dp[j]+b);
        }
    }

    cout << dp[h] << endl;

    return 0;
}  

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

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

  int n; cin >> n;
  string ans = "";

  if(n == 0) {
    cout << '0' << '\n';
    return 0;
  }
  while(n != 0) {
    if(n%2 != 0) {
      --n;
      ans += "1";
    } else {
      ans += "0";
    }
    n /= -2;
  }
  reverse(ans.begin(), ans.end());

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a,b,x=0;String s;
        while(true){
            a=sc.nextInt();s=sc.next();b=sc.nextInt();
            switch(s.charAt(0)){
                case '+':x=a+b;break;
                case '-':x=a-b;break;
                case '*':x=a*b;break;
                case '/':x=a/b;break;
                default:System.exit(0);
            }
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 26300
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define f(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n];
  f(i,0,n){
    cin>>a[i];
  }

ll dp[100010];
f(i,0,100010){
  dp[i]=0;
}

dp[0]=0;
f(i,0,n){
dp[a[i]]=1;
}


f(i,1,k+1){
  if(dp[i]==0){
    f(j,0,n){
      if(i-a[j]>=0&&dp[i-a[j]]==0){
        dp[i]=1;
        break;
      }
    }
  }
}

cout<<((dp[k]==1)?"First":"Second")<<endl;


}

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

using namespace std;
long long n,a,s[405],dp[405][405];
int main()
{
    for(int i=0; i<=404; i++)
        for(int j=0; j<=404; j++)
            dp[i][j]=1e17;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a;
        s[i]=s[i-1]+a;
    }
    for(int l=0; l<=n; l++)
        for(int i=1; i<=n-l+1; i++)
            for(int k=i; k<=i+l-1; k++)
            {
                if(l==1)
                    dp[i][i]=0;
                else
                    dp[i][i+l-1]=min(dp[i][i+l-1],dp[i][k]+dp[k+1][i+l-1]+s[i+l-1]-s[i-1]);
            }
    cout<<dp[1][n];
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) cin >> d.at(i);
  sort(d.begin(), d.end());
  cout << d.at(N/2) - d.at(N/2 - 1) << endl;
  return 0;
}


Measured memory_bytes: 640
/**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_C
 */
#include <iostream>
#include <string>
#include <list>

using namespace std;

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

    int n;
    cin >> n; cin.ignore();

    list<int> lst;
    for (int i = 0; i < n; i++) {
        string cmd;
        getline(cin, cmd);

        switch (cmd[6]) {
          case 'F':
            lst.pop_front();
            break;
          case 'L':
            lst.pop_back();
            break;
          default:
            int k = stoi(cmd.substr(7));
            if(cmd[0] == 'i') {
                lst.push_front(k);
            } else {
                for (auto it = lst.cbegin(); it != lst.cend(); it++) {
                    if (*it == k) {
                        lst.erase(it);
                        break;
                    }
                }
            }
        }
    }
    for (auto it = lst.begin(); it != lst.end(); it++) {
        if (it != lst.begin()) { cout << ' '; }
        cout << *it;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 34380
#include <iostream>
#include <math.h>
using namespace std;
int main() {
	bool can = false;
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if (abs(a - c) <= d) {
		can = true;
	}
	if (abs(a - b) <= d && abs(b - c) <= d) {
		can = true;
	}

	if (can) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def s()
  gets().chomp
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end

def calc(num, ope)
  first=num[0]
  3.times{|i|
    if ope[i] == "+"
      first += num[i+1]
    elsif ope[i] == "-"
      first -= num[i+1]
    end
  }
  first.to_i
end

num = s().split("").map(&:to_f)
ope = ["+", "-"]
2.times{|i|
  2.times{|j|
    2.times{|k|
      if calc(num, [ope[i], ope[j], ope[k]]) == 7
        res = num[0].to_i.to_s
        res += ope[i] + num[1].to_i.to_s
        res += ope[j] + num[2].to_i.to_s
        res += ope[k] + num[3].to_i.to_s
        puts res+"=7"
        exit
      end
    }
  }
}


Measured memory_bytes: 2044
#include<iostream>
using namespace std;
    long long n,a,b;
int main()
{
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b)
        cout<<(n-2)*(b-a)+1<<endl;
    else
        cout<<"0"<<endl; 
 } 
 //lx好帅

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

int main(){
    int h, w;cin>>h>>w;
    int total = h + w - 1;
    int acc = 0;
    for (int i=0;i<h;i++){
        string temp;
        cin >> temp;
        for (int j=0;j<w;j++){
            if(temp[j] == '#'){
                acc++;
            }
        }
    }
    if(acc == total){
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
lst = [0]*n

lst[0] = s[1:].count("E")
for i in range(1,n):
    lst[i] = lst[i-1]
    if s[i-1]=="W":
        lst[i]+=1
    if s[i]=="E":
        lst[i]-=1

print(min(lst))


Measured memory_bytes: 15436
#ifdef Dhiraj
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              (x).begin(), (x).end()
#define rall(x)             (x).rbegin(), (x).rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin >> args), ...);
}
// scan vector
template <typename T> 
inline istream& operator >>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream& operator >>(istream &in, pair<T, U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

const ll Mod = 998244353;
inline ll md(ll x, ll M = Mod)
{
    x %= M;
    return ((x < 0) ? (x + M) : x);
}

void solve(int &T)
{
    ll n, k;
    cin >> n >> k;

    set<ll> a;
    loop(j, k)
    {
        ll l, r;
        cin >> l >> r;
        loop(i, l, r + 1) {
            a.insert(i);
        }
    }
    a.insert(n + 2);
    d(a);

    vector<pair<ll, ll>> b;
    ll first = *a.begin(), last = *a.begin();

    for(ll x : a) {
        if(x != last) {
            b.push_back({first, last});
            first = last = x;
        }
        last++;
    }
    d(b);

    vector<ll> dp(2 * n + 5, 0);

    ll cur = 0;
    loop(i, 1, n + 1)
    {
        cur = md(cur + dp[i]);
        for(auto &r : b) {
            dp[i + r.first] += (cur + (i == 1));
            dp[i + r.second] -= (cur + (i == 1));
        }
    }
    cout << cur << endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    for(int i = 1; i <= t; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 15420
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define fi first
#define sec second
#define MAX INT_MAX
#define INF 99999999
#define ll long long
#define PI acos(-1.0)
#define MOD 1000000007
#define PLL pair<ll,ll>
#define PII pair<int,int>
#define ull unsigned long long
#define triplell pair<pair<ll,ll> , ll>
#define triple pair<pair<int,int> , int>
#define For(i,n) for(int i=0;i<(int)n;i++)
#define Forn(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define forba(i,a,b) for(int i=(int)b;i>=(int)a;i--)

bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    int a, b;

    cin>>a>>b>>t;

    int ans = 0;

    i = 2;

    m=a;
    while(m<=t)
    {
    	ans+=b;
    	m+=a;
	}

	cout<<ans<<endl;

//	main();

    return 0;
}


Measured memory_bytes: 256
s = [int(c) for c in input()]
a = 0
b = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] == 0:
    a = a
    b = b + 1
  elif i % 2 == 1 and s[i] == 0:
    a = a + 1
    b = b
  elif i % 2 == 0 and s[i] == 1:
    a = a + 1
    b = b
  else:
    a = a
    b = b + 1
p = [a,b]
print(min(p))

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<a<<endl
#define debug2(a,b) cout<<a<<" "<<b<<endl
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define debug4(a) cout<<"chu "<<a<<endl
#define sz(a) (ll)(a.size())
#define endl "\n"

vector <ll> adj[100005];
ll dp[100005][2];

ll dfs(ll s,ll p){
  for(auto it:adj[s]){
    if(it!=p){
      dfs(it,s);
    }
  }
  dp[s][1]=dp[s][0]=1;
  for(auto it:adj[s]){
      if(it!=p){
        dp[s][1]=(dp[s][1]*((dp[it][1]+dp[it][0])%mod))%mod;
        dp[s][0]=(dp[s][0]*dp[it][1])%mod;
      }
    }

}

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,x,y;
  cin>>n;
  forn(i,0,n-1){
    cin>>x>>y;
    adj[x].pb(y);
    adj[y].pb(x);
  }
  dfs(1,-1);
  /*forn(i,1,n+1){
    cout<<dp[i][0]<<" "<<dp[i][1]<<endl;
  }*/
  ll ans=(dp[1][0]+dp[1][1])%mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12800
n = input()

zero = "0"
nine = "9"
zeronine = ""

for index in range(len(n)-1):
  if index%2==1:
    zeronine += zero
  else:
    zeronine += nine

if len(n)%2==0:
  print(int(zeronine))
else:
  if len(n)==1:
    print(int(n))
  else:
    print(int(n)-int(zeronine))

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

int main() {
  string odd, even;
  cin >> odd;
  cin >> even;
  string ans = "";
  int ol = odd.length();
  int el = even.length();
  for (int i = 0; i < ol+el; i++) {
    if (i % 2 == 0) {
      ans.push_back(odd[i/2]);
    }
    else {
      ans.push_back(even[i/2]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,i=0,m=1;
    cin>>n>>x>>y;
    while(1)
    {
        i++;
        m=n*i;
        if(m>=x && m<=y)
            {
                cout<<"OK";
            return 0;
            }
        if(m>y)
            {
                cout<<"NG";
            return 0;
            }
    }

   return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define pq          priority_queue
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

void solve()
{
    ll k,a,b,ans=1,y=0;
    cin>>k>>a>>b;
    if(a+1>=b) { cout<<k+1<<endl; exit(0); }
    else
    {
        if(k<a+1) {cout<<ans+k; exit(0); }
        ans=b;
        k-=a+1;
        ll t=k/2;
        ans+=t*(b-a);
        ans+=k%2;
    }
    cout<<ans;
}

int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

char buf[1024];
int vertical[1024];
int canSize1[1024];
int canSize2[1024];

int main()
{
	while (true)
	{
		int n;
		cin.getline(buf, sizeof(buf));
		sscanf(buf, "%d", &n);
		if (n == 0)
			break;

		int ans = 0;
		memset(vertical, 0, sizeof(vertical));
		memset(canSize1, 0, sizeof(canSize1));
		memset(canSize2, 0, sizeof(canSize2));
		int* size[] = { canSize1, canSize2 };
		for (int i = 0; i < n; ++i)
		{
			cin.getline(buf, sizeof(buf));
			int horizontal = 0;
			int* canSize = size[i&1];
			int* prevSize = size[(i+1)&1];
			for (int j = 1; j <= n; ++j)
			{
				if (buf[j-1] == '.')
				{
					++horizontal;
					++vertical[j];
					canSize[j] = min(prevSize[j-1]+1, min(horizontal, vertical[j]));
					if (canSize[j] > ans)
						ans = canSize[j];
				}
				else
					canSize[j] = vertical[j] = horizontal = 0;
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main()
{
    int head_x, foot_y, turtle, crane;

    std::cin >> head_x >> foot_y;

    turtle = (foot_y / 2) - head_x;
    crane = head_x - turtle;

    if (head_x == turtle + crane && foot_y == 4 * turtle + 2 * crane)
    {
        if (turtle >= 0 && crane >= 0)
        {
            std::cout << "Yes" << std::endl;
        }
        else
        {
            std::cout << "No" << std::endl;
        }
    }
    else
    {
        std::cout << "No" << std::endl;
    }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    ll a,b,c;cin>>a>>b>>c;
    int cnt=0;
    while(a%2==0&&b%2==0&&c%2==0){
        ll l,m,n;
        l=(b+c)/2;
        m=(a+c)/2;
        n=(b+a)/2;
        a=l;b=m;c=n;
        cnt++;
        if(cnt==100){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int n, m;
    cin >> n >> m;
    vi a(n);
    int cnt = 0;
    rep(i, n) {
        cin >> a[i];
        cnt += a[i];
    }

    int ans = 0;
    rep(i, n) {
        if(a[i] * (4 * m) >= cnt) ans++;
    }

    Yn(ans >= m);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int r = scan.nextInt();
        int n = scan.nextInt();

        while (n != 0 || r != 0) {
            for (int i = 0; i < r; i++) {
                for (int t = 0; t < n; t++) {
                    if (i == 0 || i == r - 1 || t == 0 || t == n - 1) {
                        System.out.print("#");
                    } else {
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
            r = scan.nextInt();
            n = scan.nextInt();
        }

    }
}



Measured memory_bytes: 33720
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextLong()

  // val nmax = 1_000_000_000_000_001

  var total = 0L
  var tmp = 26L
  var digit = 0
  while (total < n) {
    digit++
    total += tmp
    tmp *= 26L
  }

  val pre = total - (tmp / 26L)
  val now = n - pre

  var a = now - 1L
  val ans = mutableListOf<Char>()
  for (i in digit - 1 downTo 0) {
    val tmp2 = Math.pow(26.0, i.toDouble()).toLong()
    val tmp3 = a / tmp2

    val c = (tmp3 + 'a'.toInt()).toChar()
    ans.add(c)

    a %= tmp2
  }

  println(ans.joinToString(""))

}




Measured memory_bytes: 38612
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
 
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
 
const int N = 1e5 + 5;
const int mod = 1e9+7;
const ll INF = (ll)1e18;

// CREDIT TO ERRICHTO

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
 
    int n;
    cin >> n;
    vector<int> v[n];
    for(int j = 0; j < n; j++){
        for(int k = 0; k < n; k++) {
            int x;
            cin >> x;
            if(x) v[j].pb(k);
        }
    }
    const int TOT = (1 << n);
    vector<int> prv(TOT, 0);
    prv[0] = 1;

    for(int i = 0; i < TOT-1; i++){
        int j = __builtin_popcount(i);
        for(auto women : v[j])
            if(i&(1 << women));
            else prv[i^(1 << women)] = (prv[i^(1 << women)] + prv[i]) % mod;
    }

    cout << prv[TOT - 1];
    return 0;
}


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

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

    int n;
    cin >> n;
    vector<long long> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    sort(A.rbegin(), A.rend());

    if(n == 2){
        cout << A[0] << endl;
        return 0;
    }

    int cnt = 0;
    long long total = 0;
    for(int i = 0; i < n; i++){
        if(i == 0){
            cnt++;
            total += A[i];
        }else{
            total += A[i];
            cnt++;
            if(cnt == n - 1){
                break;
            }
            total += A[i];
            cnt++;
            if(cnt == n - 1){
                break;
            }
        }
    }

    cout << total << endl;

    return 0;
}

Measured memory_bytes: 4780
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int x;
   cin >> x;
   if(x >= 30){
      cout << "Yes\n";
   }else{
      cout << "No\n";
   }
   return 0;
} 

Measured memory_bytes: 3636
var
 n,m,i,j:longint;
 a:array[0..100] of ansistring;
begin
 readln(n,m);
 for i:=1 to n do readln(a[i]);
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if a[i]>a[j] then
   begin
    a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];
   end;
   for i:=1 to n do write(a[i]);
   writeln;
end.

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

int grid[105][105], a[105*105];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int h, w, n; cin >> h >> w >> n;
    for(int i=0;i<n;i++) cin >> a[i];

    int cur = 0;
    for(int i=0;i<h;i++){
        if(i % 2 == 0){
            for(int j=0;j<w;j++){
                grid[i][j] = cur + 1; a[cur]--;
                if(a[cur] == 0) cur++;
            }
        }
        else{
            for(int j=w-1;0<=j;j--){
                grid[i][j] = cur + 1; a[cur]--;
                if(a[cur] == 0) cur++;
            }
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++) cout << grid[i][j] << ' ';
        cout << endl;
    }
    return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> void chmax(T& a,const T& b){if(a < b) a = b;}
template<typename T> void chmin(T& a,const T& b){if(b < a) a = b;}
typedef long long ll;

int N;
const int INF = 1e9;
struct tile{
	vector<int> c;
	tile(vector<int> a){
		c = a;
	}
	void rearrange(){
		tile mn = *this;
		FOR(i,0,4){
			this->rotation();
			chmin(mn,*this);
		}
		*this = mn;
	}
	void rotation(){
		int tmp = c [0];
		FOR(i,0,3){
			c [i] = c [i + 1];
		}
		c [3] = tmp;
	}
	bool operator<(const tile& a) const{
		return c < a.c;
	}
	bool operator==(const tile& a) const{
		return c == a.c;
	}
};
map<tile,int> mp;

int cnt(tile& a)
{
	int res = 0;
	tile tmp = a;
	FOR(i,0,4){
		res += tmp == a;
		tmp.rotation();
	}
	return res;
}

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

	cin >> N;
	FOR(i,0,N){
		vector<int> a(4);
		FOR(i,0,4){
			cin >> a [i];
		}
		tile x(a);
		x.rearrange();
		mp [x]++;
	}

	ll ans = 0;
	for(auto&& top : mp){
		for(auto&& bot : mp){
			tile tmp = bot.first;
			FOR(i,0,4){
				int color [8];
				FOR(j,0,4){
					color [j] = top.first.c [j];
				}
				FOR(j,0,4){
					color [j + 4] = tmp.c [j];
				}
				tile a(vector<int>{color [1],color [0],color [5],color [4]});
				tile b(vector<int>{color [2],color [1],color [4],color [7]});
				tile c(vector<int>{color [3],color [2],color [7],color [6]});
				tile d(vector<int>{color [0],color [3],color [6],color [5]});
				a.rearrange(),b.rearrange();
				c.rearrange(),d.rearrange();
				if(mp.count(a) && mp.count(b) && mp.count(c) && mp.count(d)){
					ll mul = top.second-- * bot.second--;
					mul *= mp [a]-- * cnt(a);
					mul *= mp [b]-- * cnt(b);
					mul *= mp [c]-- * cnt(c);
					mul *= mp [d]-- * cnt(d);
					mp [a]++,mp [b]++,mp [c]++,mp [d]++;
					bot.second++,top.second++;
					if(mul > 0) ans += mul;
				}
				tmp.rotation();
			}
		}
	}

	ans /= 6;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    long long int N, K;
    cin >> N >> K;
    
    long long int ans;
    if(K==1) {
        ans = N*N*N;
    } else if(K%2==0) {
        ans = N/K;
        if(N%K>=K/2) ans++;
        ans *= ans*ans;
        ans += (N/K)*(N/K)*(N/K);
    } else {
        ans = (N/K)*(N/K)*(N/K);
    }
    cout << ans << endl;
    

    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y;
  cin >> X >> Y;
  rep(i, 101) {
    rep(j, 101) {
      int x = i+j;
      int y = 2*i+4*j;
      if(X == x && Y == y) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;

int num[10010];

signed main(){
	cin>>N;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				int sum=i*i+j*j+k*k+i*j+j*k+i*k;
				if(sum<=10000){
					num[sum]++;
				}
			}
		}
	}
	for(int i=1;i<=N;i++){
		cout<<num[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3628
package main

import (
	"fmt"
)

func main() {
	var x,y int
	fmt.Scan(&x,&y)
	
	g := map[int]int {
		1:1,
		2:3,
		3:1,
		4:2,
		5:1,
		6:2,
		7:1,
		8:1,
		9:2,
		10:1,
		11:2,
		12:1,
	}
	
	if g[x] == g[y] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
	
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)



#define OUT 0
#define ON 1
#define IN 2
#define EPS (1e-10)
class P{                    //???
public:
	double x,y;
	
	P(double _x=0,double _y=0):x(_x),y(_y){};
	P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //??????
	P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //??????
	P operator * (const double k )const{ return P( x*k   , y*k    ); } //??????
	P operator / (const double k )const{ return P( x/k   , y/k    ); } //??????
	
	bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
	bool operator < (const P &p) const{ return ( x!=p.x ? x<p.x:y<p.y ); }
	
	double norm(){ return x*x+y*y; }        //?????????
	double abs() { return sqrt(norm()); }   //??§??????
	void normalize() {double d = sqrt(x*x+y*y); x /= d; y /= d;}	//??£??????
};
struct C{P p;double r;};    //???
struct S{P p1,p2;};         //??????
typedef vector<P> Polygon;  //????§???¢
typedef P Vector;           //????????????
typedef S L;                //??´???

double norm (P p)               { return p.norm(); }
double abs  (P p)               { return p.abs(); }
double dot  (Vector a,Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; }
double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}
Vector vec(S a)                 {return P(a.p2.x-a.p1.x,a.p2.y-a.p1.y);}



int main(){
	int n;
	cin>>n;
	vector<P> pol,pol2;
	P min1=P(INF,INF),min2=P(INF,INF);
	rep(i,n){
		int x,y;
		cin>>x>>y;
		pol.pb(P(x,y));
		pol2.pb(P(-x,-y));
		min1 = min(min1,P(x,y));
		min2 = min(min2,P(-x,-y));
	}
	
	rep(i,n){
		pol2[i]=pol2[i]+(min1-min2);
	}
	
	P cent;
	rep(i,n)cent=cent+pol[i];
	cent=cent/n;
	
	sort(all(pol)),sort(all(pol2));
	
	bool f = true;
	rep(i,n)if(pol[i].x!=pol2[i].x||pol[i].y!=pol2[i].y)f=false;
	if(f)printf("%.10lf %.10lf\n",cent.x,cent.y);
	else cout<<"NA"<<endl;
}

Measured memory_bytes: 3208
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
 
int color(int n) {
  if(n >= 3200) return -1;
  return n / 400;
}
 
int main() {
  int n;
  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++) {
    int k; cin >> k;
    a.push_back(k);
  }
  set<int> normal; int special = 0;
  for(auto ai : a) {
    int c = color(ai);
    // cout << ai << " color: " << c << endl;
    if(c == -1) {
      special++;
    } else {
      normal.insert(color(ai));
    }
  }
  int q = normal.size();
  if(q < 1 && special) {
    q = 1;
  }
  cout << q << " " << normal.size() + special << endl;
}

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)

struct edge{
    int from;
    int to;
    int cost;
};

int main() {
    int ans = 0;
    int n, m, p;
    vector<edge> edges;
    cin >> n >> m >> p;
    struct edge tmp;
    int coin;
    REP(i, m){
        cin >> tmp.from >> tmp.to;
        cin >> coin;
        tmp.cost = -(coin - p);
        edges.push_back(tmp);
    }
    bool go[2501], come[2501];
    fill(go, go+n+1, false);
    fill(come, come+n+1, false);
    go[1] = true;
    come[n] = true;
    REP(i, n){
        REP(j, m){ 
            if (go[edges[j].from]) go[edges[j].to] = true; 
            if (come[edges[j].to]) come[edges[j].from] = true;
        }
    }
    vector<edge> redges;
    REP(j, m){
        if(go[edges[j].to]&&go[edges[j].from]&&come[edges[j].to]&&come[edges[j].from]){
            redges.push_back(edges[j]);
        }
    }

    int v[2501];
    fill(v, v+n+1, INF);
    v[1] = 0;
    REP(i, n){
        REP(j, redges.size()){
            struct edge e = redges[j];
            if(v[e.from] != INF && v[e.to] > v[e.from] + e.cost){
                v[e.to] = v[e.from] + e.cost;
                
                if(i == n-1){
                    cout << -1 << endl;
                    return 0;
                }
                
            }
        }
    }
    if(v[n]==INF) cout << -1 << endl;
    else cout << max(-v[n],0) << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

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

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

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

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

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

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

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

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

//int n ,k;

int main(){
    
    // IN n >> k;

    //P(n-k+1);

    ll r,g,b,n;
    cin >> r >> g >> b >> n;

    ll ans =0;

    int i = 0,j = 0;
    while(i <= n){
	//	P(i);
	j = 0;
	while(j <= n){
	    
	    ll t = i + j;
	    //  PS(i);PS(j);P(n-t);
	     if((((n-t) > 0) &&((n-t) %b == 0)) || n-t == 0){
		 //		yes;
		ans++;
	    }
	    j += g;
	}
	i += r;
    }
    P(ans);
    return  0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n,k,c; cin >> n >> k >> c;
    string s; cin >> s;
    P l[n],r[n];
    rep(i,n){
        if(i==0){
            if(s[0]=='o') l[0]={1,c+1};
            else l[0]={0,0};
            continue;
        }
        if(i>=l[i-1].se && s[i]=='o') l[i]={l[i-1].fi+1,i+c+1};
        else l[i]=l[i-1];
    }
    rrep(i,n){
        if(i==n-1){
            if(s[n-1]=='o') r[n-1]={1,n-1-c-1};
            else r[n-1]={0,n-1};
            continue;
        }
        if(i<=r[i+1].se && s[i]=='o') r[i]={r[i+1].fi+1,i-c-1};
        else r[i]=r[i+1];
    }
    //rep(i,n) cout << l[i].fi << " " << r[i].fi << endl;
    rep(i,n){
        if(s[i]=='x') continue;
        
        int x=0; if(i-c-1>=0) x=l[i-c-1].fi;
        int y=0; if(i+c+1<=n-1) y=r[i+c+1].fi;
        int z=0; if(i-1>=0) z=l[i-1].fi;
        int l=0; if(i+1<=n-1) l=r[i+1].fi;
        if(x+y==k-1 && z+l==k-1) cout << i+1 << endl;
    }
}


Measured memory_bytes: 4996
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

// template< typename T >
// vector< T > convert_base(T x, T b) {
//   vector< T > ret;
//   T t = 1, k = b;
//   while(x) {
//     ret.emplace_back((x * t) % k);
//     if(ret.back() < 0) ret.back() += k;
//     x -= ret.back() * t;
//     x /= k;
//     t *= b / k;
//   }
//   if(ret.empty()) ret.emplace_back(0);
//   reverse(begin(ret), end(ret));
//   return ret;
// }


string convert_base(int x, int b){
  if(x == 0) return "0";
  string s;
  int base = 1;
  while(x != 0){
    if(x % (base * b) == 0){
      s += '0';
    }else{
      s += '1';
      x -= base;
    }
    base *= b;
  }
  reverse(s.begin(),s.end());
  return s;
}

signed main(){

  int n, b; cin >> n >> b;
  b = -2;
  auto res = convert_base(n, b);
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n,a,b;
  cin >> n >> a >> b;
  if( (b- a +1) %2 == 0){
    cout << "Borys" << endl;
  }
  else{
    cout << "Alice" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int n, v;
vector<P> solve(vector<int> &nums){
  vector<P> res;
  res.push_back(P(0, -1));
  vector<int> cnt(108000, 0);
  for(int v: nums)cnt[v]++;
  for(int i = 0;i < 108000;i++){
    if(cnt[i] == 0)continue;
    res.push_back(P(cnt[i], i));
  }
  sort(res.rbegin(),res.rend());
  return res;
}

int main(){
  cin >> n;
  vector<int> nums[2];
  for(int i = 0;i < n;i++){
    cin >> v;
    nums[i%2].push_back(v);
  }
  vector<P> cnts[2];
  cnts[0] = solve(nums[0]);
  cnts[1] = solve(nums[1]);
  Int res = n;
  if(cnts[0][0].second != cnts[1][0].second)res = min(res, n - cnts[0][0].first - cnts[1][0].first);
  if(cnts[0][0].second != cnts[1][1].second)res = min(res, n - cnts[0][0].first - cnts[1][1].first);
  if(cnts[0][1].second != cnts[1][0].second)res = min(res, n - cnts[0][1].first - cnts[1][0].first);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3404
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
int a[200000];
signed main(){
  int n;
  cin >> n;
  if(n==3){
    int a,b,c;
    cin >> a >> b >> c;
    int k = a^b;
    k ^= c;
    if(k==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
  }
  REP(i,n) cin >> a[i];
  if(n%3==0){
    sort(a,a+n);
    string ans = "Yes";
    int a1 = a[0];
    REP(i,n/3){
      if(a[i]!= a1) ans = "No";
      if(a[n/3+i] != a[n/3]) ans = "No";
      if(a[2*n/3+i] != a[2*n/3]) ans = "No";
    }
    int tt = a[0] ^ a[n/3];
    tt ^= a[2*n/3];
    if(tt!=0) ans = "No";
    cout << ans << endl;
    return 0;
  }
  else{
    int k = a[0];
    int f = 0;
    REP(i,n-1){
      if(a[i+1]!=k) f=1;
    }
    if(f==1) cout << "No" <<endl;
    else cout << "Yes" << endl;
    return 0;
  }
  return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

ll med(vector<ll> &x) {
    int n = x.size();
    if (n % 2 == 1) {
        return x[n / 2];
    } else {
        return (x[n / 2 - 1] + x[n / 2]) / 2;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    vector<ll> a(n), b(n);
    REP(i, 0, n) {
        cin, a[i], b[i];
        a[i] *= 2;
        b[i] *= 2;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ll mid1 = med(a), mid2 = med(b);
    if (n % 2 == 1) {
        print((mid2 - mid1) / 2 + 1);
    } else {
        print(mid2 - mid1 + 1);
    }

    return 0;
}


Measured memory_bytes: 6364