akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a,b = [],[]
ideal = 0
real = 0
for i in range(n):
    a1,b1 = map(int, input().split())
    a.append(a1)
    b.append([b1,i])

b.sort()
for i in range(n):
    ideal = max(ideal, b[i][0])
    real += a[b[i][1]]
    if real > ideal:
        print("No")
        break
    if i == n-1:
        print("Yes")

Measured memory_bytes: 43580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)

int main()
{
  int a,c;
  char b;
  cin >> a >> b >> c;
  
  int ans;
  if(b=='+')
    ans=a+c;
  else
    ans=a-c;
  
  cout << ans <<endl;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll n;
  cin>>n;
  ll a[111111];
  ll sum=0;
  ll flag[40]={};
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum=sum^a[i];
    int cnt=0;
    while(a[i]%2==0){
	 a[i]/=2;
	 cnt++;
    }
    flag[cnt]=1;
  }

  int ans=0;

  for(ll i=50;i>=0;i--){
    if((sum>>i&1)^(ans%2)){
	 if(flag[i]==0){
	   cout<<"-1"<<endl;
	   return 0;
	 }

	 ans++;
	 sum-=1LL<<i;
    }
  }

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vc vector<int>
#define F first
#define S second
#define eb emplace_back

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1; 
        x = (x * x) % p;
    }
    return res;
}

int modInverse(int n, int p)
{
    return power(n, p - 2, p);
}

int nCrModPFermat(int n, int r, int p)
{

    if (r == 0)
        return 1;

    int fac[n + 1];
    fac[0] = 1;
    for (int i = 1; i <= n; i++)
        fac[i] = fac[i - 1] * i % p;

    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) %
           p;
}
/*
// dsu started 
int a[1000000],b[1000000];
    int find(int x){
        if(b[x]==x) return x;
        b[x]= find(b[x]);
      return b[x];
    }
    void uniona(int x,int y){
        x=find(x);
        y=find(y);
        if (x!=y) {
            a[y]<a[x] ? b[x]=b[y]:b[y]=b[x];
        }
    }
//cut from here
int n,k;
    cin>>n>>k;
     
   
     for(int i=1;i<=n;i++){
    cin>>a[i];
    b[i]=i;
    }
     for(int i=1;i<=k;i++){
    int t1,t2;
    cin>>t1>>t2;// basic code for dsu
    uniona(t1,t2);
//dsu ends
*/

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n ,k ,t;
    cin>>n>>k>>t;
    int ans = ceil((double)n/k);
    cout<<ans*t;
}

Measured memory_bytes: 3756
#include<iostream>

int main(){
  int n;
  int i,j,k;
  int build[4][3][10]={{{}}};
  std::cin >> n;
  
  for(i=0;i<n;i++){
    int b,f,r,v;
    std::cin >> b >> f >> r >> v;
    build[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
    	std::cout << " ";
	    std::cout << build[i][j][k];
      }
      std::cout << std::endl;
    }
    if(i<3)
        std::cout << "####################" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main()
{
	char c[5];
	cin>>c;
	for(int i=0;i<3;i++)
	{
		if(c[i]=='1') cout<<9;
		else if(c[i]=='9') cout<<1;
		else cout<<c[i];
	}
 } 

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    vector<vector<char>> c(3, vector<char>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c.at(i).at(j);
        }
    }
    for (int i = 0; i < 3; i++) {
        cout << c.at(i).at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = Integer.MAX_VALUE;
		for(int a=1;a<N;++a){
			int b = N-a;
			int num = digits(a)+digits(b);
			if(num<ans) ans = num;
		}
		System.out.println(ans);
		return;
	}
	
	public static int digits(int a){
		int ret = 0;
		int x = a;
		while(x!=0){
			ret += x%10;
			x/=10;
		}
		return ret;
	}
}

Measured memory_bytes: 23764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            long A = Long.parseLong(in.next());
            long B = Long.parseLong(in.next());
            long K = Long.parseLong(in.next());
            String ans = "";

            if (A >= K) {
                ans = String.valueOf(A - K) + " " + String.valueOf(B);
            } else if (A < K && K <= A + B) {
                ans = String.valueOf(0) + " " + String.valueOf(B - (K - A));
            } else {
                ans = String.valueOf(0) + " " + String.valueOf(0);
            }

            out.println(ans);
            return;
        }

    }
}



Measured memory_bytes: 23764
#include <iostream>

using namespace std;

int main() {
  int a1, a2, a3;
  scanf("%d %d %d", &a1, &a2, &a3);

  if (a1 + a2 + a3 >= 22)
    cout << "bust" << endl;
  else
    cout << "win" << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

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

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n) cin >> d[i];
	
	sort(d.begin(), d.end());
	int ans = d[n / 2]  - d[n / 2 - 1];
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, L, Q;
signed main() {
	cin >> L;
	vector< int > A(L);
	rep(i, L) cin >> A[i];
	vector< vector< int > > dp(L + 1, vector< int >(5, LINF));
	rep(j, 5) dp[0][j] = 0;
	rep(i, L) {
		int a = A[i];
		int tmp = dp[i][0];
		dp[i + 1][0] = tmp + a;
		chmin(tmp, dp[i][1]);
		dp[i + 1][1] = tmp + (a == 0 ? 2 : a % 2);
		chmin(tmp, dp[i][2]);
		dp[i + 1][2] = tmp + (a + 1) % 2;
		chmin(tmp, dp[i][3]);
		dp[i + 1][3] = tmp + (a == 0 ? 2 : a % 2);
		chmin(tmp, dp[i][4]);
		dp[i + 1][4] = tmp + a;
		//cout << a << " ";
		//cout << dp[i + 1];
	}
	int ans = dp[L][0];
	rep(i, 5) chmin(ans, dp[L][i]);
	//cout << dp;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long LL;

int main()
{
	int n, m, K;
	while (~scanf("%d%d%d", &n, &m, &K)) {
		bool flag = false;
		for (int x = 0; x <= n; x++)
			for (int y = 0; y <= m; y++)
				if (x * m + y * n - 2 * x * y == K) flag = true;
		if (flag) printf("Yes\n"); else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
int fac[5010],nifac[5010];
int getmi(int a,int x)
{
	int ans=1;
	while (x)
	{
		if (x&1) ans=(long long)ans*a%mo;
		a=(long long)a*a%mo;
		x>>=1;
	}
	return ans;
}
long long work(int n,int m)
{
	if ((n<0)||(m<0)) return 0;
	return (long long)fac[n+m]*nifac[m]%mo*nifac[n]%mo;
}
int main()
{
	int n,k;scanf("%d%d",&n,&k);
	fac[0]=nifac[0]=1;
	for (int i=1;i<=2*n;i++){fac[i]=(long long)fac[i-1]*i%mo;nifac[i]=getmi(fac[i],mo-2);}
	int ans=(work(n-1,k-1)-work(n,k-2)+mo)%mo;
	for (int i=1;i<=n-k-1;i++) ans=ans*2%mo;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
//#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main(){
    int N;
    cin >> N;
    int t[N], x[N], y[N];
    for (int i=0; i<N; i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    for(int i=0; i<N; i++){
        if(t[i] < (x[i]+y[i])){
            puts("No");
            return 0;
        }
        if(t[i]%2 == 1){
            if((x[i]+y[i])%2 == 0){
                puts("No");
                return 0;
            }
        }else{
            if((x[i]+y[i])%2 == 1){
                puts("No");
                return 0;
            }
        }
    }

    puts("Yes");
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main() {
	int a, b, h, m;
	float harg, marg, diffarg;
	const double PI = 3.14159265358979323846;

	cin >> a;
	cin >> b;
	cin >> h;
	cin >> m;

	harg = (h * 60 + m) * 0.5;
	marg = m * 6;
	diffarg = abs(harg - marg) < 180 ? abs(harg - marg) : abs(marg + (360 - harg));

	printf("%.15f", sqrt(a * a + b * b - 2 * a * b * cos(diffarg * PI / 180)));


	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

const int N = 500005;
int A[N];
int BIT[N];

void Add(int c, int x = 1){
    for(;c < N; c+=c&-c)
        BIT[c]+=x;
}

int Sum(int c, int s=0){
    for(; c; c-=c&-c)
        s+=BIT[c];
    return s;
}

vector<array<int,2>>Q[N];
int res[N];
int lastPos[N];

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,q;
    cin>>n>>q;
    for(int i=1; i<=n; i++)cin>>A[i];
    for(int i=1; i<=q; i++){
        int l,r;
        cin>>l>>r;
        Q[r].push_back({l,i});
    }

    for(int i=1; i<=n; i++){
        if(lastPos[A[i]])Add(lastPos[A[i]], -1);
        lastPos[A[i]] = i;
        Add(i, 1);

        for(auto q : Q[i])
            res[q[1]] = Sum(i) - Sum(q[0]-1);
    }

    for(int i=1; i<=q; i++)
        cout<<res[i]<<"\n";
}


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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  ll n,d;
  
  cin>>n>>d;
  
  ll d2=d*d;
  
  int ans=0;
  rep(i,n){
    ll x,y;
    cin>>x>>y;
    x=x*x;
    y=y*y;
    if(d2>=x+y)ans++;
  }
  
  cout<<ans;
  
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;
const int Nmax = 100000;
int N;
int A[2*Nmax-1];
bool b[2*Nmax-1];

bool upper(int n){
    for(int i=0; i<2*N-1; i++){
        b[i] = A[i] >= n;
    }

    for(int i=0; i<N-1; i++){
        if(b[N-1+i] == b[N-1+i+1]) return b[N-1+i];
        if(b[N-1-i] == b[N-1-i-1]) return b[N-1-i];
    }
    return N%2 == 0 ? !b[N-1] : b[N-1];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin >> N;
    for(int i=0; i<2*N-1; i++) cin >> A[i];

    int l=1, u=2*N;
    while(u-l > 1){
        int m = (l+u)/2;
        bool res = upper(m);
        if(res) l=m;
        else u=m;
    }

    cout << l << endl;

    /*
    for(int i=1; i<2*N; i++){
        cout << upper(i) << endl;
    }
    */
    
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
long long  dp[100005];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int h[n+1];
    for(int i=1;i<=n;i++)
        cin>>h[i];
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int j=3;j<=n;j++)
    {
        dp[j]=min(abs(h[j]-h[j-1])+dp[j-1],dp[j-2]+abs(h[j]-h[j-2]));
    }
    /*for(int i=1;i<=n;i++)
        cout<<dp[i]<<" ";
    cout<<endl;*/
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int T = 1;
        int n,n2,n3,k,res;
        String s1;
        res=0;
        int t;
        while(T-->0){
            n=s.nextInt();
            n2=s.nextInt();
            n3=s.nextInt();
            if(n2*n3>=n)
                System.out.println("Yes");
            else
                System.out.println("No");

        }

    }
    static int gcd(int a, int b)
    {
        if(b==0) {
            return a;
        }
        return gcd(b,a%b);
    }
    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 27024
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 1023456789
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define maxn 200005
namespace Graph {
	int head[maxn], cnt;
	struct edge { int v, next; }e[maxn << 1];
	il void add(int u, int v) { e[++ cnt] = (edge){v, head[u]}, head[u] = cnt; }
}
//using namespace Graph;
int n, m, sum[maxn * 44], rt, a[maxn], cnt, L = -200000, R = (1e9) + 200000, ls[maxn * 44], rs[maxn * 44];
il void insert(int &k, int l, int r, int ll) {
	if(!k) k = ++ cnt; ++ sum[k];
	if(l == r) return;
	int mid = (l + r) >> 1;
	if(ll <= mid) insert(ls[k], l, mid, ll);
	else insert(rs[k], mid + 1, r, ll);
}
il int query(int k, int l, int r, int ll) {
	if(l == r) return sum[k];
	int mid = (l + r) >> 1;
	if(ll <= mid) return query(ls[k], l, mid, ll);
	else return query(rs[k], mid + 1, r, ll);
}
signed main() {
	n = read();
	rep(i, 1, n) a[i] = read();
	rep(i, 1, n) {
		m += query(1, L, R, i - a[i]);
		insert(rt, L, R, i + a[i]);
	}
	cout << m;
	return 0;
}

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

using namespace std;

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

    for (int i = 1; i <= 2000; i++) {
        if ((int)floor(0.08 * i) == a && (int)floor(0.1 * i) == b) return 0 * printf("%d\n", i); 
    }

    printf("-1\n");
}


Measured memory_bytes: 3820
using System;
using System.Collections.Generic;

namespace cswork
{

    class Program
    {
        public Program() { }

        Scanner cin;

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int x0 = 0;
            int y0 = 0;
            int t0 = 0;
            for (int i = 0; i < n; i++)
            {
                int t = cin.nextInt();
                int x = cin.nextInt();
                int y = cin.nextInt();

                int l = Math.Abs(x - x0) + Math.Abs(y - y0);

                if (t - t0 >= l)
                {
                    if ((t - t0 - l) % 2 == 0)
                    {
                        x0 = x;
                        y0 = y;
                        t0 = t;
                        continue;
                    }
                }

                Console.WriteLine("No");
                return;
            }

            Console.WriteLine("Yes");
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

Measured memory_bytes: 13244
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,k; cin >> n >> k;
    VI h(n); VIin(h);
    if(n <= k){
        OUT(0);
        return 0;
    }
    KOZYUN(h);
    int sum = 0;
    FOR(i,k,n){
        sum += h[i];
    }
    OUT(sum);

    return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << ((a*b)%2 ? "Odd" : "Even") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		boolean flag = true;
		int ans = 0;
		int count_XXA=0;
		int count_BXX=0;
		//String[] s = new String[N];
		for(int i=0; i<N; i++){
			//s[i] = sc.next();
			String str = sc.next();
			ans += count_AB(str);
			if(is_XXA(str))count_XXA++;
			if(is_BXX(str))count_BXX++;
			if(is_XXA(str)||is_BXX(str))flag = flag && is_BXXA(str);
		}
		
		ans += Math.min(count_XXA, count_BXX);
		if(Math.min(count_XXA, count_BXX) != 0 && flag)ans--;

		System.out.println(ans);
		
		
		sc.close();
	}
	
	public static int count_AB(String str){
		int count=0;
		char[] c = str.toCharArray();
		int len=c.length;
		for(int i=0; i<len-1;i++){
			if(c[i]=='A' && c[i+1]=='B')count++;
		}
		return count;
	}
	
	public static boolean is_BXXA(String str){
		char[] c = str.toCharArray();
		int len=c.length;
		return c[0]=='B' && c[len-1]=='A';
	}
	
	public static boolean is_BXX(String str){
		char[] c = str.toCharArray();
		return c[0]=='B';
	}
	
	public static boolean is_XXA(String str){
		char[] c = str.toCharArray();
		int len=c.length;
		return c[len-1]=='A';
	}
	
}


Measured memory_bytes: 30500
/*  Name: Abu Hurayra
    Handle: HurayraIIT
    Institute: IIT_JU   */
    
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef string S;
typedef double D;
typedef vector<int> vi;
typedef stack<int> si;
typedef queue<int> qi;
typedef priority_queue<int> pqi;
typedef pair<int,int> pi;

#define pi acos(-1.0)
#define PSB push_back
#define PPB pop_back
#define REP(i,a,b) for(i=a;i<=b;i++)

int main()
{
    
    int d,n,i,cnt=0;
    cin >> n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        
        while(a[i]%2==0)
        {
            a[i]/=2;
            cnt++;
        }
    }
    cout << cnt << endl;
	
	
	return 0;
}
/*
10000
20000
...
100000
1100000
1100
10000
*/



Measured memory_bytes: 256
N,M=list(map(int,input().split()))
l=1
r=N
for m in range(M):
    l_,r_ = list(map(int,input().split()))
    l = max(l,l_)
    r = min(r,r_)
    
ans = r-l+1

if ans<0:
    ans=0
print(ans)


Measured memory_bytes: 74472
package main

import "fmt"

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	m := make(map[byte]int)
	ans := 0
	for i := 0; i < n; i++ {
		m[s[i]]++
		c := 0
		m2 := make(map[byte]int)
		for j := i + 1; j < n; j++ {
			k := s[j]
			if m2[k] == 0 && m[k] > 0 {
				c++
				m2[k]++
			}
		}
		ans = max(ans, c)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	vector<int> X(N);
	for(int i=0;i<N;i++){
		cin>>X[i];
	}
	int ans = 1000000000;
	for(int i=1;i<=100;i++){
		int t = 0;
		for(int j=0;j<N;j++){
			t += (X[j]-i)*(X[j]-i);
		}
		ans = min(ans,t);
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
buttons = int(input())
next_ = []
impossible = []
for i in range(buttons):
    next_.append(int(input()))
now_button = 1
ans = 1
while next_[now_button - 1] != 2:
    if ans <= buttons:
        now_button = next_[now_button - 1]
        ans += 1
        
#    if next_[now_button - 1] not in impossible:
#        impossible.append(next_[now_button - 1])
#        now_button = next_[now_button - 1]
#        ans += 1
    else:
        ans = -1
        break

        
print(ans)

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  char a;
  cin>>a;
  if(a=='T')cout<<"A";
  if(a=='A')cout<<"T";
  if(a=='G')cout<<"C";
  if(a=='C')cout<<"G";
}


Measured memory_bytes: 256
<?php
define('MOD', 10**9+7);

//error_reporting(0);
//$N = trim(fgets(STDIN));
list($n,$k) = explode(" ",trim(fgets(STDIN)));
//$X = array_map('intval',explode(" ",trim(fgets(STDIN))));
//function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;}
//function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;}
//

$n=(int)$n;
$k=(int)$k;
$ifact=[];
$fact=[];
$c = new combinationsnk($n);
$ans=0;
//https://atcoder.jp/contests/abc156/submissions/10288721
$zm = min($n,$k);
for ($i = 1; $i <= $zm; $i++) {
  $room = $n - $i;
  $nn = $n - $room;
  $ans += mulm($c->calc($n,$room) , $c->calc($nn+$room-1,$nn));
}
if ($k >= 2) {
  $ans = ($ans + 1) % MOD;
}
printf("%d\n",$ans);



//https://atcoder.jp/contests/abc145/submissions/8474723

define('MOD', 10**9+7);

//足し算
function addm($a, $b){
    return ($a + $b) % MOD;
}
//引き算
function subm($a, $b){
    return ($a + MOD - $b) % MOD;
}
//掛け算
function mulm($a, $b){
    return ($a * $b) % MOD;
}
//割り算
function divm($a, $b){
    return mulm($a, powerm($b, MOD - 2));
}
//累乗
function powerm($a, $b){
    if($b == 0)return 1;
    if($b & 1)return (powerm($a, $b>>1)**2 % MOD) * $a % MOD;
    return powerm($a, $b>>1)**2 % MOD;
}
//階乗
function factorialm($a){
    if($a == 0)return 1;
    return factorialm($a - 1) * $a % MOD;
}
//順列
function nPm($n, $m){
    if($m == 0)return 1;
    return nPm($n, $m - 1) * ($n - $m + 1) % MOD;
}
//組み合わせ
function nCm($n, $m){
    $m = min($m, $n-$m);
    return divm(nPm($n, $m), factorialm($m));
}

//解説のcombinationを移植
Class combinationsnk {
  private $fact;
  private $ifact;
  public function __construct(int $n) {
    $this->fact[0]=1;
    for($i=1;$i<=$n;$i++) $this->fact[$i]=mulm($this->fact[$i-1],$i);
    $this->ifact[$n]=powerm($this->fact[$n],MOD-2);
    for ($i = $n; $i >= 1; --$i) $this->ifact[$i-1] = mulm($this->ifact[$i],$i);
  }
  public function calc(int $n,int $k)
  {
    if ($k < 0 || $k > $n) return 0;
    return mulm(mulm($this->fact[$n],$this->ifact[$k]),$this->ifact[$n-$k]);
  }
}


Measured memory_bytes: 25588
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>

using namespace std;
long long k, a, b;

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

  cin >> k >> a >> b;
  long long ans = 1 + k;
  if (a >= b) {
    ans = 1 + k;
  } else {
    k -= (a-1);

    ans = max(ans, a + (b-a)*(k/2) + k % 2);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	int n;
  	cin>>n;
  
  	vector<int> a(110);
  	rep(i,n){
    	cin>>a[i];
    }
  
  bool dame=false;
  
  rep(j,n){
  	if(a[j]%2==0&&a[j]%3!=0&&a[j]%5!=0){
    	dame=true;
    }
  }
  
  if(dame){
  	cout<<"DENIED"<<endl;
  }
  
  else{
  	cout<<"APPROVED"<<endl;
  }

}

Measured memory_bytes: 256
# python3
# -*- coding: utf-8 -*-
import sys
import math
import bisect
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
lmtx = lambda h: [list(map(int, lmis())) for _ in range(h)]
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
n = ii()
alist = lmis()

jlist = [0] * (n+1)

for i in range(n-1):
    jlist[alist[i]] += 1

for j in jlist[1:]:
    print(j)


Measured memory_bytes: 34440
/*
Original problem: https://atcoder.jp/contests/abc133/tasks/abc133_e
Author: sammochen
*/

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)

#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef vector<ll> VLL;
typedef vector<int> VI;

const ll mod = 1e9+7;

namespace SOLVE {
	int n, k;
	ll ans = 1;
	vector<VI> E;

	ll mul(ll& a, ll b) {
		a = (a * b) % mod;
	}

	void dfs(int a, int prev) {
		int m = prev == -1 ? k - 1 : k - 2;

		for (int b : E[a]) {	
			if (b != prev) {
				mul(ans, m);
				m--;

				dfs(b, a);
			}
		}
	}

    void main() {
		cin >> n >> k;
		E.resize(n+1);
		int a, b;
		REP(i,0,n-1) {
			cin >> a >> b;
			E[a].push_back(b);
			E[b].push_back(a);
		}

		// do a dfs! i will multiply BEFORE i go in
		mul(ans, k);
		dfs(1, -1);
		
		cout << ans << endl;

    }
}


signed main() {
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 10368
#include <iostream>
using namespace std;
int main()
{
	char a,b;
	cin>>a>>b;
 	if(((a=='H')&&(b=='H'))||((a=='D')&(b=='D')))
	
	
	cout<<"H";
else if(((a=='D')&&(b=='H'))||((a=='H')&&(b=='D')))
	
	cout<<"D";
	else
	cout<<"error";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e9)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

 
int vector_finder(std::vector<int> vec, int number) {
  size_t index = std::distance( vec.begin(), std::find(vec.begin(), vec.end(), number) );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}



int N, A, B, C;
int l[100];
ll ans = INF;
void dfs(int cur, int a, int b, int c,int d)
{
	if(cur==N){
		
		if (min(min(a, b), c) > 0)
		{
			ll key = abs(a - A) + abs(b - B) + abs(c - C) + 10 * (d - 3);
			ans = min(ans, key);
			return;
		}else{
			return;
		}
	}
	dfs(cur + 1, a, b, c,d);
	dfs(cur + 1, a+l[cur], b, c,d+1);
	dfs(cur + 1, a, b+l[cur], c,d+1);
	dfs(cur + 1, a, b, c+l[cur],d+1);
}
int main()
{
	cin >> N >> A >> B >> C;
	
	REP(i,N){
		cin >> l[i];
	}
	dfs(0, 0, 0, 0, 0);
	cout <<ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs; }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

constexpr ll MOD = 1e9+7;

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

  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) {
    cin >> a[i];
  }

  modint<MOD> ans = 0;

  rep(i, n) {
    ans += (a[i]%MOD*(n-1))%MOD;
  }

  vl cnt(64);
  rep(i, n) {
    rep(j, 62) {
      if (a[i] & (1LL << j)) {
        cnt[j]++;
      }
    }
  }

  cerr << ans.a << endl;

  rep(i, 62) {
    //cerr << i << " " << cnt[i] << endl;
    //ans -= (COM(cnt[i], 2) * ((1LL<<(i+1))%MOD))%MOD;
    ans -= ((cnt[i]*(cnt[i]-1)/2)%MOD * ((1LL<<(i+1))%MOD))%MOD;
  }

  cout << ans.a << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    while(1){
        int n,r;
        cin >> n >> r;
        if(n==0 && r==0) break;
        vector<int> a(n);
        iota(a.rbegin(),a.rend(),1);
        rep(i,r){
            int p,c;
            cin >> p >> c;
            rotate(a.begin(),a.begin()+p-1,a.begin()+p-1+c);
        }
        cout << a[0] << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define F first
#define S second
#define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;
const ll N = 2e5+10, inf = 1e3+5, mod = 1e9+7, NN = 1e5+10;
int a;
int main()
{
    Tsetso ;
    int n, k ;
    cin >> n >> k ;
    map < int, int > mp ;
    set < int > s ;
    for ( int i = 0 ; i < n ; i++)
    {
        cin >> a;
        s.insert(a);
        mp[a]++ ;
    }
    vector < int> v ;
    for (auto i : s )
        v.push_back(mp[i]);
    sort(v.begin(),v.end());
    if ( v.size() <= k)
            return cout << 0 , 0 ;
    int ans = 0;
    for ( int i = 0 ; i< v.size()-k ;i++)
            ans += v[i] ;
    cout << ans ;
}


Measured memory_bytes: 22820
#include <stdio.h>

int main(void){
  int n, i, j;
  scanf("%d", &n);
  int flag = 0;
  
  for(i = 0; i * 4 <= n; i++){
    for(j = 0; i * 4 + j * 7 <= n; j++){
      if(i * 4 + j * 7 == n) flag = 1;
    }
  }
  if(flag) printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[2][n];
    for (int i = 0; i < n; i++) {
        scanf(" %d", &a[0][i]);
    }
    for (int i = 0; i < n; i++) {
        scanf(" %d", &a[1][i]);
    }
    // 初期値
    int ans = a[0][0];
    for (int i = 1; i < n; i++) {
        ans += a[0][i];
    }
    ans += a[1][n-1];
    // 全探索
    int tmp2 = ans, tmp;
    for (int i = n-2; i >= 0; i--) {
        tmp = tmp2;
        tmp -= a[0][i+1];
        tmp += a[1][i];
        tmp2 = tmp;
        ans = max(ans, tmp);
        //cout << ans << endl;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,cnt=0,maaxx=0,maax=0;
    cin>>n;
    int ara[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>ara[i];
    }
    if(n==1)
    {
        cout<<"0"<<endl;
        return 0;
    }
    for(int i=n-1;i>0;i--)
    {
        if(ara[i]<=ara[i-1])
        {
            cnt++;
            if(maax<=cnt)
            {
                maax=cnt;
            }
        }
        else
        {
            maaxx=cnt;
            cnt=0;
        }
    }
    if(maaxx>maax)
    {
        maax=maaxx;
    }
    cout<<maax<<endl;
    
}


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

int R,L,K;
double P,E,T,ans=0;

void b_search(int k,double r,double l,double p)
{
  if(l<=(T-E) || (T+E)<=r)return;
  if((T-E)<=r && l<=(T+E)){
    ans+=p;
    return;
  }
  if(k==K){
    double H=(r+l)/2;
    if(T-E<H && H<T+E)ans+=p;
  }
  else {
    double H=(r+l)/2;
    if(H<=T){
      b_search(k+1,H,l,(1-P)*p);
      b_search(k+1,r,H,P*p);
    }
    if(H>T){
      b_search(k+1,r,H,(1-P)*p);
      b_search(k+1,H,l,P*p);
    }
  }
}

int main()
{
  cin>>K>>R>>L>>P>>E>>T;

  b_search(0,R,L,1);
  printf("%.8f\n",ans);

  return 0;
}

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

bool check(int n){
	int counter = 0;
	if((int)sqrt(n)*(int)sqrt(n) == n)
//		cout << "hai";
		counter++;
	for(int i = 1; i < sqrt(n); i++){
		if(n%i == 0)
			counter+=2;
	}
	if(counter == 8)
		return true;
	else
		return false;
}

int main(){
	int n;
	int counter = 0;
	cin >> n;
	for(int i = 1; i <= n; i+=2){
		if(check(i))
			counter++;
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
N=int(input())
t=[list(map(int,input().split())) for i in range(N)]
t[0:0] = [[0,0,0]]
# print(t)
# print(len(t))

for i in range(N):
  mv=t[i+1][0]-t[i][0]
  d=abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2])
  diff=mv-d
  # print("mv:{}, d:{}, diff:{}".format(mv,d,diff))
  if not (diff>=0 and diff%2==0):
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 27300
#include <bits/stdc++.h>
#define INL inline
#define REG register
#define DB double
#define LDB long double
#define ULL unsigned long long
#define LL long long

#define RPT(i,x,y) for (REG int i=(x);i<(y);i++)
#define DRPT(i,x,y) for (REG int i=(x);i>(y);i--)
#define MST(a,b) memset((a),(b),sizeof(a))
#define MRK() cout<<"Mark"<<endl; 
#define WRT(x) cout<<#x<<" = "<<(x)<<endl;
#define LINK(i,graph,pos) for (REG int i=graph.head[pos];i;i=graph.next[i])

#define MAXN 10000
#define MAXM 10000
#define MOD 998244353
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5

#define _ 0
using namespace std;



int n,m;
int d[12][12];
int dd[12][12];
int c[110][110]; 
set <int> st;

int main()
{
	cin>>n>>m;
	RPT(i,1,n+1)
		RPT(j,1,m+1)
			scanf("%d",&d[i][j]);
	MST(dd,INF);
	RPT(i,0,101)
		RPT(j,0,101)
			RPT(ii,1,n+1)
				RPT(jj,1,m+1)
					c[i][j]=max(c[i][j],d[ii][jj]-i*ii-j*jj);
	RPT(i,0,101)
		RPT(j,0,101)
			RPT(ii,1,n+1)
				RPT(jj,1,m+1)
					dd[ii][jj]=min(dd[ii][jj],jj*j+ii*i+c[i][j]);
	RPT(i,1,n+1)
		RPT(j,1,m+1)
		{
			if (dd[i][j]!=d[i][j])
			{
				cout<<"Impossible"<<endl;
				return 0;
			}
		}
	cout<<"Possible"<<endl;
	cout<<202<<' '<<200+101*101<<endl;
	
	RPT(i,1,101)
		cout<<i<<' '<<i+1<<' '<<'X'<<endl;
	RPT(i,102,202)
		cout<<i+1<<' '<<i<<' '<<'Y'<<endl;
	RPT(i,0,101)
		RPT(j,0,101)
			cout<<i+1<<' '<<j+1+101<<' '<<c[i][j]<<endl;
	cout<<1<<' '<<102<<endl;
	return ~~(0^_^0);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
            using namespace std;
            #define rep(i,a,b) for(ll i =a; i<b;++i)
            #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
            #define endl "\n"
            #define pb push_back
            #define F first
            #define S second
            #define print(a)       for(auto x : a) cout << x << " "; cout << endl
            #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
            #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
            #define mk(x,y)  make_pair(x,y)
            typedef  long long  int ll;
            const int N = ( 2e6 + 5 );
            const int mod = 1e9+7;
            ll  n ,a[N],k,c,l[N],r[N];

    ll pow_mod_m(ll a , ll n)
    {
        if(!n)
            return 1;
        ll pt =  pow_mod_m(a,n/2);
        pt *= pt ; pt %= mod;
        if(n&1)
            pt *= a , pt %= mod;
        return pt;
    }



    int main()
    {
         IOS;
      //     freopen("a_example (2).txt","r",stdin);
      //     freopen("c.txt","w",stdout);

        int ts =1;
      //  cin>>ts;
        while(ts--)
        {
            cin >> n >> k >> c;
            string s;
            cin >> s;
            vector < ll > v;
            rep(i,0,n)
            {
                if(s[i] =='o') v.pb(i+1);
            }
            int z = 0;
            rep(i,0,v.size())
            {
                if(i ==0 ) l[z++] = v[0];
                else if( v[i]  - l[z-1] > c and z < k)
                {
                    l[z++] = v[i];
                }
            }
            z= k-1;
            for(int i = v.size()-1; i>=0 ;i--)
            {
                if(i == v.size()-1) r[z--] = v[v.size()-1];
                else if( r[z+1] - v[i] > c and z >= 0)
                {
                    r[z--] = v[i];
                }
            }
            rep(i,0,k)
            {
                if(l[i] == r[i]) cout << l[i] << endl;
            }
        }
    }


Measured memory_bytes: 11144
let s = read_line ()
let rec f i m c = String.(if i >= length s then m else if contains "ACGT" s.[i] then f (i + 1) (max m @@ c + 1) (c + 1) else f (i + 1) m 0)
let _ = f 0 0 0 |> Printf.printf "%d\n"

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            const int N = 10;
            int[] array = new int[N];
            for (int i = 0; i < N; ++i)
            {
                array[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(array);
            Array.Reverse(array);
            for (int i = 0; i < 3; ++i)
            {
                Console.WriteLine(array[i]);
            }
        }
    }
}

Measured memory_bytes: 5748
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;

int x;

void code() {
    cin >> x;
    cout << !x << "\n";
}

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

    int t = 1;
    // cin>>t;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
vector<vl> graph;
ll A[101010];
ll n;
ll dfs(ll p,ll r)
{
	if(graph[p].size() == 1)		return A[p];
	vector <ll> X;
	ll s = 0;
	for(auto t: graph[p])
	{
		if(t != r)
		{
			ll x = dfs(t, p);
			s += x;
			X.push_back(x);
		}
	}
	if(s < A[p] || A[p] * 2 < s) 
	{
		printf("NO");
		exit(0);
	}
	if(*max_element(X.begin(), X.end()) > A[p]) 
	{
		printf("NO");
		exit(0);
	}
	return A[p] * 2 - s;
}
 
int main()
{
	ll i, u, v;
	scanf("%d",&n);
	graph.assign(n+1,vl());
	for(i=1;i<=n;i++)	scanf("%lld",&A[i]);
	for(i=1; i<n; i++)
	{
		scanf("%lld %lld",&u,&v);
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	if(n == 2)
	{
		if(A[1] == A[2])		printf("YES");
		else					printf("NO");
		return 0;
	}
	for(i=1; i<=n; i++)
	{
		if(graph[i].size() > 1) 
		{
			break;
		}
	}
	int res = dfs(i,0);
	if(res==0)			printf("YES");
	else				printf("NO");
}

Measured memory_bytes: 19996
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T = ll> constexpr T TEN(int n) {return (n==0)?1:10*TEN<T>(n-1);}

const int MP = 100100;
vector<int> pr;
vector<ull> bpr;

void first() {
    bool used[MP] = {};
    for (int i = 2; i < MP; i++) {
        if (used[i]) continue;
        pr.push_back(i);
        ull x = ((__int128(1)<<64) + i-1 ) / i;
        bpr.push_back(x);
        for (int j = 2*i; j < MP; j += i) {
            used[j] = true;
        }
    }
}

map<ll, int> fact(ll n) {
    int pc = (int)pr.size();
    map<ll, int> mp;
    while (n % 2 == 0) {
        n /= 2;
        mp[2]++;
    }
    while (n % 3 == 0) {
        n /= 3;
        mp[3]++;
    }
    for (int i = 2; i < pc; i++) {
        ll d = pr[i]; ull rd = bpr[i];
        while (true) {
            ll nd = __int128(n)*rd >> 64;
            if (nd * d != n) break;
            n = nd;
            mp[d]++;
        }
    }
    if (n > 1) mp[n]++;
    return mp;
}


int main() {
    first();
    using F = vector<ll>;
    map<F, F> g;
    map<F, int> a;
    int n;
    scanf("%d", &n);
    bool one = false;
    for (int i = 0; i < n; i++) {
        if (i % 1000 == 0) {
//            cout << i << " " << gc << endl;
        }
        ll s;
        scanf("%lld", &s);
        map<ll, int> fac = fact(s);
        F d0, d1;
        for (auto p: fac) {
            p.second %= 3;
            if (p.second == 1) {
                d0.push_back(p.first);
                d1.push_back(p.first);
                d1.push_back(p.first);
            } else if (p.second == 2) {
                d0.push_back(p.first);
                d0.push_back(p.first);
                d1.push_back(p.first);
            }
        }
        sort(d0.begin(), d0.end());
        sort(d1.begin(), d1.end());
        if (d0.size() == 0) {
            one = true;
            continue;
        }
        g[d0] = d1; g[d1] = d0;
        a[d0]++;
    }

    int ans = 0;
    for (auto p: g) {
        ans += max(a[p.first], a[p.second]);
    }
    cout << ans/2 + (one ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 65920
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
using namespace std;

struct r {
    long long index;
    string s;
    long long p;
    bool operator<(const r &another) const
    {
        if (s == another.s){
            return p > another.p;
        }else{
            return s < another.s;
        }
    };
};

int main()
{
    // 整数の入力
    long long N,D,i;
    vector<r> rs;
    cin >> N;

    for(int i = 0;i< N;i++){
        r new_r;
        new_r.index = i+1;
        cin >> new_r.s >> new_r.p;
        rs.push_back(new_r);
    }
    sort(rs.begin(),rs.end());
    for (auto a: rs){
        cout << a.index << endl;
    }

    return 0;
}

Measured memory_bytes: 256