akhauriyash/Code-Regression huggingface dataset:
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
bool prime[10000001];

ll pow(ll x, ll p){
  ll res = 1;
  ll curr = x;
  ll tmp = p;
  while(tmp){
    if(tmp % 2 == 1)res = res * curr;
    tmp /= 2;
    curr = curr * curr;
  }
  return res;
}

int main(int argc, char const* argv[])
{
  ll n, p;
  cin >> n >> p;
  if(n == 1){
    cout << p << endl;
    return 0;
  }
  fill(prime, prime + 1000001, true);
  prime[1] = false;
  FOR(i, 2, 1000001){
    if(prime[i]){
      for(int j = 2; j * i <= 1000000; j++){
        prime[i * j] = false;
      }
    }
  }
  ll res = 1;
  for(ll i = 2; i < 1000001; i++){
    if(!prime[i])continue;
    int tmp = 0;
    ll ptmp = p;
    while(ptmp % i == 0){
      ptmp /= i;
      tmp++;
    }
    res = res * pow(i, tmp / n);
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 1280
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	var n int
	var m int
	var currentDepth int
	var progress bool

	sc.Split(bufio.ScanWords)
	n = nextInt()
	m = nextInt()

	conn := make([][]int, n)
	for i := 0; i < m; i++ {
		a := nextInt()
		b := nextInt()
		a--
		b--
		conn[a] = append(conn[a], b)
		conn[b] = append(conn[b], a)
	}

	depth := make([]int, n)
	signpost := make([]int, n)
	for i := 0; i < n; i++ {
		depth[i] = -1
		signpost[i] = -1
	}
	depth[0] = 0

	depth2room := make([][]int, n)
	depth2room[0] = append(depth2room[0], 0)
	currentDepth = 0
	progress = true
	for progress {
		progress = false
		for i := 0; i < len(depth2room[currentDepth]); i++ {
			for j := 0; j < len(conn[depth2room[currentDepth][i]]); j++ {
				if depth[conn[depth2room[currentDepth][i]][j]] == -1 {
					depth[conn[depth2room[currentDepth][i]][j]] = currentDepth + 1
					signpost[conn[depth2room[currentDepth][i]][j]] = depth2room[currentDepth][i] + 1
					depth2room[currentDepth+1] = append(depth2room[currentDepth+1], conn[depth2room[currentDepth][i]][j])
					progress = true
				}
			}
		}
		currentDepth++
	}

	for i := 0; i < n; i++ {
		if depth[i] == -1 {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
	for i := 1; i < n; i++ {
		fmt.Println(signpost[i])
	}
}


Measured memory_bytes: 18540
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
const LL mod=1e9+7;
const LL LL_MAX=9223372036854775807;
using namespace std;
int main()
{
    string s;
    int n,k;
    cin>>n>>k;
    cin>>(s);
    s[k-1]=s[k-1]-'A'+'a';
    cout<<s<<endl;
    return 0;
}


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

int a, b;
int main()
{
	string str;
	int cnt = 0;
	cin >> a >> b;
	REP(i, a, b + 1) {
		str = to_string(i);
		if (str[0] == str[4] && str[1] == str[3]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
(let* ((n (read))
       (m (read))
       (sum 0)
       (a (make-array `(,n) :initial-element 0)))
  (loop :for i :from 0 :to (1- n)
        :do (progn
              (setf (aref a i) (read))
              (incf sum (aref a i))))
  (setf a (sort a #'>))
  (if (>= (aref a (1- m)) (/ sum (* 4 m)))
      (format t "Yes~%")
      (format t "No~%")))


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int n, c;
  cin >> n >> c;
  map<int, vector<p>> mp;

  for (int i = 0; i < n; i++) {
    int start, goal, ch;
    cin >> start >> goal >> ch;
    mp[ch].push_back({start, goal});
  }

  for (int i = 1; i <= c; i++) {
    sort(all(mp[i]));
  }

  int now = 1;
  map<int, int> use;
  int res = 0;
  bool isLoop = true;
  int no_use = 0;
  map<int, int> num;

  while(isLoop) {
    if(now > 100000) break;

    for (int i = 1; i <= c; i++) {
      if(use[i] == now) {
        no_use++;
        use[i] = 0;
      }
    }


    for (int i = 1; i <= c; i++) {
      if(num[i] >= int(mp[i].size())) continue;
      int start = mp[i][num[i]].first;
      // int goal = mp[i][num[i]].second;


      if(start == now){
        for (int j = num[i]; j < int(mp[i].size()); j++) {
          use[i] = mp[i][num[i]].second + 1;
          num[i] = j + 1;
          if(j == int(mp[i].size()) - 1) break;
          if(use[i]-1 != mp[i][num[i]].first) break;
        }
        if(no_use > 0) {
          no_use--;
        }else{
          res++;
        }
      }
    }

    isLoop = false;
    for (int i = 1; i <= c; i++) {
      if(int(mp[i].size()) > num[i]) {
        isLoop = true;
        break;
      }
    }
    now++;
  }

  cout << res << endl;
}


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

struct Parser {
    using itr = string::const_iterator;
    itr now;
    const int ABC_SIZE = 26;
    string ans;
    const struct ex {
        vector<char> ABCZ;
        ex() {
            ABCZ.resize(27);
            for(int i = 0; i < 26; ++i) {
                ABCZ[i] = char('A' + i);
            }
            ABCZ.back() = '?';
        }
    } ex;
    // <Cipher> ::= <String> [<String>]*
    // <String> ::= <Letter> | '['<Cipher>']'
    // <Letter> ::= ['+' | '-']* [A-Z | ?]
    Parser(const string &s) {
        now = s.begin();
        ans = Cipher(now);
    }
    // <Cipher> ::= <String> [<String>]*
    string Cipher(itr &now) {
        string ret = String(now);
        while(*now != ']' and *now != '\0') {
            ret += String(now);
        }
        return ret;
    }
    // <String> ::= <Letter> | '['<Cipher>']'
    string String(itr &now) {
        if(*now == '[') {
            next(now, '[');
            string ret = Cipher(now);
            next(now, ']');
            reverse(ret.begin(), ret.end());
            return ret;
        } else {
            string ret(1, Letter(now));
            return ret;
        }
    }
    // <Letter> ::= ['+' | '-']* [A-Z | ?]
    char Letter(itr &now) {
        int cnt = 0;
        while(*now == '+' or *now == '-') {
            if(*now == '+') {
                cnt++;
                next(now, '+');
            }
            if(*now == '-') {
                cnt--;
                next(now, '-');
            }
        }
        cnt %= ABC_SIZE;
        char ret = *now;
        if(ret != '?') ret = 'A' + (((ret - 'A') + cnt + ABC_SIZE) % ABC_SIZE);
        next(now, ex.ABCZ);
        return ret;
    }

    void next(itr &now, const char expected) {
        vector<char> req = {expected};
        next(now, req);
    }
    void next(itr &now, const vector<char> &expected) {
        for(char c: expected){
            if(*now == c){
                now++;
                return;
            }
        }
        // デバッグ用
        fprintf(stderr, "Expected: ");
        for(char c: expected) fprintf(stderr, "%c", c);
        fprintf(stderr, "\nGot: %c\n", *now);
        fprintf(stderr, "Rest: ");
        while(*now) fprintf(stderr, "%c", *now++);
    }
};

int main(){
    string s;
    while(cin >> s and s != ".") {
        Parser parse(s);
        for(char &c : parse.ans) {
            if(c == '?') c = 'A';
        }
        cout << parse.ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3148
#include <iostream>
#include <cstdio>
#define MN 20010

typedef long long ll;

ll Min[MN], lazy[MN];

void add(int x, ll v) {lazy[x] += v; Min[x] += v;}
void pushdown(int x)
{
	if(lazy[x]) 
	{
		add(x << 1, lazy[x]);
		add(x << 1 | 1, lazy[x]);
		lazy[x] = 0;
	}
}

void modify(int x, int l, int r, int L, int R, ll v, int t)
{
	if(L > R) return;
	if(l == L && r == R)
	{
		if(t == 0) add(x, v);
		else Min[x] = v;
		return;
	}
	pushdown(x); int mid = l + r >> 1;
	if(R <= mid) modify(x << 1, l, mid, L, R, v, t);
	else if(L > mid) modify(x << 1 | 1, mid + 1, r, L, R, v, t);
	else modify(x << 1, l, mid, L, mid, v, t), modify(x << 1 | 1, mid + 1, r, mid + 1, R, v, t);
	Min[x] = std::min(Min[x << 1], Min[x << 1 | 1]);
}

ll query(int x, int l, int r, int L, int R)
{
	if(l == L && r == R) return Min[x];
	pushdown(x); int mid = l + r >> 1;
	if(R <= mid) return query(x << 1, l, mid, L, R);
	else if(L > mid) return query(x << 1 | 1, mid + 1, r, L, R);
	else return std::min(query(x << 1, l, mid, L, mid), query(x << 1 | 1, mid + 1, r, mid + 1, R));
}

int main()
{
	int n, a, b; 
	scanf("%d%d%d", &n, &a, &b);
	modify(1, 0, n, 0, n, 1e18, 0);
	modify(1, 0, n, 0, 0, 0, 1);
	for(int i = 1; i <= n; i++)
	{
		int x; scanf("%d", &x);
		modify(1, 0, n, x, x, query(1, 0, n, 0, x), 1);
		modify(1, 0, n, 0, x - 1, a, 0);
		modify(1, 0, n, x + 1, n, b, 0);
	}
	printf("%lld\n", query(1, 0, n, 0, n));
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  char b;
  cin >> b;
  if (b == 'A') cout << "T\n";
  if (b == 'T') cout << "A\n";
  if (b == 'C') cout << "G\n";
  if (b == 'G') cout << "C\n";
  return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const int INF = 0x3fffffff;
const ll INF2 = (ll)INF*INF;


int main(){
	ll a[3], ans=INF2;

	rep(i,3) cin >> a[i];
	rep(i,3){
		if( a[i] % 2ll ) chmin( ans, a[(i+1)%3]*a[(i+2)%3] );
		else chmin(ans, 0ll);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    arr = list(map(int, input().split()))

    pref = []

    dup = arr.copy()
    dup.reverse()

    pref.append(dup[0]);
    
    for i in range(1,n):
       pref.append(pref[i-1]+dup[i]);
    
    pref.reverse()

    ans = 0

    for i in range(n-1):
        ans += arr[i] * pref[i+1];

    ans %= 1000000007;

    print(ans)


if __name__ == '__main__':
    main();


Measured memory_bytes: 31616
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size()/2;i++){
        if(s[i]!=s[s.size()-i-1])ans++;
    }


    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 5005, MOD = 1e9 + 7;
int n, a, b, dp[N][N], ps[N], p[N][N];

void add(int & x, int y) {
	x += y;
	if (x >= MOD) x -= MOD;
}

int get(int l, int r, int k) {
	if (r < 0) return 0;
	if (k == -1)
		return (ps[r] - ((l > 0) ? ps[l - 1] : 0) + MOD) % MOD;
	return (p[r][k] - ((l > 0) ? p[l - 1][k] : 0) + MOD) % MOD;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> a >> b;
	if (a > b) swap(a, b);
	dp[0][0] = ps[0] = p[0][0] = 1;
	for (int i = 1; i <= n + 1; i++) {
		for (int j = 0; j <= i; j++) {
			if (min(n, i) - max(1, j) + 1 >= b) continue;
			add(dp[i][j], dp[i - 1][j]);
			add(dp[i][j], get(0, i - a - 1, j));
		}
		add(dp[i][i], get(i - a, i - 2, -1));
		ps[i] = ps[i - 1];
		for (int j = 0; j <= n; j++) {
			add(ps[i], dp[i][j]);
			p[i][j] = p[i - 1][j];
			add(p[i][j], dp[i][j]);
		}
	}
	int res = 0, pw = 1;
	for (int i = 0; i < n; i++) pw = pw * 2 % MOD;
	for (int i = 0; i <= n + 1; i++) {
		add(res, dp[n + 1][i]);
	}
	cout << (pw - res + MOD) % MOD;
}


Measured memory_bytes: 168212
import math
import fractions

a,b = map(int,input().split())

gcd = fractions.gcd(a,b)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

div = make_divisors(gcd)
ans = 1
for i in range(1,len(div)) :
  check = 0
  for j in range(2,math.floor(math.sqrt(div[i]))+1) :
    if div[i]%j == 0 :
      check = 1
      break
  if check == 0 :
    ans += 1

print(ans)

Measured memory_bytes: 5300
mod = 10 ** 9 + 7

S = input()

l = len(S)
dp = [[0 for i in range(13)] for j in range(l+1)]

dp[0][0] = 1

for i, num in enumerate(S):

    if num == "?":
        for k in range(10):
            for j in range(13):
                dp[i+1][((j * 10) + k) % 13] += dp[i][j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(num)
        for j in range(13):
            dp[i+1][((j * 10) + k) % 13] += dp[i][j]
            # nextdp[((j * 10) + k) % 13] %= mod

    for j in range(13):
        dp[i+1][j] %= mod

print(dp[l][5])


Measured memory_bytes: 91196
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int  N;
    cin >> N;
    int answer = 0;

    for (int i = 0; i < N; i++){
        int l,r;
        cin >> l >> r;
        answer += r - l + 1;
    }
    cout << answer << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) ((X) = ((X) + (Y) % mod) % mod)

int x, k, q;
int r[100000 + 5];
pair<int, int> ta[100000 + 5];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x;
    cin >> k;
    rep(i, k) cin >> r[i];
    r[k] = INT_MAX;
    cin >> q;
    rep(i, q) cin >> ta[i].fi >> ta[i].se;
    int l = 0;
    int hl = 0;
    int ri = x;
    int hr = x;
    int now = 0;
    int j = 0;
    rep(i, q) {
        int t = ta[i].fi;
        int a = ta[i].se;
        while (j <= k) {
            if (j % 2 == 0) {
                if (t > r[j]) {
                    int d = r[j] - now;
                    now = r[j];
                    l = l + max(d - hl, 0);
                    hl = max(hl - d, 0);
                    hr = max(hr - d, 0);
                    j++;
                }
                else {
                    int d = t - now;
                    now = t;
                    l = l + max(d - hl, 0);
                    hl = max(hl - d, 0);
                    hr = max(hr - d, 0);
                    if (a < l) cout << hl << endl;
                    else if (l <= a && a <= ri) cout << a - l + hl << endl;
                    else cout << hr << endl;
                    break;
                }
            }
            else {
                if (t > r[j]) {
                    int d = r[j] - now;
                    now = r[j];
                    ri = ri - max(0, hr + d - x);
                    hr = min(x, hr + d);
                    hl = min(x, hl + d);
                    j++;
                }
                else {
                    int d = t - now;
                    now = t;
                    ri = ri - max(0, hr + d - x);
                    hr = min(x, hr + d);
                    hl = min(x, hl + d);
                    if (a < l) cout << hl << endl;
                    else if (l <= a && a <= ri) cout << a - l + hl << endl;
                    else cout << hr << endl;
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
//    freopen("fence.out", "w", stdout);
#endif

    int n, a;
    cin >> n >> a;
    vector<int> arr(n);
    for (int &x : arr) {
        cin >> x;
        x -= a;
    }
    int m = 2500;

    vector<vector<long long>> dp(n + 1, vector<long long>(m * 2 + 1, 0));
    dp[n][m] = 1;
    for (int idx = n - 1; ~idx; --idx) {
        for (int sum = 0; sum <= 2 * m; ++sum) {
            dp[idx][sum] = dp[idx + 1][sum - arr[idx]] + dp[idx + 1][sum];
        }
    }

    cout << dp[0][m] - 1 << '\n';

    return 0;
}

Measured memory_bytes: 5300
#include<cstdio>
#include<vector>

using namespace std;

using ll=long long;
using vll=vector<ll>;

int max_u(ll&m, ll v)
{
	if(m<v)
	{
		m=v;
		return 1;
	}
	return 0;
}


void disp(vll&v)
{
	for(int i=0;i<v.size();i++)
	{
		printf("[%d]%lld ", i, v[i]);
	}
	printf("\n");
}


int main(void)
{
	int n;
	ll c;

	while(scanf("%d%lld", &n, &c)==2)
	{
		vector<ll> x(n+2), v(n+2), cw(n+2), ccw(n+2), rcw(n+2), rccw(n+2);
		ll ans=0;
		ll sum;

		x[0]=0;
		x[n+1]=c;
		for(int i=1;i<=n;i++)
		{
			scanf("%lld%lld", &x[i], &v[i]);
		}

		sum=0;
		for(int i=1;i<=n;i++)
		{
			sum+=v[i]-(x[i]-x[i-1]);
			cw[i]=max(cw[i-1], sum);
			rcw[i]=cw[i]-x[i];
		}
		sum=0;
		for(int i=1;i<=n;i++)
		{
			sum+=v[n+1-i]-(x[n+2-i]-x[n+1-i]);
			ccw[i]=max(ccw[i-1], sum);
			rccw[i]=ccw[i]-(c-x[n+1-i]);
		}
//		disp(cw);
//		disp(ccw);

		for(int i=1;i<=n;i++)
		{
			max_u(ans, cw[i]+rccw[n-i]);
			max_u(ans, ccw[i]+rcw[n-i]);
		}
		printf("%lld\n", ans);
	}

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N;i++){
    	cin >> A.at(i);
    }

    bool approve = true;

    for(int i=0;i<N;i++){
        if(A.at(i)%2==0){
            if(A.at(i)%3!=0&&A.at(i)%5!=0) approve = false;
        }
    }

    if(approve) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;

    return 0;
}


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

int main() {
  const double r=0.01;
  long int X,ans=0,org=100;
  cin >> X;
  
  if(X<=org){
    cout << ans << endl;
    return 0;
  }else ans++;

  while(ans){
    if(X<=(org+=(org*r))) break;
    else ans++;
  }

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

Measured memory_bytes: 3632
n,l,t=map(int,input().split())
a,cs=[0]*n,0
for i in range(n):
	x,y=map(int,input().split())
	x+=(t if y==1 else -t)
	cs=(cs+x//l)%n
	x%=l
	a[i]=x
a.sort()
print('\n'.join([str(a[(i+cs)%n]) for i in range(n)]))


Measured memory_bytes: 60888
#include<bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
int main() 
{  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,l;
        cin>>n>>l;
        ll arr[n],sum=0;
        for(int i=0;i<n;i++)
        {
            arr[i]=i+l;
           // cout<<arr[i]<<" ";
            sum+=arr[i];
        }
        ll min1=INT_MAX;
        ll ans=1;
        for(int i=0;i<n;i++)
        {
            ll sum1=(sum-arr[i]);
             if(abs((sum-sum1))<min1)
             {
                 min1=abs(sum-sum1);
                 ans=sum1;
             }
        }
        cout<<ans;
        
    }
    
    return 0;
}

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

//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
 
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define fo(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define foe(i,x) for(auto& i: x)
#define ar array
#define pb push_back
#define vt vector
#define F first
#define S second

template<class T> bool umin(T& a,const T& b){return b<a?a=b,1:0;}
template<class T> bool umax(T& a,const T& b){return b>a?a=b,1:0;}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {cin>>x;}
void read(double& d) {string t;read(t);	d=stod(t);}
void read(long double& d) {	string t;read(t);d=stold(t);}
template<class H, class... T> void read(H& h, T&... t) {read(h);read(t...);}
template<class A> void read(vt<A>& x) {	foe(a, x)read(a);}

// no change 
const ll MOD = 1e9+7;  
const int mx = 1e5;
int n;
void Titan(){
	ll m;

	read(n,m);
	int ans = 0;
	fo(n){
		ll x,y;
		cin >> x >> y;
		if((x*x + y*y) <= m*m)ans++;


	}
	cout << ans;
}
	

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T = 1;
	//cin >> T;		//cmt if one test case
    fo(T){
		//cout << "Case #" << i+1 << ": " ;
		Titan();
	}
}
/*///////////////////////////////////////////////////////////
Important Notes : 
* check long long 
* check base cases
* do not loose Hope
* if case fails on 2nd test case maybe some cases are missing check them
* do not sit idle
* try to do it using pen/paper.
*/


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N; cin >> N;
  int sum = 0;
  vec d(N); rep(i, N) {
    cin >> d[i];
    sum+=d[i];
  }

  int res = 0;
  rep(i, N) res+=d[i]*(sum-d[i]);

  cout << res/2 << endl;

  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))

for i, p in enumerate(P):
  P[i] = (1 + p) / 2
  
sum_ = sum(P[:K])
res = sum_

for i in range(K, N):
  sum_ = sum_ - P[i-K] + P[i]
  res = max(sum_, res)
  
print(res)

Measured memory_bytes: 24548
#include<iostream>
#include<string>
#include<algorithm> 
using namespace std;
int main(){
  int a=0,b=0,bb=0,c,xb=0;
  bool k=0;
  cin>>a>>b;
  bb=b;
  while(bb){
    xb++;
    bb=bb/10;
  }
  c=a;
  for(int i=1;i<=xb;i++){
    c*=10;
  }
  c+=b;
  for(int i=0;i<=c/2;i++){
    if(i*i==c) k=1;
  }
  if(k)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
a = list(Counter(A).values())
mod = 10 ** 9 + 7

if N % 2 == 0:
    if a.count(2) == N // 2:
        ans = 1
        for i in range(N // 2):
            ans = ans * 2 % mod
        print(ans)
    else:
        print(0)
else:
    if a.count(2) == N // 2 and A.count(0) == 1:
        ans = 1
        for i in range(N // 2):
            ans = ans * 2 % mod
        print(ans)
    else:
        print(0)

Measured memory_bytes: 14820
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int i=0;
        for(int j=1; j<=10000; j++){
            i = sc.nextInt();
            if(i==0) break;
            System.out.println("Case "+j+": "+i);
        }
        sc.close();
    }
}

Measured memory_bytes: 44676
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
void sum (string &sum, string& a, string& b);

int main(){
  string a1, a2;
  int n, A1, A2;

  cin >> n;
  for(int i = 0; i < n ; i++){
    string sum0 = "";
    cin >> a1 >> a2;
    reverse(a1.begin(), a1.end());
    reverse(a2.begin(), a2.end());
    A1 = a1.length();
    A2 = a2.length();
    if(A1 < A2) {
      swap (A1, A2);
      swap (a1, a2);
    }

    for(int i = 0; i < A1 - A2; i++)   a2 += '0';

    sum(sum0, a1, a2);

    if (sum0.length() > 80) sum0 = "overflow";
    else  reverse(sum0.begin(), sum0.end());
    
    cout << sum0 << endl;
  }
}

void sum(string& buff, string& a, string& b){
  //string buff = "";
  int x = 0, y ;
  for(int i = 0; i < a.length(); i++){
    y = a[i] - '0' + b[i] - '0';
    if (y + x > 9){
      buff += (y + x)% 10 + '0';
      x = 1;
    } else {
      buff += y + x + '0';
      x = 0;
    }
  }
  if (x==1) buff += '1';
  //return &buff;
}

    

Measured memory_bytes: 1220
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
std::vector<P> G[100010];
ll dist[100010];

void dfs( ll v, ll p = -1, ll d = 0 )
{
  dist[v] = d;

  for( auto u : G[v] ) if( u.first != p )
    dfs( u.first, v, d+u.second );

  return;
}

int main()
{
  std::cin >> N;

  rep( i, N-1 )
  {
    ll u, v, w;
    std::cin >> u >> v >> w;
    --u; --v;

    G[u].emplace_back( v, w );
    G[v].emplace_back( u, w );
  }

  dfs( 0 );

  rep( i, N )
    std::cout << (dist[i]&1) << std::endl;

  return 0;
}

Measured memory_bytes: 10240
#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;}

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

int main(){

  ll n,k;
  cin >> n >> k;
  ll R,S,P;
  cin >> R >> S >> P;
  string t;
  cin >> t;
  ll sum = 0;
  rep(i,k) t += 'n';
  rep(i,n){
    if(t[i]==t[i+k]){
      t[i+k] = 'n';
    }
    if(t[i]=='r'){
      sum+=P;
    }else if(t[i]=='p'){
      sum += S;
    }else if(t[i]=='s'){
      sum += R;
    }
    // cout << sum << endl;
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define maxn 5005
#define mod 998244353
using namespace std;


int main(){

ll int a;
long db b,c;
cin>>a>>b;
c=a*b;
ll int x=c;
cout<<x<<endl;
}

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

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

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

  vector<queue<int>> a(n, queue<int>());
  rep(i,n)rep(j,n-1){
    int now;
    cin >> now;
    now--;
    a.at(i).push(now);
  }

  int day = 0;
  while(1){
    vector<int> done(n,1);
    int count=0;
    int check=0;
    rep(i,n){
      if(!a.at(i).empty()){
        check++;
        int me=i, you=a.at(i).front();
        if(done.at(me)*done.at(you)&&a.at(you).front()==me){
          a.at(i).pop();
          a.at(you).pop();
          done.at(me)=0;done.at(you)=0;
          count++;
          //cout<< me<<"vs"<<you<<endl; 
        }
      }
    }
    if(!check) break;
    if(count) day++;
    else {day=-1; break;}
  }
  cout << day;
}

Measured memory_bytes: 8072
$N=<>-1;
@AAA=@BBB=@CCC=@DDD=1;
for$i(1..$N){
	for$j(@_=glob'{A,B,C,D}'x3){
		"$j$_"=~/ABC|A.*C.*B|CAB/ or$j=~/./,(${$'.$_}[$i]+=$$j[$i-1])%=$%=1e9+7for A..D
	}
}
$x=($x+$$_[$N])%$%for@_;
print$x


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

string solve(string str){
	for(int i = 0; i < str.length(); i++){
		str[i] -= 32;
	}
	return str;
}
int main(){
	string s, s1, s2;
	cin >> s >> s1 >> s2;
	string ans;
	ans += s[0];
	ans += s1[0];
	ans += s2[0];
	ans = solve(ans);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b)
{
	return b > 0 ? gcd(b,a % b):a;
}
long long ans,a[110];
int n;
int main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)scanf("%lld",&a[i]);
	ans = a[1];
	for(int i = 2;i <= n;i++)
		ans = ans / gcd(ans,a[i]) * a[i];
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,k,dp[305][305][305],h[305],l;
ll d[305],u[305];
vector<ll>cm;
void up(ll &x,ll y){
	x=min(x,y);
}
int main(void){
    cin>>n>>k;
    cm.PB(0);
    for(int i=1;i<=n;i++){
		cin>>h[i];
		cm.PB(h[i]);
	}
	sort(cm.begin(),cm.end());
	cm.erase(unique(cm.begin(),cm.end()),cm.end());
	for(int i=0;i<=n;i++)h[i]=lower_bound(cm.begin(),cm.end(),h[i])-cm.begin();
	l=cm.size();
	for(int i=0;i<=n;i++)for(int j=0;j<=k;j++)for(int r=0;r<=l;r++)dp[i][j][r]=INF;
	dp[0][0][0]=0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=k;j++){
			d[0]=INF,u[l]=INF;
			for(int r=0;r<l;r++){
				d[r]=dp[i-1][j][r]-cm[r];
				if(r>0)up(d[r],d[r-1]);
			}
			for(int r=l-1;r>=0;r--){
				u[r]=dp[i-1][j][r];
				up(u[r],u[r+1]);
			}
			up(dp[i][j][h[i]],min(d[h[i]]+cm[h[i]],u[h[i]]));
			if(j==0)continue;
			
			for(int r=0;r<l;r++){
				d[r]=dp[i-1][j-1][r]-cm[r];
				if(r>0)up(d[r],d[r-1]);
			}
			u[l]=INF;
			for(int r=l-1;r>=0;r--){
				u[r]=dp[i-1][j-1][r];
				up(u[r],u[r+1]);
			}
			for(int r=0;r<l;r++){
				up(dp[i][j][r],min(d[r]+cm[r],u[r]));
			}
			
		}
	}
	ll ans=INF;
	for(int i=0;i<=k;i++)for(int j=0;j<l;j++)up(ans,dp[n][i][j]);
	cout<<ans<<endl;
}


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

using namespace std;

int main(){
	int N; cin >> N;
	int p[N];
	for(int i = 0; i < N; ++i) cin >> p[i];
	sort(p, p + N);
	p[N - 1] /= 2;
	cout << accumulate(p, p + N, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    string s[3];
  	for(int i=0; i<3; i++)
    	cin >> s[i];
	
  	for(int i=0; i<3; i++)
    	cout << s[i][i];

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;
#define int long long
#define loop(i,a,b) for(i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define vct vector
#define stk stack
#define qu queue
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define br break
#define con continue
#define re return
#define tc(t) int t; cin>>t; while(t--)
#define q(q) int q; cin>>q; while(q--)
#define subs substr
#define er erase
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;
signed main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        /*int te;
        cin>>te;
        while(te--)*/{
                int s,max_sum=0,temp_sum=0,even=0,odd=0,color=1,oka=5,okb=0,inda=-1,indb=-1,n,maxf=INT_MAX,y,index=0,d,z,p=1,i,j,k,x=1,l,sum=0,ans=0,count=LONG_MAX,count2=0,count1=0,count3=0,ans1,ans2,berry=0,straw=0,berry1=0,straw1=0,berry2=0,straw2=0;
                cin>>n>>k;
                vct<int> v(n+1);
                loop(i,1,n+1){
                        cin>>v[i];
                }
                vct<int> t(n+1,INT_MAX);
                t[1]=0;
                t[2]=abs(v[2]-v[1]);
                t[0]=0;
                for(i=3;i<=min(n,k);i++){
                        t[i]=abs(v[i]-v[1]);
                }
                loop(i,k+1,n+1){
                        for(j=i-k;j<=i;j++){
                                t[i]=min(t[i],t[j]+abs(v[i]-v[j]));
                        } 
                }
                cout<<t[n];
        }
        return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n){
        cin >> p[i];
    }
    int count = 0;
    for(int i = 1; i <= n; i++){
        if(p[i-1] != i){
            count++;
        }
    }
    if(count <= 2){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" <<endl;
    }
    return 0;
}


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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
signed main(){
	int a,b,m,re=INF;
	cin>>a>>b>>m;
	int s[100010],t[100010];
	rep(i,a)cin>>s[i];
	rep(i,b)cin>>t[i];
	int memo[100010];
	rep(i,a)memo[i]=t[0];
	rep(i,m){
		int x,y,z;
		cin>>x>>y>>z;
		x--;
		y--;
		chmin(memo[x],t[y]-z);
	}
	sort(t,t+b);
	rep(i,a)chmin(memo[i],t[0]);
	rep(i,a){
		chmin(re,s[i]+memo[i]);
	}
	cout<<re<<endl;
}


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

int main(void){
  int n;
  char s[100];
  map<string,int> blood;
  blood["A"]=0;
  blood["B"]=0;
  blood["O"]=0;
  blood["AB"]=0;
  while(scanf("%d,%s",&n,s)!=EOF){
    blood[s]+=1;
  }
  cout<<blood["A"]<<endl;
  cout<<blood["B"]<<endl;
  cout<<blood["AB"]<<endl;
  cout<<blood["O"]<<endl;
  return 0;
}



Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main(){
int n,x;
while(1){
cin>>n>>x;
if(n==0&&x==0)break;
int res=0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
for(int k=j+1;k<=n;k++){
if(i+j+k==x)res++;
}}}
cout<<res<<endl;
}
return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta (bas + (son-bas)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1e18
#define N 1000005

using namespace std;
 
typedef long long ll;


int main()
{
    int a;
    string s;
    cin >> a;
    cin >> s;

    if (a < 3200)
    {
    	cout << "red";
    } else cout<< s;
    

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,w=MI()
lis=[LI() for i in range(n)]
u=lis[0][0]
vals=[[] for i in range(4)]
for i in range(n):
    if lis[i][0]==u:
        vals[0].append(lis[i][1])
    elif lis[i][0]==u+1:
        vals[1].append(lis[i][1])
    elif lis[i][0]==u+2:
        vals[2].append(lis[i][1])
    else:
        vals[3].append(lis[i][1])
#print(vals)
for i in range(4):
    vals[i].sort(reverse=True)
    vals[i]=list(accumulate(vals[i]))
    vals[i]=[0]+vals[i]
mx=0
#print(vals)
for i in range(len(vals[0])):
    for j in range(len(vals[1])):
        for k in range(len(vals[2])):
            for l in range(len(vals[3])):
                if u*i+(u+1)*j+(u+2)*k+(u+3)*l>w:
                    continue
                V=vals[0][i]+vals[1][j]+vals[2][k]+vals[3][l]
                if V>mx:
                    mx=V
print(mx)
            
        

    

        
        
        
            
        

                

Measured memory_bytes: 74292
package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n,m := input.NextInts()
  u := NewUnionFind(n+m)
  for i:=0;i<n;i++ {
    k,l := input.NextIntArray()
    for j:=0;j<k;j++ { u.Unite(i,n+l[j]-1) }
  }
  for i:=0;i<n;i++ {
    if !u.Same(i,0) { fmt.Println("NO");return }
  }
  fmt.Println("YES")
}

type UnionFind struct { par,rnk []int }
func NewUnionFind(n int) UnionFind {
  par := make([]int,n)
  rnk := make([]int,n)
  for i:=0;i<n;i++ { par[i] = i }
  return UnionFind{par,rnk}
}
func(u UnionFind) Find(i int) int {
  if u.par[i] == i { return i }
  u.par[i] = u.Find(u.par[i])
  return u.par[i]
}
func(u UnionFind) Same(i,j int) bool { return u.Find(i) == u.Find(j) }
func(u UnionFind) Unite(i,j int) {
  i,j = u.Find(i),u.Find(j)
  if i == j { return }
  if u.rnk[i] < u.rnk[j] { u.par[i] = j;return }
  u.par[j] = i
  if u.rnk[i] == u.rnk[j] { u.rnk[i]++ }
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  n,_ := strconv.Atoi(s[0])
  m,_ := strconv.Atoi(s[1])
  return n,m
}
func(i *Input) NextIntArray() (int,[]int) {
  s := strings.Split(i.NextLine()," ")
  a := make([]int,len(s)-1)
  k,_ := strconv.Atoi(s[0])
  for i:=1;i<len(s);i++ { a[i-1],_ = strconv.Atoi(s[i]) }
  return k,a
}

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

typedef long long ll;

int main()
{
    ll i,j;
    map<string, int> mp;
    int n;
    cin >> n;
    for(i = 0;i < n;++i){
        string s;
        cin >> s;
        if(mp.find(s) == mp.end()){
            mp[s] = 1;
        }else{
            ++mp.at(s);
        }
    }
    vector<string> ans;
    int max = 0;
    for(auto it = mp.begin();it != mp.end();++it){
        int tmp = it->second;
        if(tmp > max){
            max = tmp;
        }
    }
    for(auto it = mp.begin();it != mp.end();++it){
        int tmp = it->second;
        if(tmp == max){
            ans.push_back(it->first);
        }
    }
    sort(ans.begin(), ans.end());
    for(i = 0;i < ans.size();++i){
        cout << ans.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 26868
N = int(input())
N_temp = N
temp = 0
ans = 0


for i in range(len(str(N)))[::-1]:
    temp = 0
    temp += N_temp // (10 ** i)

    N_temp -= temp * 10 ** i

    ans += temp

if N % ans == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>

using namespace std;
int main() {
    long long K,A,B;
    cin >> K >> A >> B;

    if (A >= B) cout << 1 + K << endl;
    else {
        long long val = B - A;
        if (val <= 2) {
            cout << 1 + K << endl;
            return 0;
        }
        long long needhit = A - 1;
        if (needhit > K) {
            cout << 1 + K << endl;
            return 0;
        }

        long long nokori = K - needhit;
        cout << A + nokori%2 + val * (nokori/2) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll facmemo[200000] = {};

ll factorial(ll n) {//階乗
	if (facmemo[n] != 0) return facmemo[n];
	if (n == 0) return 1;
	ll ret = n * factorial(n - 1);
	ret %= MODU;
	return facmemo[n] = ret;
}

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b, ll m) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b, m - 2, m)) % m;
}
ll ncr(ll n, ll r) {
	if (r == 0) return 1;
	if (n < r) return 1;
	return divmod(factorial(n), (factorial(r) * (factorial(n - r))) % MODU, MODU);
}

bool sankaku(int a, int b, int c) {
	return a <= b + c && b <= a + c && c <= b + a;
}

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

	cout << (n + max(h, w)-1) / max(h, w) << endl;

	return 0;
}


Measured memory_bytes: 764
#include <stdio.h>

int main() {
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a < b && b < c) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2104