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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 4 * 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,k;
  cin >> n >> k;
  vector<int32> x(n),y(n);
  REP(i,n){
    cin >> x[i] >> y[i];
  }
  int64 ans = LLINF;
  REP(xi,n-1)FOR(xj,xi+1,n){
    REP(yi,n-1)FOR(yj,yi+1,n){
      int32 cnt = 0;
      int64 lx = x[xi];
      int64 rx = x[xj];
      if(lx > rx)swap(lx,rx);
      int64 ly = y[yi];
      int64 ry = y[yj];
      if(ly > ry)swap(ly,ry);
      REP(i,n){
        if(lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry)cnt++;
      }
      if(cnt >= k){
        ans = min(ans, abs(x[xi] - x[xj]) * abs(y[yi] - y[yj]));
      }
    }
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // 入力
        Scanner         sc = new Scanner(System.in);

        int             n;
        while ((n = Integer.parseInt(sc.next())) != 0) {
            double[]        S = new double[n];
            double          sum = 0;
            for (int i = 0; i < n; i++) {
                S[i] = Double.parseDouble(sc.next());
                sum += S[i];
            }

            // 平均点を求める
            double          ave = sum / (double) S.length;
            // 偏差の二乗の合計をデータの総数で割り、分散を求める
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += (S[i] - ave) * (S[i] - ave);
            }
            double         sd = Math.sqrt(sum / (double) S.length);

            // 出力
            System.out.println(sd);
        }
        sc.close();
    }
}



Measured memory_bytes: 32212
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int H,W,N;
    cin >> H >> W >> N;
    vector<int> vec;
    rep(i,0,N){
        int a;
        cin >> a;
        rep(j,0,a)vec.push_back(i + 1);
    }
    rep(i,0,H){
        int idx = i % 2 ? -1 : 1;
        int num = i % 2 ? i * W + W-1: i * W;
        rep(j,0,W){
            cout << vec[num] << " ";
            num += idx;
        }
        cout << endl;
    }
    
}

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

int main()
{
    int h,w;
    std::cin >> h >> w;
    std::vector<std::string> map(h);
    for(int i = 0; i < h; i++)std::cin >> map[i];
    std::vector<bool> chack2(h);
    for(int i = 0; i < h; i++){
        bool res = true;
        for(int j = 0; j < w; j++)if(map[i][j] == '#')res = false;
        chack2[i] = res;
    }
    std::vector<bool> chack(w);
    for(int i = 0; i < w; i++){
        bool res = true;
        for(int j = 0; j < h; j++)if(map[j][i] == '#')res = false;
        chack[i] = res;
    }

    for(int i = 0; i < h; i++){
        if(chack2[i])continue;
        for(int j = 0; j < w; j++){
            if(chack[j])continue;
            std::cout << map[i][j];
        }
        std::cout << std::endl;
    }
}

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

int main(){
    int n,m,Q; cin >> n >> m >> Q;
    vector<vector<int>> vec;
    rep(i,Q) {
        int a,b,c,d; cin >> a >> b >> c >> d;
        vec.push_back({a,b,c,d});
    }
    queue<vector<int>> que;
    for(int i = 1;i <= m;++i) que.push({i});
    while(1){
        vector<int> q = que.front();
        if(q.size()==n) break;
        que.pop();
        int x = q[q.size()-1];
        for(int i = x;i<=m;++i){
            vector<int> r = q;
            r.push_back(i);
            que.push(r);
        }
    }
    int ans = 0;
    while(que.size()){
        int score = 0;
        vector<int> q = que.front();que.pop();
        rep(i,Q){
            int a = vec[i][0],b = vec[i][1],c = vec[i][2],d = vec[i][3];
            a--;b--;
            if(q[b]-q[a] == c) score += d;
        }
        ans = max(ans,score);
    }
    cout << ans << endl;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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;
}

const int MAX = 100010;

int main()
{
    int x;
    cin >> x;
    int cnt = 1;
    while (true)
    {
        if ((x * cnt) % 360 == 0)
        {
            cout << cnt << endl;
            return 0;
        }
        ++cnt;
    }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
typedef long long ll;
#define MAXN 6
using namespace std;
char s[MAXN]; 
int main()
{
 cin>>s;
 for(int i=0;i<strlen(s)-1;i++)
 {
  if(s[i]=='A'&&s[i+1]=='C')
  {puts("Yes");return 0;}
 }
 puts("No");
 return 0;
}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int a,b;
	cin >> a >> b;
	if(a>b){
		cout << -1 << endl;
		return 0;
	}
	int st = round(double(100)/8*a);
	int en = 10*b;
	for(int cur = min(st,en); cur <= max(st,en); cur++){
		int aa = cur*8/100;
		int bb = cur/10;
		if(aa==a&&bb==b){
			cout << cur << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
from math import sqrt
def is_prime(n) :
    if (n <= 1) :
        return False
    if (n <= 3) :
        return True
    # check 6k+0,2,3,4
    if (n % 2 == 0 or n % 3 == 0) :
        return False
    i = 5
    while(i * i <= n) :
        # check 6k+1, 6k+5
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

nums = [0] * (100001)
for i in range(1, 100001):
    if is_prime(i) and is_prime( (i + 1) // 2):
        nums[i] = 1
for i in range(1, 100001):
    nums[i] += nums[i-1]

Q = int(input())
for _ in range(Q):
    l, r = list(map(int, input().split()))
    print(nums[r] - nums[l-1])

Measured memory_bytes: 54364
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
// ll mod = 1000000007;
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
const int maxn = 2e6 + 10;
ll fac[maxn];
  // ll r[maxn];
ll call(ll n,ll m){
	ll temp = fac[n+m+2];
	temp *= inverse(fac[n+1]);
	temp %= mod;
	temp *= inverse(fac[m+1]);
	temp %= mod;
	return temp;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
    fac[0] = 1;
    fac[1] = 1;
    repa(i,2,maxn-2){
    	fac[i] = fac[i-1]*i;
    	fac[i] %= mod;
    }
    ll r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
   	ll ans = 0;
   	ans += call(r2,c2);
   	ans -= call(r2,c1-1);
   	ans += mod;
   	ans %= mod;
   	ans -= call(r1-1,c2);
   	ans += mod;
   	ans %= mod;
   	ans += call(r1-1,c1-1);
   	ans %= mod;
   	cout<<ans;
	return 0;
}

Measured memory_bytes: 15872
n = int(input())
ls = list(map(int, input().split()))

def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

a = merge_sort(ls)
i = 0
while i < n-1:
    if a[i] == a[i+1]:
        print("NO")
        break
    else:
        i += 1

if i == n-1:
    print("YES")
    

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

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};





int main(){
	int a, b;
	while(cin >> a, a){
		b = 1000 - a;
		int ret = 0;
		while(b != 0){
			if(b >= 500){
				ret+= b/500;
				b %= 500;
			}else if(b >= 100){
				ret += b/100;
				b %= 100;
			}else if(b >= 50){
				ret += b/50;
				b %= 50;
			}else if(b >= 10){
				ret += b/10;
				b %= 10;
			}else if(b >= 5){
				ret += b/5;
				b %= 5;
			}else{
				ret += b;
				b = 0;
			}
		}
		cout << ret << endl;
	}

	return 0;
}


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

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

    if(n==0)
      break;

    char c[100];
    for(int i=0; i<n; i++){
      cin >> c[i];
    }

    int cnt[26] = {0};

    for(int i=0; i<n; i++){
      cnt[(int)(c[i]-'A')]++;

      int max1 = -1;
      int max2 = -2;

      for(int j=0; j<26; j++){
	if(cnt[j]>max1){
	  max2 = max1;
	  max1 = cnt[j];
	}
	else if(cnt[j]>max2){
	  max2 = cnt[j];
	}
      }

      if(max1-max2>n-(i+1)){
	for(int j=0; j<26; j++){
	  if(cnt[j]==max1){
	    cout << (char)(j+'A') << ' ';
	    break;
	  }
	}
	cout << (i+1) << endl;
	break;
      }

      if(i==n-1){
	cout << "TIE" << endl;
	break;
      }
    }
  }

  return 0;
}




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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll cnt = 0;
  string s;
  cin >> s;
  ll size = s.size();
  rep(i,size){
    if(s[i]=='o') cnt++;
  }
  if(cnt+(15-size)>=8) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define per(i,a,b) for (int i=(a); i>=(b); --i)
#define REP(i,a) for (int i=0; i<(a); ++i)
#define PER(i,a) for (int i=int(a)-1; i>=0; --i)
using namespace std;
typedef long long LL;

const int maxn = 150005;
struct node { LL x, y; } f[maxn], g[maxn];
int l[maxn], r[maxn], v[maxn], n, fa;
vector<node> a[maxn];
LL L, R, mid;

inline bool operator < (node a, node b) {
	return a.x < b.x || a.x == b.x && a.y < b.y;
}

void merge(vector<node> &a, vector<node> &b, vector<node> &c, LL limit) {
	int n = 0, m = 0, cur = 0, p = 1, q = 1;
	REP (i, a.size()) {
		while (cur + 1 < b.size() && a[i].y + b[cur+1].x <= limit) cur++;
		if (cur < b.size() && a[i].y + b[cur].x <= limit && (!n || b[cur].y != f[n].y))
			f[++n] = (node){a[i].x, b[cur].y};
	}
	cur = int(b.size()) - 1;
	PER (i, a.size()) {
		while (cur - 1 >= 0 && a[i].x + b[cur-1].y <= limit) cur--;
		if (cur >= 0 && a[i].x + b[cur].y <= limit && (!m || b[cur].x != g[m].y))
			g[++m] = (node){b[cur].x, a[i].y};
	}
	sort(f+1, f+n+1); sort(g+1, g+m+1);
	while (p <= n || q <= m) {
		if (p <= n && (q > m || f[p] < g[q])) c.push_back(f[p]);
		else c.push_back(g[q]);
		while (p <= n && (c.back().x == f[p].x || c.back().y <= f[p].y)) p++;
		while (q <= m && (c.back().x == g[q].x || c.back().y <= g[q].y)) q++;
	}
}

bool check(LL limit) {
	// printf("======= %lld =======\n", limit);
	per (i, n, 1) {
		a[i].clear();
		if (!l[i]) {
			a[i].push_back((node){v[i], v[i]});
			continue;
		}
		if (a[l[i]].size() < a[r[i]].size())
			merge(a[l[i]], a[r[i]], a[i], limit);
		else
			merge(a[r[i]], a[l[i]], a[i], limit);
		if (a[i].empty()) return 0;
		REP (j, a[i].size())
			a[i][j].x += v[i], a[i][j].y += v[i];
		// printf("%d  ", i);
		// REP (j, a[i].size())
			// printf("(%d,%d) ", a[i][j].x, a[i][j].y);
		// puts("");
	}
	return 1;
}

int main() {
	// freopen("travel.in", "r", stdin);
	// freopen("travel.out", "w", stdout);
	scanf("%d", &n);
	rep (i, 2, n) {
		scanf("%d%d", &fa, &v[i]);
		if (!l[fa]) l[fa] = i;
		else r[fa] = i;
	}
	L = 0; R = 1LL << 34;
	while (L < R) {
		mid = (L + R) >> 1;
		if (check(mid)) R = mid;
		else L = mid + 1;
	}
	printf("%lld\n", L);
	return 0;
}

Measured memory_bytes: 31212
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int Q = scanner.nextInt();
    int[] score = new int[N];
    for (int i = 0; i < Q; i++) score[scanner.nextInt() - 1]++;
    for (int i = 0; i < N; i++) {
      if (score[i] + K - Q > 0) System.out.println("Yes");
      else System.out.println("No");
    }
  }
}


Measured memory_bytes: 55088
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#include <map>
#include <climits>
#include <vector>
#include <set>
#include <string>
#include <numeric>

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define flood(arr, char, size) for (int i=0; i<size; i++) arr[i] = char
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 1e5 + 2;
const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

int32_t main() {
    FAST_IO;
    int n, k;
    cin >> n >> k;
    int hasSnack[n];
    flood(hasSnack, 0, n);
    for (int i=0; i<k; i++) {
        int x;
        cin >> x;
        for (int j=0; j<x; j++) {
            int p;
            cin >> p;
            p--;
            hasSnack[p] = 1;
        }
    }
    int cnt=0;
    for (int i=0; i<n; i++) {
        if (hasSnack[i] == 0) cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <algorithm>
#include <cctype>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 2e5+5;
int n, a[N];
int main()
{
    n = read();
    for(int i = 1; i <= n; ++i) a[i] = read();
    sort(a+1, a+1+n); reverse(a+1, a+1+n);
    for(int i = 1; i <= n; ++i)
        if(i+1 > a[i+1])
        {
            int ans = 0;
            for(int j = i+1; a[j] == i; ++j) ans ^= 1;
            ans |= (a[i]-i)&1;
            puts(ans?"First":"Second");
            return 0;
        }
    return 0;
}

Measured memory_bytes: 512
N,M = map(int,input().split())

counter=0
#まずあるものでsccを作る
raw_scc=min(N//1,M//2)
N-=raw_scc
M-=raw_scc*2
counter+=raw_scc

#のこったcだけで作る
counter+=M//4
print(counter)

Measured memory_bytes: 2940
n = int( input() )
h = list( map( int, input().split() ) )

ret = 0
number_of_move = 0
for i in range( n - 1 ):
  if h[i] >= h[i+1]:
    number_of_move += 1
  else:
    ret = max( number_of_move, ret )
    number_of_move = 0

print( max( number_of_move, ret ) )


Measured memory_bytes: 14252
#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>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
ll f[1500001], invf[1500001];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(x<y) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int main()
{
    int n, a, b, c; cin>>n>>a>>b>>c;
    fac(2*n);
    ll x=100*inv(a+b)%MOD;
    a=a*inv(100)%MOD*x%MOD;
    b=b*inv(100)%MOD*x%MOD;
    ll an=powmod(a, n), bn=powmod(b, n);
    ll ap=1, bp=1;
    ll ans=0;
    for(ll i=0; i<n; i++){
        ans+=(n+i)*comb(n-1+i, n-1)%MOD*(an*bp%MOD+bn*ap%MOD)%MOD;
        ans%=MOD;
        ap*=a;
        bp*=b;
        ap%=MOD;
        bp%=MOD;
    }
    cout<<ans*x%MOD<<endl;
    return 0;
}

Measured memory_bytes: 6392
/* 
Rohit645
Rohit Kumar 
*/

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

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end() 
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;

int main() {
	fastIo();
	ll n; cin >> n;
	string str; cin >> str;
	if (n < 3200) cout << "red\n";
	else cout << str << endl;
	return 0;
}

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

using namespace std;

const int MOD = 1e9 + 7;

long long my_pow(long long a, long long lv) {
    long long res = 1;
    long long p = a;
    while (lv) {
        if (lv & 1) res = res * p % MOD;
        p = p * p % MOD;
        lv >>= 1;
    }
    return res;
}

long long f(int l, int r) {
    long long res = 1;
    for (int i = l; i <= r; i++) {
        res = res * i % MOD;
    }
    return res;
}

int main() {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);

    long long all = my_pow(2, n);
    all = (all + MOD - 1) % MOD;
    long long cntA = f(n - a + 1, n) * my_pow(f(1, a), MOD - 2) % MOD;
    long long cntB = f(n - b + 1, n) * my_pow(f(1, b), MOD - 2) % MOD;
    all = (all - cntA + MOD) % MOD;
    all = (all - cntB + MOD) % MOD;

    printf("%lld\n", all);
}


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

typedef long long ll;
const int INF = 1 << 30;

int m[26], r[26];

int main(){
    for (int i = 0; i < 26; i++){
        m[i] = -1;
        r[i] = -1;
    } 

    string s, t;
    cin >> s >> t;

    for (int i = 0; i < s.size(); i++){
        int s_i = s[i] - 'a';
        int t_i = t[i] - 'a';
        if (m[s_i] != -1 || r[t_i] != -1){
            if (m[s_i] != t_i || r[t_i] != s_i){
                cout << "No" << endl;
                return 0;
            }
        } else {
            m[s_i] = t_i;
            r[t_i] = s_i;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 776
//make sure to make new file!
import java.io.*;
import java.util.*;

public class Main{
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      StringTokenizer st = new StringTokenizer(f.readLine());
      
      long a = Long.parseLong(st.nextToken());
      long b = Long.parseLong(st.nextToken());
      long n = Long.parseLong(st.nextToken());
      
      long value = Math.min(b-1,n);
      
      long answer = (a*value)/b - a * (value/b);
      
      out.println(answer);
      
      
      
      
      
      
      
      
      
      out.close();
   }
   
      
}

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

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using ml = map<ll,ll>;

#define ff first
#define ss second
#define endl '\n'
#define ins insert
#define eb emplace_back
#define sz(c) (ll) c.size()
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define itr(x,c) for(auto &x : c)
#define tc ll t; cin >> t; while (t--)
#define rep(i,a,n) for(ll i = a ; i <= n ; ++i)
#define per(i,a,n) for(ll i = n-1 ; i >= a ; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) itr(x,c) cout << x << " "; cout << endl;
#define dm(m) itr(x,m) cout << x.f << "->" << x.s << endl;
#define godspeed cin.tie(0) -> sync_with_stdio(0);

int main() {
    godspeed;
    ll k, a, b; cin >> k >> a >> b;

   	rep(i,a,b) if(i%k == 0) {cout << "OK"; return 0;}

   	cout << "NG";
}

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

int main() {
	int k,t; cin >> k >> t;
	vector<int> a(t);
	for(int i=0;i<t;++i) cin >> a[i];
	sort(a.begin(),a.end());
	
	int m = a.back();
	int s = accumulate(a.begin(),a.end(),0) - m;
	
	int ans;
	if(s >= m-1) ans = 0;
	else ans = m-1-s;
	
	cout << ans << endl;
	
	return 0;
}

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


void solve(long long A, long long B){
    if(A+B>=10) cout << "error" << endl;
    else cout << A+B << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

int main(){
	int N,a,b,c,d,x,y;
  
  	cin >> N;
  	a = N/1000;
  	x = N%1000;
  	b = x/100;
  	y = x%100;
  	c = y/10;
	d = y%10;
  
  	if(a == b && b == c){
    	cout << "Yes" << endl;
    }else if(b == c && c == d){
  		cout << "Yes" << endl;
	}else if(a == b && b == c && c == d ){
      	cout << "Yes" << endl;
    }else{
    	cout << "No" <<endl;
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll nCk(ll n,ll k){
  if((n&k)==k){return 1;}
  return 0;
}
int main(){
  ll N,a=0,b=0;
  string str;
  cin>>N>>str;
  vector<ll> vec(N);
  for(ll i=0;i<N;i++){
    vec.at(i)=str.at(i)-'0'-1;
    if(vec.at(i)==1){a++;}
    b+=nCk(N-1,i)*(vec.at(i)%2);
    b%=2;
  }
  if(b==1){cout<<1<<endl;return 0;}
  if(a!=0){cout<<0<<endl;return 0;}
  for(ll i=0;i<N;i++){
    vec.at(i)/=2;
    b+=nCk(N-1,i)*vec.at(i);
  }
  if(b%2==1){cout<<2<<endl;return 0;}
  cout<<0<<endl;return 0;
}

Measured memory_bytes: 9220
class Cmber:
    def __init__(self,gensize,mod=10**9+7):
        self.mod = mod
        self.g1=[1,1]
        self.g2 = [1, 1] #逆元テーブル
        self.inverse = [0, 1] #逆元テーブル計算用テーブル
        self.getgen(gensize)
    def getgen(self,N):
        for i in range( 2, N + 1 ):
            self.g1.append( ( self.g1[-1] * i ) % self.mod )
            self.inverse.append( ( -self.inverse[self.mod % i] * (self.mod//i) ) % self.mod )
            self.g2.append( (self.g2[-1] * self.inverse[-1]) % self.mod )
 
    def cmb(self,n, r):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return self.g1[n] * self.g2[r] * self.g2[n-r] % self.mod
 
    def cmb_very_high_n(self,n, r):
        if ( r<0 or r>n ):
            return 0
        g1=1
        r = min(r, n-r)
        for i in range(n-r+1,n+1):
            g1*=i
            g1%=self.mod
        return g1 * self.g2[r] % self.mod

    def multiple_cmb(self,vals):
        ans = self.g1[sum(vals)] % self.mod
        for i in vals:
            ans = (ans*self.g2[i])%self.mod
        return ans










def resolve():
    N,M,K = map(int,input().split())
    cmber = Cmber(N*M)
    score = 0
    for dist in range(1,N):
        cmb_of_2 = dist*(((((N-dist)*M)%cmber.mod)*M)% cmber.mod) % cmber.mod

        score = (score+(cmb_of_2*cmber.cmb(N*M-2,K-2))%cmber.mod)%cmber.mod
        
    for dist in range(1,M):
        cmb_of_2 = dist*(((((M-dist)*N)%cmber.mod)*N)% cmber.mod) % cmber.mod

        score = (score+(cmb_of_2*cmber.cmb(N*M-2,K-2))%cmber.mod)%cmber.mod

    print(score)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 81392
#include<bits/stdc++.h>
#define N 2009
using namespace std;
typedef long long LL;

int main()
{
    int x, a, b;
    scanf("%d%d%d", &x, &a, &b);
    if(x+a < b) puts("dangerous");
    else if(a>=b) puts("delicious");
    else puts("safe");
    return 0;
}


Measured memory_bytes: 256
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = int(input())
    pool = [S]
    while True:
        if pool[-1]%2 == 0:
            nxt = pool[-1]//2
        else:
            nxt = pool[-1]*3+1
        if nxt in pool:
            print(len(pool)+1)
            return 0
        else:
            pool.append(nxt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3952
#include <iostream>
#include <cstdio>

using namespace std;
    
int main(){
    int N;
    long long Y;
    cin >> N >> Y;

    int x, y, z;
    for(x = 0; x <= N; x++){
        for(y = 0; y <= N - x; y++){
            z = N - (x + y);
            long long sum = 10000*x + 5000*y + 1000*z;
            if(sum == Y)
                goto answer;
        }
    }

    printf("%d %d %d\n", -1, -1, -1);
    return 0;

answer:
    printf("%d %d %d\n", x, y, z);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string str;

        var result = new List<int>();       
        int sum = 0;
        
       while (true)
        {
            str = Console.ReadLine();

            if (str == "0")
            {
                break;
            }

            char[] num = str.ToCharArray();          

            for (int i = 0; i < num.Length; i++)
            {
                sum += int.Parse(num[i].ToString());
            }
            result.Add(sum);
            sum = 0;
        }

        foreach (var v in result)
        {
            Console.WriteLine(v);
        }

    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
	int h, w = 0;
	cin >> h >> w;
	vector<string> str(h);
	REP(i, h)
	{
		cin >> str[i];
	}
	REP(i, h)
	{
		COUT(str[i]);
		COUT(str[i]);
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,sum;
    int d[100];
    sum=0;
    cin>>n;
    for (int i=0;i<n;i++) cin>>d[i];
    for (int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            sum+=d[i]*d[j];
        }
    }
    cout<<sum<<endl;
}

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

class Cube{
	public:
		int f[6];
		Cube(){}
		void roll_z(){ roll(1, 2, 4, 3);}
		void roll_y(){ roll(0, 2, 5, 3);}
		void roll_x(){ roll(0, 1, 5, 4);}
		void roll(int i, int j, int k, int l){
			int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
		}
};

int getRight(Cube c1, int f1, int f2){
	for(int i=0;i<6;i++){
		for(int j=0;j<4;j++){
			if(c1.f[0] == f1 && c1.f[1] == f2) return c1.f[2];
			c1.roll_z();
		}
		if(i%2 == 0) c1.roll_y();
		else c1.roll_x();
	}
	return -1;
}

int main(){
	Cube c;
	int f1,f2;

	for(int i=0;i<6;i++) cin >> c.f[i];
	int q; cin >> q;

	for(int i=0;i<q;i++){
		cin >> f1 >> f2;
		cout << getRight(c,f1,f2) << endl;
	}

	return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int a, b, c, d; cin >> a >> b >> c >> d;
	int k; cin >> k;
	int n=a*60+b, m=c*60+d;
	cout << m-n-k << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    ll N, mx, a;
    cin >> N;
    mx = 0;
    vector<ll> v(N);
    rep(i,N){
        cin >> v[i];
    }
    rep(i,N){
        rep(j,N){
            a = v[i] - v[j];
            mx = max(mx,a);
        }
    }
    cout << mx << endl;
}


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

using namespace std;

int main()
{
    long long int i , j =  0, k , n;
    cin>>n;
    for( i = 1  ; i <= n ; i++)
    {
        if(i%3!=0 && i%5!=0)j+=i;
    }
    cout<<j<<endl;
    
}

Measured memory_bytes: 3624
def main(input = STDIN)
  while (n = input.gets.to_i) != 0
    player, sum = 0, 0
    n.times do
      a, b = input.gets.split(" ").map(&:to_i)
      player += (a + b) * ((a <=> b) + 1) / 2
      sum += a + b
    end
    puts [player, sum - player].join(" ")
  end
end
main

Measured memory_bytes: 6100
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}



int main() {
  int N=input();
  int sum=0;
  for(int i=1;i<=N;i++){
    int a=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        a++;
      }

    }
    if(a==8&&i%2==1){
      sum++;
    }
  }
  cout<<sum<<endl;
  

  



  
  
  

  


}


Measured memory_bytes: 256
import math
n = int(input())

res = 0
if n <= 1:
	print(res)
else:
	max_num = math.ceil(math.sqrt(n + 1))
	org_n = n
	target_list = []
	for z in range(2, max_num + 1):
		if n % z == 0:
			z_p = 1
			z_count = 0
			while n % z == 0:
				z_p *= z
				n = n // z
				if z_p not in target_list:
					target_list.append(z_p)
					z_p = 1
		if n == z:
			break
	res = len(target_list)
	if n > max_num and n not in target_list:
		res += 1

	print(res)

Measured memory_bytes: 9220
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  cout.precision(12);

  long r, D, x2000;
  cin >> r >> D >> x2000;

  long current = x2000;

  rep (i, 10) {
    current = current * r - D;
    cout << current << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  cin >> N >> A;
  
  if(N % 500 == 0){
    cout << "Yes" << endl;
  }
  else if(N < A){
    cout << "Yes" << endl;
  }
  else if(N % 500 < A){
    cout << "Yes" << endl;
  }
  else if(1) cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//const int mod = 1e9+7;
const int N = 2e5 + 10;
int a[N]; 
ll n, k;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main()
{
    quickread();
    cin >> n >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    unordered_map<int, int> pos;
    pos[1] = 0;
    int next_pos = a[1];
    int cnt = 1;
    while(pos.count(next_pos) == 0 && cnt < k) {
        pos[next_pos] = cnt ++;
        next_pos = a[next_pos];
    }
    if(cnt == k) {
        cout << next_pos << endl;
        return 0;
    }
    int loop = cnt - pos[next_pos];
    int stt = pos[next_pos];
    //cout << stt << " " << loop << endl;
    ll remain = k - stt;
    remain %= loop;
    int po = remain;
    while(po) {
        next_pos = a[next_pos];
        po --;
    }
    cout << next_pos << endl;
    return 0;
}


Measured memory_bytes: 11080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll a[N][2];
int n;
ll GetManhattan(int n, int dem)
{
    ll ans=0,Min,Max;
    int i,j,k;
    for(i=0;i<(1<<(dem));i++) {
        Min=1e18,Max=-1e17;
        for(j=0;j<n;j++){
            ll sum = 0;
            for(k=0;k<2;k++){
                if(i&(1<<k)) sum+=a[j][k];
                else sum-=a[j][k];
            }
            if(sum>Max) Max=sum;
            if(sum<Min) Min=sum;
        }
        ans=max(ans,Max-Min);
    }
    return ans;
}

int main() {
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        for(int j=0;j<2;j++)
            scanf("%lld",&a[i][j]);
    ll ans=GetManhattan(n,2);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 6920
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define pb  push_back
#define F  first
#define S  second
#define mak make_pair
const int N=1e5+3,mod=1e8;
pair<ll,ll>p[N];
ll n,k;
ll oo=-1e9;
ll mem[103][N];

ll dp(int i,int crtw)
{
    if (crtw>k)return 0;
    if (i==n){
            if (crtw+p[i].F<=k)return p[i].S;
    return 0;
    }
    ll &ret=mem[i][crtw];
    if (ret!=-1)return ret;
    ll x1=0,x2=0;
    if (crtw+p[i].F<=k)
         x1=dp(i+1,crtw+p[i].F)+p[i].S;

     x2=dp(i+1,crtw);
    return ret=max(x1,x2);
}

 int main ()
{
 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 memset(mem,-1,sizeof mem);
 cin>>n>>k;
 for (int i=1;i<=n;i++)
    cin>>p[i].F>>p[i].S;
 cout<<dp(1,0);
}


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

using namespace std;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

struct edge{
    int from, to, cost;
    bool operator<(const edge &another) const
    {
        return cost < another.cost;
    };
};

//vector<edge> G[4000];
vector<edge> MST[4000];
vector<edge> es;
bool used[4000];
int max_edge[4000][4000];

int N, M;

void clear_used(){
    for(int i = 0; i < N; i++) used[i] = false;
}

void dfs(int root, int cur, int max_e){
    used[cur] = true;
    max_edge[root][cur] = max_e;
    for(int i = 0; i < MST[cur].size(); i++){
        if(!used[MST[cur][i].to]){
            dfs(root, MST[cur][i].to, max(max_e, MST[cur][i].cost));
        }
    }
}

int main(){
    cin >> N >> M;
    for(int i = 0; i < M ; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        es.push_back(edge{a, b, c});
    }
    UnionFind uf(N);
    sort(es.begin(), es.end());
    long sum = 0;
    for(int i = 0; i < M; i++){
        int from = es[i].from;
        int to = es[i].to;
        int cost = es[i].cost;
        if(uf.root(from) != uf.root(to)){
            //cout << "MST" << endl;
            MST[from].push_back(es[i]);
            MST[to].push_back((edge){to, from, cost});
            uf.unionSet(from, to);
            sum += (long)cost;
        }
    }
    for(int i = 0; i < N; i++){
        clear_used();
        dfs(i, i, 0);
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        //cout << max_edge[s][t] << endl;
        cout << sum-max_edge[s][t] << endl;
    }
}



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

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

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

    int main(){
        int n,d;cin>>n>>d;
        int res = 0;
        rep(i,n){
            res++;
            i += 2*d;
        }
        cout<<res;
    }
    


Measured memory_bytes: 256
// #includes {{{
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cmath>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
#ifdef __MINGW32__
typedef double rn;
#else
typedef long double rn;
#endif

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int W,H,N;
bool col[110][110];
int x,y,a;

int main(){
	cin>>W>>H>>N;
	memset(col,false,sizeof(col));
	REP(i,N){
		cin>>x>>y>>a;
		REP(c,W)REP(d,H){
			bool val = false;
			if(a==1){
				if(c<x)val = true;
			}else if(a==2){
				if(c>=x)val = true;
			}else if(a==3){
				if(d<y)val = true;
			}else if(a==4){
				if(d>=y)val = true;
			}else{
				assert(false);
			}
			if(val)col[c][d] = true;
		}
		/*
		REP(c,W){
			REP(d,H){
				cout<<col[c][d];
			}
			cout<<endl;
		}
		*/
	}
	int ans = 0;
	REP(c,W){
		REP(d,H){
			if(!col[c][d])ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

from itertools import product
D=sorted([a+b for a,b in product(A,B)],reverse=True)
D=D[:K]
E=sorted([d+c for d,c in product(D,C)],reverse=True)
E=E[:K]
for i in range(K):
    print(E[i])


Measured memory_bytes: 149744
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
A.sort(key=lambda x:-abs(x))
mod=10**9+7

ans=1
if (max(A)<=0 and k%2==1) or n==k:
    for i in range(k):
        ans=ans*A[n-1-i]%mod
else:
    mi=0
    pl=0
    flg=1
    for i in range(k):
        ans=ans*A[i]%mod
        if A[i]>0:
            pl=A[i]
        if A[i]<0:
            mi=A[i]
            flg*=-1
    if ans==0:
        pass
    elif flg==-1:
        mi2=None
        pl2=None
        for i in range(k,n):
            if A[i]>=0:
                pl2=A[i]
                break
        for i in range(k,n):
            if A[i]<=0:
                mi2=A[i]
                break
        can=0
        if mi!=0 and pl2 is not None and pl!=0 and mi2 is not None:
            if pl2*pl > mi2*mi:
                can = pow(mi,-1,mod)*pl2%mod
            else:
                can = pow(pl,-1,mod)*mi2%mod
        elif mi!=0 and pl2 is not None:
            can = pow(mi,-1,mod)*pl2%mod
        elif pl!=0 and mi2 is not None:
            can = pow(pl,-1,mod)*mi2%mod
        ans=ans*can%mod

print(ans)


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

using namespace std;

struct Eins {
	vector<long long> st;
	int n;
	Eins(int n) : n(n) {
		st.resize(n << 2| 1);
	}
	void modify(int id,int l,int r,int pos,int val) {
		if (l == r) {
			st[id] += val;
			return ;
		}
		int mid = l + r >> 1;
		if (pos <= mid) modify(id << 1,l,mid,pos,val);
		else modify(id << 1|1,mid+1,r,pos,val);
		st[id] = max(st[id << 1],st[id << 1|1]);
	}
	long long get(int id,int l,int r,int L,int R) {
		if (L <= l && r <= R) return st[id];
		int mid = l + r >> 1;
		if (R <= mid) return get(id << 1,l,mid,L,R);
		if (L > mid) return get(id << 1|1,mid+1,r,L,R);
		return max(get(id << 1,l,mid,L,R),get(id << 1|1,mid+1,r,L,R));
	}
};

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	vector<long long> a(n + 1);
	for (int i = 2;i <= n;i++) cin >> a[i],a[i] += a[i-1];
	vector<vector<int>> b(n + 1,vector<int>(m));
	vector<Eins> Tree(m,Eins(n));
	for (int i = 1;i <= n;i++) {
		for (int j = 0;j < m;j++) {
			cin >> b[i][j];
			Tree[j].modify(1,1,n,i,b[i][j]);
		}
	}
	vector<long long> ans(n + 1);
	vector<int> mx(m);
	function<void(int,int,int,int)> solve = [&](int l,int r,int L,int R) {
		//cout << l <<" " << r <<" " << L <<" " << R << endl;
		if (l > r) return ;
		int mid = l + r >> 1;
		int f = max(L,mid);
		for (int i = 0;i < m;i++) {
			mx[i] = Tree[i].get(1,1,n,mid,f);
		}
		int pos = f;
		long long tong = accumulate(mx.begin(),mx.end(),0ll);
		long long val = tong - a[f];
		for (int i = f;i <= R;i++) {
			for (int j = 0;j < m;j++) {
				if (mx[j] < b[i][j]) {
					tong += b[i][j] - mx[j];
					mx[j] = b[i][j];
				}
			}
			if (val < tong - a[i]) {
				val = tong - a[i];
				pos = i;
			}
		}
		ans[mid] = val + a[mid];
		solve(l,mid-1,L,pos);
		solve(mid+1,r,pos,R);
	};
	solve(1,n,1,n);
	cout << *max_element(ans.begin(),ans.end());
}

Measured memory_bytes: 39624
#include <cstdio>
#include <vector>
using namespace std;

const int MOD = 1e9 + 7;

int main() {
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        int c = (n + m - 1) / (k - 1);
        vector<vector<long long>> dp(c + 1, vector<long long> (m + 1, 0));
        dp[0][0] = 1;
        for (int i = 1; i <= c; i ++) {
                for (int j = 0; j <= m; j ++) {
                        for (int l = 0; l < k && j + l <= m; l ++) {
                                (dp[i][j + l] = dp[i][j + l] + dp[i - 1][j]) %= MOD;
                        }
                }
        }
        long long ans = 0;
        while (m > 0) {
                int nc = (n + m - 1) / (k - 1);
                (ans += dp[nc][m]) %= MOD;
                m -= k - 1;
        }
        printf("%lld\n", ans);
        return 0;
}



Measured memory_bytes: 62848
import java.util.Scanner;

class Main {
	public static void main(String args[]) {

	Scanner std = new Scanner(System.in);


	//System.out.println("r:");
	int r = std.nextInt();
	int g = std.nextInt();
	int b = std.nextInt();
	
	int a = 100*r + 10*g + b;

	if(a % 4 == 0){
		System.out.print("YES");}
	else
		{System.out.print("NO");}


      }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const ll MAX = 2010000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    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;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll mpow(ll base, ll n)
{
    if (n == 0)
        return 1;
    ll prev = mpow(base, n / 2);
    if (n % 2 == 0)
    {
        return (prev * prev) % MOD;
    }
    else
    {
        //assert(prev * prev * base > 0);
        return (((prev * prev) % MOD) * base) % MOD;
    }
}

int main()
{
    COMinit();
    ll a, c, b, d;
    cin >> a >> c >> b >> d;
    ll ans = 0;
    rep(i, a, b + 1)
    {
        ll tmp = (d + 1) * COM(d + i + 1, d + 1);
        tmp %= MOD;
        tmp -= (c * COM(c + i, c)) % MOD;
        while (tmp < 0)
            tmp += MOD;
        tmp *= mpow(i + 1, MOD - 2);
        tmp %= MOD;
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 47360