akhauriyash/Code-Regression huggingface dataset:
import sys
import numpy as np

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N, K = MAP()
A = LIST()

A1 = []
A2 = []
zero = 0
for a in A:
    if a > 0:
        A1.append(a)
    elif a < 0:
        A2.append(-a)
    else:
        zero += 1

B1 = np.log(np.array(A1, dtype=np.longdouble))
B2 = np.log(np.array(A2, dtype=np.longdouble))
A1.sort()
A2.sort()
B1.sort()
B2.sort()
acc1 = np.insert(B1.cumsum(), 0, 0)
accrev1 = np.insert(B1[::-1].cumsum(), 0, 0)
acc2 = np.insert(B2.cumsum(), 0, 0)
accrev2 = np.insert(B2[::-1].cumsum(), 0, 0)
mx = -np.inf
mn = np.inf
idx1 = (-1, -1)
idx2 = (-1, -1)
for i in range(K+1):
    j = K - i
    if len(B1) < i or len(B2) < j:
        continue
    if j % 2 == 0:
        sm = accrev1[i] + accrev2[j]
        if sm > mx:
            mx = sm
            idx1 = (i, j)
    else:
        sm = acc1[i] + acc2[j]
        if sm < mn:
            mn = sm
            idx2 = (i, j)

if mx != -np.inf:
    ans = 1
    n, m = idx1
    A1.reverse()
    A2.reverse()
    for i in range(n):
        ans *= A1[i]
        ans %= MOD
    for i in range(m):
        ans *= -A2[i]
        ans %= MOD
    print(ans)
elif zero:
    print(0)
else:
    ans = 1
    n, m = idx2
    for i in range(n):
        ans *= A1[i]
        ans %= MOD
    for i in range(m):
        ans *= -A2[i]
        ans %= MOD
    print(ans)


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

const int N = 40;
long n, a, m, t, k, c[N], y[N];

int main(){
	cin >> n >> k;
	memset(c, 0, sizeof(c));
	for (int i = 0; i < n; ++i){
		cin >> a;
		for (int j = 0; j < N; ++j) c[j] += ((a & (1L << j)) >> j);
	}
	for (int j = 0; j < N; ++j){
		y[j] = (((k + 1) & (1L << j)) >> j);
	}
	m = 0;
	for (int j = N-1; j >= 0; --j){
		if (y[j] == 1){
			t = c[j] << j;
			for (int i = N-1; i > j; --i) t += (y[i] == 1 ? n - c[i] : c[i]) << i;
			for (int i = 0; i < j; ++i) t += max(c[i], n - c[i]) << i;
			if (m < t) m = t;
		}
	}
	cout << m;
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    string s;
    int co = 0, cx = 0;

    cin >> s;
    for (char c : s) {
        if (c == 'o') ++co;
        else ++cx;
    }
    if (15-cx >= 8) cout << "YES\n";
    else cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define slowanddetermined ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int main()
{
    slowanddetermined

    string s;
    cin>>s;
    set<char>sr;
    for(int i=0;i<3;i++){
        sr.insert(s[i]);
    }
    if(sr.size()>1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }




    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define P pair<int,int>
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}

signed main(){
	ic(k) ic(n)
	int a=n;
	int ans=0;
	int answer=0;
	if(k==1){
		c(n)
		return 0;
	}	
	else if(k<50){
		rep(1,i,1145141){
			rep(0,j,k){
				if(a%i!=0)ans-=1;	
				a/=i;
				ans++;
			}
			if(ans==k)answer=i;
			ans=0;
			a=n;
		}
	}
	else{
		c(1)
		return 0;
	}
	c(answer)
}		
		

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main(void){
    int n, t , a;
    cin >> n;
    cin >> t >> a;
    int opt = 0;
    double t_opt = 1000000;
    int h;
    for (int i=0; i<n; i++){
        cin >> h;
        double tmp = t - h * 0.006;
        if (abs(tmp - a) < t_opt){
            t_opt = abs(tmp - a);
            opt = i + 1;
        }
    }
    cout << opt;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=int(1e5+5);
int n,m;
int a[MAXN];
int main()
{
    scanf("%d%d",&n,&m);
    if(!(1<=n&&n<=9&&1<=m&&m<=9))
        puts("-1");
    else
        printf("%d\n",n*m);
}


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

long long n,res;
string s;

int main()
{
    cin>>n>>s;
    s='#' +s;

    for(int i = 1; i<= n; ++i)
    {
        set<char> s1,s2;
        for(int j = 1; j <= i; ++j)
            s1.insert(s[j]);
        for(int j = i+1; j <= n; ++j)
            s2.insert(s[j]);

        long long curr = 0;
        for(auto j:s1)
            if(s2.count(j))
            curr++;
        res = max(res,curr);
    }

    cout<<res;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int nc = sc.nextInt();
		Interval[] c = new Interval[nc];
		for(int i=0;i<nc;i++) {
			c[i] = new Interval(sc.next());
		}
		int n = sc.nextInt();
		Interval[][] t = new Interval[n][];
		for(int i=0;i<n;i++) {
			int k = sc.nextInt();
			t[i] = new Interval[k];
			for(int j=0;j<k;j++) {
				t[i][j] = new Interval(sc.next());
			}
		}
		int m = sc.nextInt();
		Interval[][] s = new Interval[m][];
		for(int i=0;i<m;i++) {
			int k = sc.nextInt();
			s[i] = new Interval[k];
			for(int j=0;j<k;j++) {
				s[i][j] = new Interval(sc.next());
			}
		}

		int[][] count = new int[2][nc];

		for(int i=0;i<n;i++) {
			for(int j=0;j<t[i].length;j++) {
				for(int k=0;k<nc;k++) {
					if (t[i][j].cover(c[k])) {
//						System.out.println(i + "," + j + "," + k);
						count[0][k]++;
					}
				}
			}
		}
//		System.out.println("----");

		for(int i=0;i<m;i++) {
			for(int j=0;j<s[i].length;j++) {
				for(int k=0;k<nc;k++) {
					if (s[i][j].cover(c[k])) {
//						System.out.println(i + "," + j + "," + k);
						count[1][k]++;
					}
				}
			}
		}
//		System.out.println(Arrays.deepToString(count));

		int ans = 0;
		for(int i=0;i<nc;i++) {
			ans += Math.min(count[0][i],count[1][i]);
		}
		System.out.println(ans);
	}
	static class Interval {
		int l,r;
		public Interval(String s) {
			String[] t = s.split("[:-]");
			l = Integer.parseInt(t[0]) * 60 + Integer.parseInt(t[1]);
			r = Integer.parseInt(t[2]) * 60 + Integer.parseInt(t[3]);
		}
		public boolean cover(Interval i) {
			return l <= i.l && i.r <= r;
		}
	}
}

Measured memory_bytes: 65016
using System;

public class Hello
{
    public static void Main()
    {
        var f = new int[100003];
        var fsum = new int[100003];
        var n = int.Parse(Console.ReadLine().Trim());
        var bmax = 0;
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            bmax = Math.Max(bmax, b);
            f[a]++;
            f[b + 1]--;
        }
        fsum[1] = f[1];
        for (int i = 2; i <= bmax; i++)
            fsum[i] = fsum[i - 1] + f[i];
          var imax = 0;
        for (int i = 2; i <= n+1; i++)
            if (fsum[i] +1 >= i ) imax = i; 
        Console.WriteLine(imax == 0? 0 : imax -1);
    }
}



Measured memory_bytes: 10532
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n, a, b, c, x;
    while(cin >> n >> a >> b >> c >> x, n||a||b||c||x){
        int F[10500] = {0};
        rep(i, n){
            cin >> F[i];
        }
        int loop, i = 0;
        for(loop = 0; loop <= 10000; loop++){
            if(F[i] == x){
                F[i] = 0;
                n--;
                i++;
            }
            x = (a * x + b) % c;
            if(!n) break;
        }
        if(loop <= 10000)
            cout << loop << endl;
        else
            cout << -1 << endl;
    }
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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 Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
const int betsumono = 998244353;
ll modpow(ll a, ll b, ll M) {
	ll res = 1;
	for (; b > 0; b >>= 1) {
		if (b & 1) res = (res * a) % M;
		a = a * a % M;
	}
	return res;
}
ll mypow(ll x, ll y) {
	if (x == 0 || y == 0) return 0;
	else return modpow(x, y, betsumono);
}
int main() {
	int n;
	cin >> n;
	int i;
	V a(n);
	VL count(100000,0);
	bool start = false;
	rep(i, n) {
		cin >> a[i];
		if (i == 0 && a[i] == 0) start++;
		count[a[i]]++;
	}
	if (!start || count[0] >= 2) {
		cout << 0 << endl;
		return 0;
	}
	int MAX = *max_element(all(a));
	ll ans = 1;
	for (i = 1; i <= MAX; i++) {
		ll P = mypow(count[i - 1], count[i]); // オーバーフローに気を付ける(普通にans*powだとダメだった)
		ans *= P;
		ans %= betsumono;
	}
	cout << ans << endl;
	return 0;
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
   fast;
   int n,k;
   cin >> n >> k;
   int mult = n/k;
   int ans = pow(mult, 3);

   if(k % 2 == 0) {
      int cnt = 0;
      f(i,1,n+1) if(i % k == k/2) cnt++;
      ans += pow(cnt , 3);
   }

   cout << ans << "\n";
}

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

int fn(int x) {
	if (x <= 399) return 1;
	else if (x <= 799) return 2;
	else if (x <= 1199) return 3;
	else if (x <= 1599) return 4;
	else if (x <= 1999) return 5;
	else if (x <= 2399) return 6;
	else if (x <= 2799) return 7;
	else if (x <= 3199) return 8;
}

int arr[105];
set<int> s;

int main() {
	// freopen("input.in", "r", stdin);
	// freopen("output.o", "w", stdout);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i] >= 3200) cnt++;
		else {
			s.insert(fn(arr[i]));
		}
	}
	int lower = n - cnt;
	if (lower == 0) {
		printf("%d %d", 1, n);
		return 0;
	}
	int mini = (int) s.size();
	int maxa = (int) s.size() + cnt;
	printf("%d %d", mini, maxa);
}

Measured memory_bytes: 256
n,m=map(int,input().split())
lr=[list(map(int,input().split())) for i in range(m)]
low=1
high=n
for i in range(m):
  low=max(lr[i][0],low)
  high=min(lr[i][1],high)
ans=high-low+1
print(max(ans,0))

Measured memory_bytes: 27332
#include <iostream>
using namespace std;
int main(){

  int x[10000],i=0;
  do{
    cin >> x[i];
  }while(x[i++]!=0);

  int k=0;
  while(k<i-1){
    cout << "Case " << k+1 << ": " << x[k] << endl;
    k++;
  }

}

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

int sort(std::vector<int> &v)
{
    int swapCount = 0;
    int size = v.size();
    for (int i = 0; i < size; ++i) {
        int minj = i;
        for (int j = i; j < size; ++j) {
            if (v[j] < v[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            ++swapCount;
            int tmp = v[i];
            v[i] = v[minj];
            v[minj] = tmp;
        }
    }
    return swapCount;
}

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

    std::vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> v[i];
    }
    int cnt = sort(v);
    for (int i = 0; i < n; ++i) {
        std::cout << (i ? " " : "") << v[i];
    }
    std::cout << std::endl;
    std::cout << cnt << std::endl;
    return 0;
}

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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a.at(i);
    }
    int ans = 0;
    rep(i, n) {
        if (i % 2 == 0 && a.at(i) % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main ()
{
int a,d,e,N;
	d=0;
	e=a;
	cin>>N;
	for(int i=1;i<=N;i++){
	cin>>a;
	
		d=max(d,a);
		e=min(e,a);
}
	cout<<d-e<<endl;
}

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

using namespace std;

#define INF 2<<29

int main(){
  int n,m;
  int ansl=0,ansr=INF;
  cin>>n>>m;

  for(int i=0;i<m;i++){
    int l,r;
    cin>>l>>r;
    if(ansl<l) ansl=l;
    if(ansr>r) ansr=r;
  }

  if(ansl>ansr) cout<<'0'<<endl;
  else cout<<ansr-ansl+1<<endl;
  
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int H = scanner.nextInt();
		int W = scanner.nextInt();
		int h = scanner.nextInt();
		int w = scanner.nextInt();
		int ans = (H - h) * (W - w);
		System.out.println(ans);
		scanner.close();
	}
}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;

    vector<int> x{a, a - 1, b, b - 1};
    sort(x.begin(), x.end());

    cout << x[2] + x[3] << endl;

    return 0;
}

Measured memory_bytes: 256
import Text.Printf
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap as IM
import qualified Data.Set as S
main=mapM_ putStrLn.solve.map((\[a,b]->(a,b)).map(fst.fromJust.B.readInt).B.words).B.lines=<<B.getContents
solve((n,m):pys)=map(\(p,y)->concatMap(printf"%06d")[p,S.findIndex y(m IM.! p)+1])pys where
  m=foldr(\gs m->IM.insert(fst$gs!!0)(S.fromList$map snd gs)m)IM.empty.groupBy(\a b->fst a==fst b).sort$pys

Measured memory_bytes: 56604
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int a[114514];
int main()
{
	int n,x,y,d,ma=0;
	scanf("%d %d",&n,&d);
	rep(i,n){
		scanf("%d",&a[i]);
	}
	rep(i,n-1){
		if(a[ma]+a[ma+1]<a[i]+a[i+1]) ma=i;
	}
	if(a[ma]+a[ma+1]<d) printf("Impossible\n");
	else{
		printf("Possible\n");
		REP(i,1,ma+1) printf("%d\n",i);
		for(int i=n-1;i>ma+1;i--) printf("%d\n",i);
		printf("%d\n",ma+1);
	}
}


Measured memory_bytes: 1152
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



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

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


Measured memory_bytes: 3624
#include<stdio.h>

int main(){
  int i,N,check,ans,A[200000];
  check=0;
  
  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);
  
  for(i=0;i<N;i++)
    if(A[i]==check+1)
      check=check+1;
  if(check==0)
    printf("-1\n");
  else{
    ans=N-check;
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <climits>
#include <numeric>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    cout << (n + 1)/2 << '\n';
}


Measured memory_bytes: 256
#python3
from itertools import permutations

def main():
    n, m = map(int, input().split())
    edge = set()
    for _ in range(m):
        a, b = map(int, input().split())
        edge.add((a-1, b-1))
        edge.add((b-1, a-1))
    
    node = []
    for i in range(n):
        node.append(i)
    cnt = 0
    for p in permutations(node):
        if p[0] == 0:
            f = True
            for j in range(n-1): 
                if (p[j], p[j+1]) not in edge:
                    f = False
            if f:
                cnt += 1 
    print(cnt)
main()


Measured memory_bytes: 39664
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N = int(input())

# 「翌日の値をセット」しているので、最終日+1日まで入る関係で+1
dp = [ [0 for _ in range(3)] for _ in range(N+1) ]
#print(dp)

ABC = [[]] * N

for i in range(N):
    x = list(map(int, input().split()))
    ABC[i] = x

#print(ABC)

# i日目
for i in range(N):
    '''
             j                     k
    dp[ i ][ 0 ] から dp[ i + 1 ][ 0 ] はcontinue(以下略）
    dp[ i ][ 0 ] から dp[ i + 1 ][ 1 ] への遷移(ABC[i][1])
    dp[ i ][ 0 ] から dp[ i + 1 ][ 2 ] への遷移(ABC[i][2])
    dp[ i ][ 1 ] から dp[ i + 1 ][ 0 ] への遷移(ABC[i][0])
    dp[ i ][ 1 ] から dp[ i + 1 ][ 2 ] への遷移(ABC[i][2])
    dp[ i ][ 2 ] から dp[ i + 1 ][ 0 ] への遷移(ABC[i][0])
    dp[ i ][ 2 ] から dp[ i + 1 ][ 1 ] への遷移(ABC[i][1])
    '''
    # i日目の選択肢
    for j in range(3):
        # i+1日目の選択肢
        for k in range(3):
            # 翌日が今日と同じならパス
            if j == k:
                continue

            ### 配るdp
            # 翌日の活動kと、今日の幸福度+選択した活動を比較
            dp[i+1][k] = max(dp[i+1][k], dp[i][j]+ABC[i][k])

ans = 0
for i in range(3):
    ans = max(ans, dp[N][i])

print(ans)


Measured memory_bytes: 51904
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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 long long INF=1LL << 60;
long long a,b;
long long dp[110][100100]={0};
long long w[110],v[110];



int main() {
   long long a;
   cin>>a;
   long long ret=0;
   bool flag=false;
   rep(i,a){
       long long p=(i+1)*1.08;
       if(p==a){
           flag=true;
           ret=i+1;
       }
   }
   if(flag){
       cout<<ret<<endl;
   }
   else{
       cout<<":("<<endl;
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
using pll = pair<ll, ll>;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pll> a(n);
  REP(i,n){
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(ALL(a), greater<pll>());
  
  vector<vector<ll>> dp(n+1, vector<ll>(n+1, 0));
  REP(i,n) for(int j=0; i+j<n; j++){
    dp[i+1][j] = max(dp[i+1][j], dp[i][j]+a[i+j].first*(a[i+j].second-i));
    dp[i][j+1] = max(dp[i][j+1], dp[i][j]+a[i+j].first*(n-1-j-a[i+j].second));
  }
  ll ans = 0;
  REP(i,n) ans = max(ans, dp[i][n-i]);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 34624
while True:
  #1行目nを読み込む
  cnt = 0
  n =int(input())
  #もしn==0ならbreak
  if n==0:
    break
  #n>0ならば
  if n>0:
    #配列a[i]を読み込む(1<=i<=n)
    a = list(map(int, input().split()))
 
  ans = sum(a) //n
  for i in range(n):
    if a[i] <= ans:
      cnt+=1
  print(cnt)
      


Measured memory_bytes: 6612
import java.util.Scanner;
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String S=sc.next();
		String T[]=S.split("");
		if(T[2].equals(T[3])&&T[4].equals(T[5])) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}

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

int gcd(int a, int b){
	if(a%b==0){
		return b;
	} else {
		return gcd(b, a%b);
	}
}
int main(){
	int n, ans;
	cin >> n >> ans;
	for(int i=1; i<n; i++){
		int a;
		cin >> a;
		ans = gcd(ans, a);
	}
	cout << ans << endl;
	return 0;
}

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

int solve(string s){
    int i = 0, j = s.size()-1;
    int count = 0;
    while(i < j){
        if(s[i] != s[j])
            count++;
        i++;
        j--;
    }
    return count;
}


int main(){

    string s;
    cin >> s;

    cout << solve(s) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>

using namespace std;
#define int long long int

int n, m;
vector<int> collect;

signed main()
{
  cin >> n;
  collect.resize(n);

  cin >> collect[0];
  if (collect[0] != 0)
  {
    cout << -1 << endl;
    return 0;
  }

  for (int i = 1; i < n; i++)
  {
    cin >> collect[i];
    if (collect[i] - collect[i - 1] > 1)
    {
      cout << -1 << endl;
      return 0;
    }
  }

  int ans = 0;
  int x = 0;
  for (int i = n - 1; i > 0; i--, x--)
  {
    if (collect[i] == 0)
    {
      continue;
    }
    if (x == collect[i])
    {
      continue;
    }

    int to = collect[i];
    ans += to;
    x = to;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
n,m = map(int, input().split())
a = [0]*(n+1)
ans1 = 0
ans2 = 0
for i in range(m):
  p,s = map(str, input().split())
  p = int(p)
  if s == "WA":
    if a[p] != -1:
      a[p] += 1
  else:
    if a[p] != -1:
      ans1 += 1
      ans2 += a[p]
      a[p] = -1
print(ans1,ans2)

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    rep(i, n)
    {
        int a;
        cin >> a;
        h -= a;
    }

    if (h > 0)
        OP("No");
    else
        OP("Yes");

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer, Integer> red =  new HashMap<>();
        Map<Integer, Integer> blue = new HashMap<>();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            red.put(b[i], a[i]);
        }
        for(int i = 0; i < n; i++){
            c[i] = sc.nextInt();
            blue.put(c[i], sc.nextInt());
        }
        Arrays.sort(c);
        int ans = 0;
        for(int i = 0; i < n; i++){
            int bx = c[i];
            int by = blue.get(c[i]);
            int tmp = -1;
            for(int j = 0; j < n; j++){
                if(red.containsKey(b[j]) && a[j] < bx && b[j] < by){
                    tmp = Math.max(tmp, b[j]);
                }
            }
            if(tmp >= 0){
                ans++;
                red.remove(tmp);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22996
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();
        if(N<B) System.out.println((A*N)/B-A*(N/B));
        else System.out.println((A*(B-1))/B-A*((B-1)/B));
    }
}

Measured memory_bytes: 35688
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
sum_a = sum(a)

ans = n
for i in range(1,n):
    sum_a -= a[i-1]
    if a[i-1] <= 2*sum_a:
        pass
    else:
        print(i)
        exit()

print(n)

Measured memory_bytes: 20628
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation
#include <cmath>

using namespace std;

int main() {
	int x;
	cin >> x;
	int count = 0;
	count += x / 500 * 1000;
	count += (x % 500) / 5 * 5;
	cout << count << endl;
}







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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template <class T> ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template <class T> istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template <class T> ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
ll div5(ll n) {
    ll cnt = 0;
    while (n) {
        cnt += n / 5;
        n /= 5;
    }
    return cnt;
}

void solve() {
    ll n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << '\n';
    } else {
        cout << div5(n / 2) << '\n';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <math.h>

using namespace std;

int main() {
    int a, b, x;
    cin >> a;
    cin >> b;
    cin >> x;

    double theta;
    if (x <= a*a*b/2) {
        theta = atan2(b, 2*x/double(a*b)) * 180/M_PI;
    } else {
        theta = atan2(double(b) - x/double(a*a), double(a)/2) * 180/M_PI;
    }

    cout << fixed << setprecision(10) << theta << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int n[10],i,j,m;
	for(i=0;i<10;i++)
	{
		scan:
		scanf("%d",&n[i]);
		if(n[i]<0||n[i]>10000)
		{
			goto scan;
		}
	}
	for(i=0;i<10;i++)
	{
		for(j=i+1;j<10;j++)
		{
			if(n[i]<n[j])
			{
				m=n[j];
				n[j]=n[i];
				n[i]=m;
			}
		}
	}
	for(i=0;i<3;i++)
	{
		printf("%d\n",n[i]);
	}
	return 0;   //byvince
}

Measured memory_bytes: 600
#line 1 "F.cpp"
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <vector>

#line 1 "~/git/library/utility/make/fix_point.cpp"
/**
 * @brief ラムダ式の再帰
 * @author えびちゃん
 */

#ifndef H_make_fix_point
#define H_make_fix_point

#include <utility>

template <typename Fn>
class fix_point: Fn {
public:
  explicit constexpr fix_point(Fn&& f) noexcept: Fn(std::forward<Fn>(f)) {}

  template <typename... Args>
  constexpr decltype(auto) operator ()(Args&&... args) const {
    return Fn::operator ()(*this, std::forward<Args>(args)...);
  }
};

template <typename Fn>
static inline constexpr decltype(auto) make_fix_point(Fn&& f) noexcept {
  return fix_point<Fn>{std::forward<Fn>(f)};
}

#endif  /* !defined(H_make_fix_point) */
#line 1 "~/git/library/DataStructure/rollbackable_array.cpp"



/**
 * @brief rollback 可能配列
 * @author えびちゃん
 */

#include <cstddef>
#include <utility>
#line 12 "~/git/library/DataStructure/rollbackable_array.cpp"

template <typename Tp>
class rollbackable_array {
public:
  using size_type = size_t;
  using value_type = Tp;

private:
  std::vector<value_type> M_c;
  std::vector<std::pair<size_type, value_type>> M_h;

public:
  rollbackable_array() = default;

  template <typename InputIt>
  rollbackable_array(InputIt first, InputIt last): M_c(first, last) {}
  rollbackable_array(size_type n, value_type const& x): M_c(n, x) {}

  void set(size_type i, value_type const& x) {
    M_h.emplace_back(i, M_c[i]);
    M_c[i] = x;
  }

  value_type const& operator [](size_type i) const { return M_c[i]; }

  bool empty() const noexcept { return M_c.empty(); }
  size_type size() const noexcept { return M_c.size(); }

  void rollback() {
    auto [i, x] = M_h.back();
    M_h.pop_back();
    M_c[i] = x;
  }

  auto begin() const { return M_c.begin(); }
  auto end() const { return M_c.end(); }
};


#line 8 "F.cpp"

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

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);

  std::vector<std::vector<size_t>> g(n);
  for (size_t i = 1; i < n; ++i) {
    size_t u, v;
    scanf("%zu %zu", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  intmax_t const inf = 2e9;
  rollbackable_array<intmax_t> dp(n, inf);
  std::vector<int> res(n, 1);
  make_fix_point([&](auto& dfs, size_t v, size_t p) -> void {
    size_t j = std::lower_bound(dp.begin(), dp.end(), a[v]) - dp.begin();
    dp.set(j, a[v]);
    res[v] = std::lower_bound(dp.begin(), dp.end(), inf) - dp.begin();
    for (size_t u: g[v]) {
      if (u == p) continue;
      dfs(u, v);
    }
    dp.rollback();
  })(0, n);

  for (auto x: res) printf("%d\n", x);
}


Measured memory_bytes: 37032
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
string s;
int main()
{
//	freopen("1580.in","r",stdin);
//	freopen("1580.out","w",stdout);
 int a,b;
 cin>>a>>b;
 cout<<(a+b+1)/2<<endl;

}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from decimal import Decimal
A, B = input().split()
A = Decimal(int(A))
B = Decimal(B)
print(int(A * B))


Measured memory_bytes: 71264
//https://atcoder.jp/contests/abc091/tasks/abc091_b


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

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

 int main(){
  int n, m;

  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s.at(i);

  cin >> m;
  vector<string> t(m);
  rep(i, m) cin >> t.at(i);


  int maxyen = 0;
  int yen = 0;

  rep(i, n) {

	string key = s.at(i);

	rep (j, n) {
		if (key == s.at(j)) yen++;
	}   

	rep (k, m) {
		if (key == t.at(k)) yen--;
	}


	if (yen > maxyen) maxyen = yen;

	yen = 0;

	}

	cout <<  maxyen << endl; 


 return 0;
}


Measured memory_bytes: 764
import java.util.*;
    public class Main {
    	public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
    		// 整数の入力
    		int H = sc.nextInt();
    		int W = sc.nextInt();
    		int h = sc.nextInt();
            int w = sc.nextInt();
            
            int result = H*W - W*h - H*w + h*w;
            // 出力
    		System.out.println(result);
    	}
    }

Measured memory_bytes: 22484
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N);
    REP(i,N) cin>>a[i];

    sort(ALL(a),greater<int>());

    int ans=0;
    REP(i,N){
        if(i%2==0) ans+=a[i];
        else ans-=a[i];
    }
    cout<<ans<<endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int P[202020];
int H[202020];
int HS[202020];
string S;

template<class V,int NV> class SegTree_1 {
public:
	vector<V> val;
	static V const def=-(1<<30);
	V comp(V l,V r){ return max(l,r);};
	
	SegTree_1(){val=vector<V>(NV*2,def);};
	V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i<y
		if(r<=x || y<=l) return def;
		if(x<=l && r<=y) return val[k];
		return comp(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1));
	}
	void update(int entry, V v) {
		entry += NV;
		val[entry]=v; //上書きかチェック
		while(entry>1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]);
	}
};

SegTree_1<int,1<<20> st[2];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	S.resize(N,'0');
	int ma=0;
	FOR(i,N) {
		cin>>P[i];
		if(P[i]>ma) {
			H[i]=1;
			ma=P[i];
		}
		HS[i+1]=HS[i]+H[i];
	}
	FORR(v,st[0].val) v=0;
	FORR(v,st[1].val) v=-1<<30;
	
	for(i=N-1;i>=0;i--) {
		int e=st[0].getval(P[i]+1,N+2);
		int o=st[1].getval(P[i]+1,N+2);
		
		if(e>=0) st[H[i]^1].update(P[i],e+H[i]+1);
		if(o>=0) st[H[i]].update(P[i],o+H[i]+1);
		//cout<<i<<" "<<P[i]<<" "<<H[i]<<" "<<(e+H[i]+1)<<" "<<(o+H[i]+1)<<endl;
	}
	
	
	
	int Hx=0,Hy=0,Cx=0,Cy=0;
	FOR(i,N) {
		int Q=HS[N]-HS[i+1];

		st[0].update(P[i],0);
		st[1].update(P[i],-1<<30);
		
		S[i]='1';
		// a=Q-k, b=k+m, T=Cx-Cy+Q;
		{
			int T=(Cx+(P[i]>Hx))-Cy+Q;
			int num=st[T&1].getval(Hy+1,N+2);
			//cout<<"!"<<num<<" "<<T<<endl;
			if(num>=T && T>=0) S[i]='0';
		}
		// a=k+m, b=Q-k, T=Cy-Cx+Q;
		{
			int T=Cy-(Cx+(P[i]>Hx))+Q;
			int num=st[T&1].getval(max(Hx,P[i])+1,N+2);
			//cout<<"!"<<num<<" "<<T<<endl;
			if(num>=T && T>=0) S[i]='0';
		}
		if(S[i]=='0') {
			if(Hx<P[i]) Cx++, Hx=P[i];
		}
		else {
			if(Hy<P[i]) Cy++, Hy=P[i];
		}
		
		
		//cout<<Cx<<Cy<<" "<<Hx<<Hy<<" "<<Q<<" "<<S<<endl;
	}
	
	
	if(Cx!=Cy) cout<<-1<<endl;
	else cout<<S<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main() {
  int a;
  	cin >> a;
  int x;
  	x = a / 100;
  int y;
  	y = (a - x * 100) / 10;
  int z;
  	z = (a - (x * 100 + y * 10));
  cout << x + y + z << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define rep(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define ffor(i,a,b) for(int i = a ; i <= b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
const int N = 1e6;
typedef pair <int, int> pi;
typedef std::vector<int> vi;
typedef std::vector<long long> VI;

/*bool isprime(int a) {
	if (a < 2) return false;
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0)
			return false;  // 0(n) or 0(n^2) Tell me in the comment section
	}
	return true;
}*/



int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	fastIO
	long long n, d, ans = 0;
	cin >> n >> d;
	while (n--) {
		long long x, y;
		cin >> x >> y;
		long long b = x * x;
		long long c = y * y;
		long e = b + c;
		long  double a = sqrt(e);
		if (a <= d)ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3704
//C
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

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

int main(){

    int N, X;
    cin >> N >> X;
    vector<int> x;
    for(int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        tmp = abs(X - tmp);
        x.push_back(tmp);
    }
    sort(x.begin(), x.end());

    int ans = x[0];
    for(int i=1; i<N; i++){
        ans = gcd(x[i], ans);
        if(ans == 1) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N; 
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int MAX = 2;
  int MIN = 2;
  RREP(i, N){
    // MAX以上のA[i]の倍数-1
    MAX = (MAX)/A[i]*A[i]+A[i]-1;
    // MIN以上のA[i]の倍数
    MIN = (MIN+A[i]-1)/A[i]*A[i];
  }

  bool ans = true;
  pair<int, int> tmp = {MIN, MAX};
  REP(i, N){
    if(tmp.first < A[i]) ans = false;
    if(tmp.second < A[i]) ans = false;
    tmp.first -= tmp.first%A[i];
    tmp.second -= tmp.second%A[i];
  }
  if(tmp.first != 2 || tmp.second != 2) ans = false;

  if(ans){
    cout << MIN << " " << MAX << endl;
  }else{
    cout << -1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pii pair<int, int>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define jai_shree_ram  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n' // for interactive problems comment it out or use fflush
int MAX = 1e5 + 5;
int MOD = 1e9 + 7;
const int a_size = 2e5 + 5;
////////////////////////////////

int n;
pii h[a_size];
int a[a_size];
int BIT[a_size];


void update(int x, int del){
    for(; x <= a_size-1; x = x + (x& -x)) BIT[x] = max(BIT[x], del);
}

int query(int x){
    int ret = 0;
    for(; x >= 1; x = x - (x& -x)) ret = max(ret, BIT[x]);
    return ret;
}

int32_t main(){
    jai_shree_ram
    cin >> n;
    rep(i,1,n,1){
        cin >> h[i].first;
        h[i].second = -i;
    }
    rep(i,1,n,1) cin >> a[i];
    int ans = 0;
    sort(h+1,h+1+n);
    rep(i,1,n,1){
        update(-h[i].second, a[-h[i].second] + query(-h[i].second));
    }
    cout << query(n) << endl;
    return 0; 
}

Measured memory_bytes: 6528
#include <iostream>
	#include <iomanip>
	#include<math.h>
	#include<list>
	#include <algorithm>
	#include<set>
	#include<vector>
	#include<math.h>
	#include<map>
	#include<string>
	#include <numeric>
	#include <queue>
	#include <sstream>
	#include <bitset>
	#include<stack>

	using namespace std;
	using ll = long long;
	using vll = vector<long long>;
	using sll = set<long long>;


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

	template<typename T>
	map<T, T> getPrimeFactor(T n) {
		map<T, T> res;
		for (T i = 2; i * i <= n; ++i) {
			while (n % i == 0) {
				res[i] ++;
				n /= i;
			}
		}
		if (n != 1) res[n] = 1;
		return res;
	}

	template<typename T>
	bool IsPrimeNumber(T num)
	{
		if (num <= 2) return true;
		else if (num % 2 == 0) return false;

		double sqrtNum = sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				return false;
			}
		}

		return true;
	}

	long long modinv(long long a, long long m) {
		long long b = m, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= m;
		if (u < 0) u += m;
		return u;
	}

	// 繰り返し二乗法
	ll pow2(ll n, ll p, ll mod) {
		if (p == 0 || n == 1) {
			return 1;
		}
		else {
			ll ret = pow2(n * n % mod, p / 2, mod);
			if (p % 2 == 1) {
				ret *= n;
			}
			return ret % mod;
		}
	}


	#define rep(i,s,e) for(ll i=s;i<e;i++)
	#define repeq(i,s,e) for(ll i=s;i<=e;i++)

	int main() {
		string S;
		std::cin >> S;
		reverse(S.begin(), S.end());

		vll cnt(2019, -1);
		cnt[0] = 0;
		vll sum(S.size(), 0);
		ll ans = 0;
		ll s = 0;
		ll r = 0;
		ll d = 1;
		rep(i, 0, S.size()) {
			r += (S[i] - '0') * d;
			r %= 2019;
			cnt[r]++;
			ans += cnt[r];
			d *= 10;
			d %= 2019;
		}

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


Measured memory_bytes: 5144