akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s; vector<vector<int> > v; int t[100][100], dp[100][100];
vector<int> parse(string s) {
	vector<int> ret; int v = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == ',') ret.push_back(v), v = 0;
		else v = v * 10 + s[i] - 48;
	}
	ret.push_back(v);
	return ret;
}
int main() {
	while(cin >> s) v.push_back(parse(s));
	int n = v.size() / 2 + 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < v[i].size(); j++) {
			t[i - j][j] = v[i][j];
		}
	}
	for(int i = n; i < v.size(); i++) {
		for(int j = 0; j < v[i].size(); j++) {
			t[i - (j + n - v[i].size())][j + n - v[i].size()] = v[i][j];
		}
	}
	dp[0][0] = t[0][0];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(i) dp[i][j] = dp[i - 1][j] + t[i][j];
			if(j) dp[i][j] = max(dp[i][j], dp[i][j - 1] + t[i][j]);
		}
	}
	cout << dp[n - 1][n - 1] << endl;
}

Measured memory_bytes: 3252
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;



int main()
{
	string preS, S;
	int m, h;

	while (true) {
		int len;
		cin >> preS;
		len = preS.length();

		if (preS == "-") break;

		cin >> m;
		rep(i, m) {
			cin >> h;
			S = preS.substr(h, len - h) + preS.substr(0, h);
			preS = S;
		}
		cout << S << endl;
	}



	return 0;
}



Measured memory_bytes: 3204
#include <cstdio>
#include <cstring>
#include<stdlib.h>

int n , q;
struct T{
    char year[30];
    int day;
    int y;
}node[1005];

int cmp(const void *a , const void *b){
    struct T *c = (T *)a;
    struct T *d = (T *)b;
    if(c->y < d->y) return true;
    return false;
}


int main(){

    int t , temp;
    bool flag;
	while(~scanf("%d%d" , &n , &q) && n || q){

        for(int i = 0 ; i < n ; i ++){
            scanf("%s%d%d" , node[i].year , &node[i].day , &node[i].y);
        }
        //qsort(node , n , sizeof(node[0]) , cmp);

        for(int i = 0 ; i < q ; i ++){
            scanf("%d" , &t);flag = false;
            for(int j = 0 ; j < n ; j ++){
                if(t >= node[j].y - node[j].day + 1 && t <= node[j].y){
                    printf("%s %d\n" , node[j].year , node[j].day - (node[j].y - t));
                    flag = true;
                    break;
                }
            }
            if(flag == false) printf("Unknown\n");
        }


	}

	return 0;
}

Measured memory_bytes: 1080
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int n, a;
string s, t;

void calc(int p, int c){
  if(a <= c) return;
  if(p == n) a = min(a, c);
  else{
    if(s[p] == t[p]) calc(p+1, c);
    else{
      int d = t[p] - s[p];
      for(int i=p;i<n;i++){
        for(int j=p;j<=i;j++) s[j] = ((s[j] - '0') + d + 10) % 10 + '0';
        calc(p+1, c+1);
        for(int j=p;j<=i;j++) s[j] = ((s[j] - '0') - d + 10) % 10 + '0';
      }
    }
  }
}

main(){
  while(cin >> n && n){
    cin >> s >> t;
    a = n;
    calc(0, 0);
    cout << a << endl;
  }
}

Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String [] s = in.next().split("");
        String [] t = in.next().split("");
        Arrays.sort(s);
        Arrays.sort(t);
        String new_s = "";
        for (int i = 0; i < s.length; i++){
            new_s += s[i];
        }
        String new_t = "";
        for (int i = t.length-1; i >= 0; i--){
            new_t += t[i];
        }
        if (new_s.equals(new_t)){
            System.out.println("No");
            return;
        }
        String [] sort = {new_s, new_t};
        Arrays.sort(sort);
        if (sort[0].equals(new_s)){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 24148
words = lambda t : list(map(t, input().split()))
n = int(input())
d = {}

for i in range(n):
    str = "".join(sorted(input()))
    if str not in d:
        d[str] = 1
    else:
        d[str] += 1

ans = 0
for k,v in d.items():
    #print(k,v)
    if v != 1:
        ans += (v) * (v-1) // 2

print(ans)


Measured memory_bytes: 60504
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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

	ll s, w;
	cin>>s>>w;
	
	
	if(w>=s) cout<<"unsafe\n";
	else cout<<"safe\n";
	
	return 0;
}


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

//#define fin cin
//#define fout cout

#define lb(x) (x&(-x))

#define leftSon (node << 1)
#define rightSon ((node << 1) | 1)

#define pii pair < int , int >
#define F first
#define S second

using namespace std;

typedef long long ll;

const int inf = 0x3f3f3f3f;
const long long infL = LLONG_MAX;

struct psychotronic_induction {
    int electromagnetic_wave = 7;
};

const int nmax = 1e5 + 10;

int n;
int a[nmax], b[nmax];
long long ans[nmax];
priority_queue < pair < int, int > > h;

int aib[nmax];

void update(int pos, int x) {
    for ( ; pos; pos -= lb(pos))
        aib[pos] += x;
}

int query(int pos) {
    int res = 0;
    for ( ; pos <= n; pos += lb(pos))
        res += aib[pos];
    return res;
}

int main()
{
   

    /*
    ifstream fin("input.in");
    ofstream fout("output.out");
    */

    vector < int > v, no;

    scanf("%d", &n); int maxx = 0;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
        if (a[i] > maxx) {
            v.push_back(i);
            maxx = a[i];
        }
        no.push_back(a[i]);
    }

    sort(no.begin(), no.end());
    auto it = unique(no.begin(), no.end());
    no.resize(distance(no.begin(), it));

    for (int i = 1; i <= n; ++i)
        b[i] = lower_bound(no.begin(), no.end(), a[i]) - no.begin() + 1;

    reverse(v.begin(), v.end());
    v.push_back(0);
    for (int i = n; i >= v[0]; --i)
        if (a[i] > a[v[0]]) update(b[i], 1);
        else h.push({a[i], b[i]});

    for (auto it = v.begin(); it != v.end(); ++it) {
        int i = *it;
        if (i == 0) break;

        auto it2 = it; it2++; int j = *it2;
        int curr = query(b[j] + 1);
        ans[i] += 1LL * curr * (a[i] - a[j]);

        while (h.size() && h.top().first > a[j]) {
            ans[i] += h.top().first - a[j];
            update(b[j], 1);
            h.pop();
        }

        for (int k = j; k < i; ++k)
            if (a[k] > a[j]) update(b[k], 1);
            else h.push({a[k], b[k]});
    }

    for (int i = 1; i <= n; ++i)
        printf("%lld\n", ans[i]);

    return 0;
}


Measured memory_bytes: 4084
n = gets.to_i
r = []

mi = gets.to_i
profit = 0 - 1000000000
( n-1 ).times {
	num = gets.to_i
	
	diff = num - mi
	if profit < diff
		profit = diff
	end

	if num < mi
		mi = num
	end
}
puts( profit )

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



int main() {
string S;
cin >> S;
int ans = 1000007;
int lo = S.size();
int count = 0;
for(int i = 0; i < lo; i++){
if(i % 2 == 1 ){
if (S[i] != '0') count++;
}
else {
if (S[i] != '1') count++;
}

}
ans = min(ans, count);
count = 0;
for(int i = 0; i < lo; i++){
if(i % 2 == 1 ){
if (S[i] != '1') count++;
}
else {
if (S[i] != '0') count++;
}

}
ans = min(ans, count);
cout << ans << endl;


}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using UL=unsigned;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main(){
    UL A,B,C;cin>>A>>B>>C;
    UL ans=0;
    for(UL i=A;i<=B;i++)if(C%i==0)ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define eps 1e-3
#define pi acos(-1.0)
#define inf 0x3f
#define INF 0x3f3f3f3f
#define pb push_back
#define debug1 cout<<"&&";
#define debug2 cout<<"**";
#define ms(a, x) memset(a, x, sizeof(a))
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
const int mod = 1e9 + 7;
const int N = 2e5+10;
const int M = 1e6+10;
/*=================================================================================*/

ll a[N], sum, n;

int main() {
   cin>>n;
   for1(i, n) {
      scanf("%d", &a[i]);
      sum ^= a[i];
   }
   // cout<<sum<<endl;
   for1(i, n) {
      printf("%lld%c", a[i]^sum, n==i ? '\n' : ' ');
   }
}

Measured memory_bytes: 5324
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define off 250555

int n,k,lis[11];

bool ok(int x)
{
    while(x)
    {
        if(lis[x%10]) return false;
        x/=10;
    }
    return true;
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    cin>>n>>k;
    For(i,0,k)
    {
        int val;
        cin>>val;
        lis[val]=1;
    }
    For(i,n,1111111)
    {
        if(ok(i))
        {
            cout<<i;return 0;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int main(void){

    int n, m;
    long long int total = 0;

    cin >> n >> m;

    priority_queue<int> A;

    for(int i = 0;i < n;i++){
        int x;
        cin >> x;
        A.push(x);
    }

    int temp;
    for(int i = 0;i < m;i++){
        temp = A.top();
        A.pop();
        A.push(temp/2);
    }

    while(!A.empty()){
        total += A.top();
        A.pop();
    }
    
    cout << total << endl;

    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0;
bool graph[8][8];
 

int dfs(int v,int N,bool visited[8]){//v:開始点

    bool all_visited = true;

    for(int i=0;i<N;i++){
        if(visited[i] == false){
            all_visited = false;
        }
    }

    if(all_visited){
        return 1;
    }
    
    int ret=0;


    for(int i=0;i<N;i++){
        if(graph[v][i] == false) continue;
        if(visited[i]) continue;

        visited[i] = true;
        ret += dfs(i,N,visited);
        visited[i] = false;
    }

    return ret;
}


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

    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        graph[a-1][b-1] = graph[b-1][a-1] = true;

    }

    bool visited[8];
    for(int i=0;i<n;i++){
     visited[i] = false;
    }

    visited[0]=true;
    cout << dfs(0,n,visited) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int x, a, b;
  cin >> x >> a >> b;
  
  if (b<=a) puts("delicious");
  else if (b-a<=x) puts("safe");
  else puts("dangerous");
  
}



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

#define ll long long

using namespace std;

ll n;
vector <ll> a;

int main(){
  ll inp;

  vector <ll> odd;
  vector <ll> even;
  cin >> n;
  
  for ( int i =0;i<n;i++){
    cin >> inp;
    a.push_back(inp);
  }

  for (int i = 0; i < n ;i++){
    if((i%2)==0) even.push_back(a[i]);
    else odd.push_back(a[i]);
  }

  //even
  if((n%2)==0){
    reverse(odd.begin(),odd.end());
    for(int i =0;i<odd.size();i++) cout << odd[i] << " ";
    for(int i =0;i<even.size();i++) cout << even[i] << " ";
  }

  //odd
  else{
    reverse(even.begin(),even.end());
    for(int i =0;i<even.size();i++) cout << even[i] << " ";
    for(int i =0;i<odd.size();i++) cout << odd[i] << " ";
  }

  cout << endl;
  return 0;
}


Measured memory_bytes: 6640
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d",&a,&b);
    c = a*b;
    if((1<=a && a<=9) && (1<=b && b<=9))
        printf("%d\n",c);
    else
        printf("-1\n");

    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>

struct date {
  int by, bm, bd;
  int y, m, d;

  int days[13] = {0,
		  31, 28, 31, 30, 31, 30,
		  31, 31, 30, 31, 30, 31};

  date(int by, int bm, int bd, int y, int m, int d):
    by(by), bm(bm), bd(bd), y(y), m(m), d(d)
  {}

  bool is_uruu(int y) {
    if (y % 400 == 0) return true;
    if (y % 100 == 0) return false;
    if (y % 4 == 0) return true;
    return false;
  }

  void increment_date() {
    int maxd = days[m];
    if (is_uruu(y) && m == 2) ++maxd;
    if (maxd == d++) {
      d = 1;
      if (m++ == 12) {
	m = 1;
	++y;
      }
    }
  }

  int get() const {
    int res = y-by;
    if (!(bm < m || (bm == m && bd <= d))) --res;
    return res;
  }
};

int main() {
  int y0, m0, d0;
  scanf("%d %d %d", &y0, &m0, &d0);

  int y1, m1, d1;
  scanf("%d %d %d", &y1, &m1, &d1);

  int cy, cm, cd;
  std::tie(cy, cm, cd) = std::max(std::make_tuple(y0, m0, d0),
				  std::make_tuple(y1, m1, d1));

  date a0(y0, m0, d0, cy, cm, cd);
  date a1(y1, m1, d1, cy, cm, cd);

  int res = 0;
  for (int i = 0; i < 366*410; ++i) {
    int x = a0.get();
    int y = a1.get();
    int cur = abs(x-y);
    res = std::max(res, cur);

    a0.increment_date();
    a1.increment_date();
  }
  printf("%d\n", res);
}



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

int main(){
  int n;cin >> n;
  int suuji=1;
  vector<pair<int,int>>a(n);
  for(int i=0;i<n;i++){
    int b;
    cin >> b;
    a[i] = make_pair(b,i+1);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    cout << a[i].second << " ";
  }
}

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

using namespace std;

int rez, n, k;
int rg[100001], a[100001];
bool viz[100001];
vector <int> v[100001];

inline void DFS(int nod) {
    viz[nod] = 1;
    rg[nod] = 1;
    for (int it : v[nod]) {
        if (!viz[it]) {
            DFS(it);
            rg[nod] = max(rg[nod], rg[it] + 1);
        }
    }
    if (rg[nod] == k && a[nod] != 1) {
        ++rez;
        rg[nod] = 0;
    }
}

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

    int x;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        v[a[i]].emplace_back(i);
    }
    if (a[1] != 1)
        ++rez;
    a[1] = 1;
    DFS(1);
    return cout << rez, 0;
}


Measured memory_bytes: 9216
//压行课次
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL n,ans=1e12;
LL read(){LL sss=0,fff=1;char ccc;ccc=getchar();while(ccc<'0'||ccc>'9'){if(ccc=='-')fff=-1;ccc=getchar();}while(ccc>='0'&&ccc<='9')sss=(sss<<1)+(sss<<3)+(ccc^'0'),ccc=getchar();return sss*fff;}
int main()
{
//	freopen("123.in","r",stdin);
//	freopen("123.out","w",stdout);
	n=read();
	for(LL i=1;i*i<=n;i++)
		if(n%i==0)
			ans=min(ans,i+(n/i));
	printf("%lld\n",ans-2);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,change,n1,count=0;
    scanf("%d",&n);
    n1=n/1000;
    if(n%1000!=0)
    {
        count++;
    }
    change=((n1+count)*1000)-n;
    printf("%d\n",change);
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    rep(i,0,n){
        cin >> a[i];
    }
    rep(i,0,n){
        cin >> b[i];
    }
    rep(i,0,n){
        cin >> c[i];
    }
    sort(all(a));
    sort(all(b));
    sort(all(c));
    ll ans = 0;
    rep(i,0,n){
        ll tmp =(lower_bound(all(a),b[i])-a.begin()) * (c.end()-upper_bound(all(c),b[i]));
        ans += tmp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
Main(function(input) {
	var points = input.trim().split('\n');

	var WPoints = [];
	for (var i = 0; i < 10; i++) {
		WPoints.push(+points[i]);
	}
	WPoints.sort(function (a, b) {
		return b - a;
	});
	var WScore = WPoints[0] + WPoints[1] + WPoints[2];

	var KPoints = [];
	for (var i = 0; i < 10; i++) {
		KPoints.push(+points[i + 10]);
	}
	KPoints.sort(function (a, b) {
		return b - a;
	});
	var KScore = KPoints[0] + KPoints[1] + KPoints[2];
	console.log(WScore, KScore);
});

function Main(callback) {
	var input = '';

	var stdin = process.stdin;

	stdin.resume();
	stdin.setEncoding('utf8');
	stdin.on('data', function(chunk) {
		input += chunk;
	});
	stdin.on('end', function() {
		callback(input);
	});
};

Measured memory_bytes: 15668
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int now = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] == now + 1) {
				now++;
			}
		}
		if (now == 0) {
			System.out.println(-1);
		} else {
			System.out.println(n - now);
		}
	}
}


Measured memory_bytes: 52052
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int main() {
    
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> a(m);
    FOR(i, 0, m){
        cin >> a[i];
    }
    
    int l=0,r=0;
    FOR(i, 0, m){
        if(a[i]<x){
            l++;
        }else{
            r++;
        }
    }
    cout << min(l,r) << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {
    int K, A, B;
    cin >> K;
    cin >> A >> B;

    for(int i = A; i <= B; i++){
        if (i % K == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3652
using System; 

class Program 
{ 
    static void Main() 
    {
      var KS = Console.ReadLine().Split();
      var K = int.Parse(KS[0]);
      var S = int.Parse(KS[1]);
      
      var count = 0;
      for (int X=0; X<=K; X++)
      {
        for (int Y=0; Y<=K; Y++)
        {
          if ( (S-(X+Y) > K) || (S < X+Y) ) continue;
          count++;
        }
      }
      Console.WriteLine(count);
    } 
}

Measured memory_bytes: 11092
from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split()))
s = 0
for A in l:
    if A%2==0 and A%3!=0 and A%5!=0:
        s = s
    else:
        s = s+1
if s == n:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;

int main(){
   int n,d; cin >> n>>d;
   int cnt=0;
   for(int i=2*d+1;;i+=2*d+1){
       cnt++;
       if(i>=n)break;
   }
   cout << cnt<<endl;
        
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = defaultdict(int)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                A[tmp] += 1

    for i in range(N):
        print(A[i + 1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 11836
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pii;
///-------------------------

int main()
{
    Phuong_; /// <3
    double n;
    cin >> n;
    cout << n*6.283185307;
    return 0;
}



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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    copy_n(istream_iterator<int>(cin), n, A.begin());
    vector<vector<int>> E(n);
    for (int i = 0; i < n - 1; i++){
        int u, v;
        cin >> u >> v;
        u--; v--;
        E[u].push_back(v);
        E[v].push_back(u);
    }

    const int INF = 1e9 + 1;
    vector<int> DP(n + 1, INF);
    DP[0] = 0;
    vector<int> ans(n);

    auto dfs = [&](auto i, auto par, auto self) -> void{
        auto j = lower_bound(DP.begin(), DP.end(), A[i]) - DP.begin();
        auto prev = DP[j];
        DP[j] = A[i];
        ans[i] = lower_bound(DP.begin(), DP.end(), INF - 1) - DP.begin() - 1;
        for (const auto &e: E[i]){
            if (e == par)
                continue;
            self(e, i, self);
        }
        DP[j] = prev;
    };

    dfs(0, -1, dfs);

    for (const auto &a: ans)
        cout << a << endl;
}

Measured memory_bytes: 39260
import sys

str = sys.stdin.read()
words = "abcdefghijklmnopqrstuvwxyz"
wordslist= list(words)
list2 = list(words)
try:
    for item in wordslist:
        iss = str.find(item)
        if iss != -1:
            list2.remove(item)
except Exception:
    pass

if len(list2) == 0:
    print("None")
else:
    print(list2[0])

Measured memory_bytes: 39536
#include <cstdio>
#include <cstring>

int h,w,n;
inline bool islower(char c) {
    return ('a'<=c) && (c<='z');
}
inline bool isupper(char c) {
    return ('A'<=c) && (c<='Z');
}
inline char tolower(char c) {
    return (isupper(c) ? c-'A'+'a' : c);
}


bool search(const char m[40][40]) {
    char cpy[40][40];
    memcpy(cpy, m, 1600);
    for(int k=0; k<500; k++) {
        bool flag=false;
        for(int l=0; l<50; l++)
            for(int x=0; x<w; x++)
                for(int y=0; y<h-1; y++) {
                    if(cpy[y+1][x] == '.')
                        cpy[y+1][x] = cpy[y][x], cpy[y][x] = '.';
                }
        for(int x=0; x<w; x++)
            for(int y=0; y<h; y++) {
                int i=0;
                if(cpy[y][x] == '.') continue;
                while(tolower(cpy[y][x]) == tolower(cpy[y+i][x])) i++;
                if(n<=i) {
                    flag = true;
                    for(int j=0; j<i; j++) cpy[y+j][x] = tolower(cpy[y+j][x]);
                }
                y+=i-1;
            }
        for(int y=0; y<h; y++)
            for(int x=0; x<w; x++) {
                int i=0;
                if(cpy[y][x] == '.') continue;
                while(tolower(cpy[y][x]) == tolower(cpy[y][x+i])) i++;
                if(n<=i) {
                    flag = true;
                    for(int j=0; j<i; j++) cpy[y][x+j] = tolower(cpy[y][x+j]);
                }
                x+=i-1;
            }
        if(!flag) break;
        for(int x=0; x<w; x++)
            for(int y=0; y<h; y++) {
                if(islower(cpy[y][x])) cpy[y][x]='.';
            }
    }
    for(int y=0; y<h; y++)
        printf("",cpy[y]);
    for(int x=0; x<w; x++)
        for(int y=0; y<h; y++) {
            if(cpy[y][x] != '.')
                return false;
        }
    return true;
}

bool swap(const char m[40][40]) {
    char cpy[40][40];
    for(int x=0; x<w; x++)
        for(int y=0; y<h; y++) {
            if(m[y][x+1]) {
                memcpy(cpy, m, 1600);
                cpy[y][x+1] = m[y][x];
                cpy[y][x] = m[y][x+1];
                if(search(cpy))
                    return true;
            }
        }
    return false;
}

int main(void) {
    char map[40][40];
    scanf("%d%d%d",&h,&w,&n);
    for(int i=0; i<h; i++)
        scanf("%s",map[i]);
    printf(swap(map) ? "YES\n" : "NO\n");

    return 0;
}

Measured memory_bytes: 2768
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int N, K;
	cin >> N >> K;

	int ans = 0;	
	for (int i = 0; i < N; i++) {
		int xi;
		cin >> xi;

		ans += min(xi, K - xi);
	}

	cout << 2 * ans << endl;

	return 0;
}

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

using namespace std;

#define run_forrest_run ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define vi vector <int>
#define sz(a) (int)a.size()
#define fi first
#define se second
#define si set <int>
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);} 

const int inf = 1e9;	
const int mod = inf + 7;

const int N = 205000;
vector <int> g[N];
vector <bool> visited(N);
vector <int> color(N);

int main()
{
	run_forrest_run;
    ll n,w;
    cin>>n>>w;
    vector<ll> weight(n);
    vector<ll> value(n);
    ll sum_value=0;
    for(ll i=0;i<n;i++)
    {
        cin >> weight[i] >> value[i];
        sum_value+=value[i];
    }
    
    vector<ll> dp(sum_value+1,1e18);
    dp[0]=0;
    for(ll i =0;i<n;i++)
    {
        for(ll j=sum_value-value[i];j>=0;j--)
        {
            dp[j+value[i]] = min(dp[j+value[i]],dp[j]+weight[i]);
        }
    }
    ll ans = -1;
    for(ll i=1;i<=sum_value;i++)
    {
        if(dp[i] <= w)
        {
            ans = max(ans,i);
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	int r = max(A, B);
	double res = (4.0 / 3.0)*3.14159265359079323846*r*r*r;
	cout << fixed << setprecision(15) << res << endl;
}


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

class UnionFind {
public:
    UnionFind(int n) {
        this->parent.resize(n);
        this->rank.resize(n);
        this->nsize.resize(n);

        for (int i = 0; i < n; ++i) {
            this->parent[i] = i; // default parent is itself
            this->rank[i] = 0;   // default rank is 0
            this->nsize[i] = 1;  // default size is 1
        }
    }

    ~UnionFind() = default;

    // return the parent of node x
    int find(int x) noexcept {
        if (this->parent[x] == x) {
            return x;
        } else {
            return this->parent[x] = this->find(parent[x]);
        }
    }

    // unite the tree of x and the tree of y
    void unite(int x, int y) noexcept {
        const int xp = this->find(x);
        const int yp = this->find(y);
        if (xp == yp) {
            return;
        }

        // change the parent node of tree whose rank is samller.
        if (this->rank[xp] < this->rank[yp]) {
            this->parent[xp] = yp;
            this->nsize[yp] += this->nsize[xp];
        } else {
            this->parent[yp] = xp;
            this->nsize[xp] += this->nsize[yp];

            if (this->rank[xp] == this->rank[yp]) { 
                ++(this->rank[xp]);
            }
        }
    }

    // return true if x and y belong to the same tree.
    bool same(int x, int y) noexcept {
        return (this->find(x) == this->find(y));
    }

    // return the number of nodes in tree which contains x
    int size(int x) noexcept {
        return this->nsize[this->find(x)];
    }

private:
    std::vector<int> parent; // parent of each node
    std::vector<int> rank;   // depth of each tree
    std::vector<int> nsize;  // number of nodes in each tree
};

struct Edge {
    int from;
    int to;
    int cost;

    bool operator<(const Edge& r) {
        return this->cost < r.cost;
    }
};

class Kruskal {
public:
    Kruskal(int v) : vnum(v) {
    }

    ~Kruskal() = default;

    void addEdge(int f, int t, int c) noexcept {
        this->edges.push_back({f, t, c});
    }

    int totalCost() const noexcept {
        UnionFind uf(this->vnum);

        std::vector<Edge> es = this->edges;
        std::sort(es.begin(), es.end());

        int res = 0;
        for (int i = 0; i < es.size(); ++i) {
            Edge& e = es[i];
            if (uf.same(e.from, e.to) == false) {
                uf.unite(e.from, e.to);
                res += e.cost;
            }
        }

        return res;
    }

private:
    std::vector<Edge> edges;
    int vnum;
};

int main() {
    int V, E;
    std::cin >> V >> E;

    Kruskal krs(V);
    int s, t, c;
    for (int i = 0; i < E; ++i) {
        std::cin >> s >> t >> c;
        krs.addEdge(s, t, c);
    }

    std::cout << krs.totalCost() << std::endl;

    return 0;
}



Measured memory_bytes: 5244
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}

func main() {
  var n,m,a,b int
  var p bool
  n,m = NextInts()
  set := make(map[int]struct{},m)
  p = false
  for i:=0;i<m;i++ {
    a,b = NextInts()
    if a == 1 {
      if _,ok := set[b];ok {
        p = true
        break
      } else {
        set[b] = struct{}{}
      }
    } else if b == n {
      if _,ok := set[a];ok {
        p = true
        break
      } else {
        set[a] = struct{}{}
      }
    }
  }
  if p {
    fmt.Println("POSSIBLE")
  } else {
    fmt.Println("IMPOSSIBLE")
  }
}

Measured memory_bytes: 8192
from itertools import islice

n = int(input())
xs = [0] + [int(x) for x in input().split()] + [0]


total = sum(abs(a-b) for a,b in zip(xs, islice(xs, 1, None)))

for i in range(1, n+1):
    print(total - abs(xs[i-1] - xs[i]) - abs(xs[i] - xs[i+1]) + abs(xs[i-1] - xs[i+1]))

Measured memory_bytes: 14284
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
const int mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int v[n];
    f(n) {
        cin >> v[i];
    }
    if (n == 1) {
        cout << abs(v[n-1]-b) << '\n';
    }
    else {
        cout << max(abs(v[n-1]-b),abs(v[n-1]-v[n-2])) << '\n';
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 5e5 + 9, M = 1e6 + 9, OO = 1e9 + 7, MOD = 1e9 + 7, MOD2 = 998244353;
const ll INF = 2e18;
using namespace std;

int main() {
	fastIO;
#ifdef LOCAL
//	freopen("input.in", "rt", stdin);
#endif
	int a, b, c;
	cin >> a;
	b = a;
	c = a;
	ll sum = 0;
	for (int i = 1; i <= a; ++i) {
		for (int j = 1; j <= b; ++j) {
			int g = __gcd(i, j);
			for (int k = 1; k <= c; ++k) {
				sum += __gcd(g, k);
			}
		}
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,m,q;
struct uzi{
  int a,b,c,d;
}p[N];
int a[N];
LL ans;
void dfs(int now,int pre){
  if(now>n){
    LL pa=0;
    for(int i=1;i<=q;i++){
      if(a[p[i].b]-a[p[i].a]==p[i].c)pa+=p[i].d;
    }
    ans=max(ans,pa);
    return ;
  }
  for(int i=pre;i<=m;i++){
    a[now]=i;
    dfs(now+1,i);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>m>>q;
  for(int i=1;i<=q;i++){
    cin>>p[i].a>>p[i].b>>p[i].c>>p[i].d;
  }
  dfs(1,1);
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 3668
/*
 
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <int, string> pis;
typedef pair <int, char> pic;
typedef pair <long long, int> pli;
typedef pair <long long, string> pls;
typedef pair <long long, char> plc;
typedef pair <string, int> psi;
typedef pair <string, long long> psl;
typedef pair <string, char> psc;
typedef pair <char, int> pci;
typedef pair <char, long long> pcl;
typedef pair <char, string> pcs;
 
int n, m;
 
int main () {
	cin >> n >> m;
	if (n * 500 >= m) {
			cout << "Yes";
			return 0;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int x;
  cin >> x;
  cout << x * x * x << endl;
}

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

bool ada[28];

int main() {
	string s;
	cin >> s;
	for(char c : s) {
		ada[c] = 1;
	}
	bool gak = true;
	for(char i = 'a'; i <= 'z'; ++i) {
		if(ada[i] == 0) {
			cout << i << endl;
			return 0;
		}
	}
	puts("None");
}

Measured memory_bytes: 512
N,K = map(int,input().split())
x = [int(i) for i in input().split()]

ans = 10**10
for i in range(N-K+1):
    left = x[i]
    right = x[K-1+i]
    if left<0 and right<0:
        ans = min(ans,abs(left))
    elif left<0 and right>=0 and right<abs(left):
        ans = min(ans,right*2+abs(left))
    elif left<0 and right>=0 and right>=abs(left):
        ans = min(ans,abs(left)*2+right)
    else:
        ans = min(ans,right)
print(ans)

Measured memory_bytes: 14252
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
 
var A = Int(split[0])!
var B = Int(split[1])!

if (A>2*B){
    print(A-2*B)
}else{
    print(0)
}


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

int main(){
    int n;
    cin >> n;
    map<ll, ll> mp;
    mp[0]++;
    ll sum = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        sum += a;
        mp[sum]++;
    }
    ll ans = 0;
    for(auto x : mp){
        ans += x.second*(x.second-1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16136
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d,g;
    cin >> d >> g;
    int p[11],c[11];
    REP(i,d) cin >> p[i] >> c[i];
    int ans = INF;
    REP(i,1<<d){
        ll score = 0;
        int count = 0;
        REP(j,d){
            if((i>>j)&1){
                score += p[j]*(j+1)*100+c[j];
                count += p[j];
            }
        }
        for(int j=d-1;j>=0;j--){
            if((i>>j)&1)continue;
            if(score>=g)break;
            int q = min((ll)p[j],(g-score)/((j+1)*100));
            count += q;
            score += q*(j+1)*100;
        }
        if(score>=g) ans = min(ans,count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// ISU

#include <iostream>

using namespace std;

int main(){
	int X, Y, Z;
	cin >> X >> Y >> Z;

	int res = 0;

	X -= Z; // left side space

	while(1){
		if (X >= Y+Z){
			X -= Y;
			res++;
			X -= Z; // right side space
		}else
			break;
	}

	cout << res << endl;

	return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    
    ll r,g,b,n;cin>>r>>g>>b>>n;
    ll ans=0;
    rep(i,0,n){
        rep(j,0,n){
            ll t=i*r+j*g;
            if(t>n)continue;
            if((n-t)%b==0)ans++;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,char> p2;
void solve(){
	ll n,res=0;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++){
		cin>>v[i];
		res^=v[i];
	}
	for(ll i=0;i<n;i++)
	cout<<(res^v[i])<<" ";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 4764
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <queue>

#define ll long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){ return (a % b)? gcd(b, a%b) : b; }
template<typename T> T lcm(T a, T b){ return a * b / gcd(a, b); }

int main(void){
    int n;
    cin >> n;
    int d[n][2];
    REP(i,n){
        cin >> d[i][0] >> d[i][1];
    }

    bool flag = false;
    REP(i,n-2){
        if(d[i][0] == d[i][1] && d[i+1][0] == d[i+1][1] && d[i+2][0] == d[i+2][1]){
            flag = true;
        }
    }
    
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    String k = sc.nextLine();
	    int returnnum = 0;
	    if (k.contains("RRR")) {
	    	returnnum = 3;
	    } else if (k.contains("RR")) {
	    	returnnum = 2;
	    } else if (k.contains("R")) {
	    	returnnum = 1;
	    }
	    System.out.println(returnnum);
	}
}


Measured memory_bytes: 26924
// finish date: 2019/2/22

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N, K;
    cin >> N >> K;
    vi a(N);
    rep(i, N) cin >> a[i];
    vb dp(K + 1, false);
    rep(i, N) dp[a[i]] = true;
    rep(i, K + 1) {
        if (dp[i]) continue;
        rep(j, N) {
            if (i + a[j] <= K) {
                dp[i + a[j]] = true;
            }
        }
    }
    if (dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}

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

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

	e = a*b;
	f = c*d;

	if(e>f) {
		cout << e << endl;
	} else if(e == f) {
		cout << e << endl;
	} else {
		cout << f << endl;
	}

	return 0;
}

Measured memory_bytes: 256
a=[0]
a.extend(list(map(int,input().split())))
a.extend(list(map(int,input().split())))
a.extend(list(map(int,input().split())))
n=int(input())
for i in range(n):
    b=int(input())
    for k in range(10):
        if a[k]==b:
            a[k]=0
t="No"
if a[1]==0 and a[2]==0 and a[3]==0:
    t="Yes"
if a[4]==0 and a[5]==0 and a[6]==0:
    t="Yes"
if a[7]==0 and a[8]==0 and a[9]==0:
    t="Yes"
if a[1]==0 and a[4]==0 and a[7]==0:
    t="Yes"
if a[2]==0 and a[5]==0 and a[8]==0:
    t="Yes"
if a[3]==0 and a[6]==0 and a[9]==0:
    t="Yes"
if a[1]==0 and a[5]==0 and a[9]==0:
    t="Yes"
if a[3]==0 and a[5]==0 and a[7]==0:
    t="Yes"

print(t)


Measured memory_bytes: 3192
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, q;
	cin>>n>>q;
	ll a[100001];
	ll s[100001], s0[100001], s1[100001]; s[0]=0, s0[0]=0, s1[0]=0;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
		s0[i]=s0[i-1], s1[i]=s1[i-1];
		if(i&1) s1[i]+=a[i];
		else s0[i]+=a[i];
	}
	ll x[100001];
	int ind[100001];
	ll ans[100001];
	for(int i=0; i<q; i++){
		cin>>x[i];
		ind[i]=i;
	}
	sort(ind, ind+q, [&](int i, int j){ return x[i]>x[j];});
	int t=n;
	for(int i=0; i<q; i++){
		ll x0=x[ind[i]];
		if(x0>=a[n]){
			if(n&1) ans[ind[i]]=s1[n];
			else ans[ind[i]]=s0[n];
			continue;
		}
		while(t>=1){
			ll d1=a[t]-x0;//d2=a[t+1]-x0;
			int i1=lower_bound(a+1, a+n+1, x0-d1)-a;
			//int i2=lower_bound(a+1, a+n+1, x0-d2)-a;
			if(t-i1+1>n-t) t--;
			else break;
		}
		if(n&1) ans[ind[i]]=s[n]-s[t]+s1[2*t-n];
		else ans[ind[i]]=s[n]-s[t]+s0[2*t-n];
	}
	for(int i=0; i<q; i++) cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 6784