akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define EPS 1e-10
#define INF 1000000
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef long long ll;

string ans( int A, int B ) {
  if ( A == 1 && B != 1 ) {
    return "Alice";
  }
  if ( A != 1 && B == 1 ) {
    return "Bob";
  }

  if ( A < B ) {
    return "Bob";
  } else if ( A > B ) {
    return "Alice";
  }

  return "Draw";
}

int main() {
  int A, B;
  cin >> A >> B;
  cout << ans(A, B) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
    
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// struct chash { int operator()(int x) const { return x ^ RANDOM; }};
// cc_hash_table<int, int, hash<int>> cnt;

void solve(){
    int n; cin>>n;
    int g = __gcd(n,360LL);
    int ans = 360/g;
    cout<<ans<<endl;
}
    
signed main(){
    
    FastRead;     
    
    int t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}
    




Measured memory_bytes: 3652
#include <cstdio>

int main()
{
  int T;
  scanf("%d", &T);
  for (int t = 0; t < T; ++t) {
    int X, Y, W, H, N, ans = 0;
    scanf("%d %d %d %d %d", &X, &Y, &W, &H, &N);
    for (int i = 0; i < N; ++i) {
      int x, y;
      scanf("%d %d", &x, &y);
      if (X <= x && x <= X+W && Y <= y && y <= Y+H)
	++ans;
    }
    printf("%d\n", ans);
  }
  return 0;
}

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

int main(){
	int n,field[11][11];
	while (cin >> n, n){
		for (int i = 0; i < 11; i++){
			for (int j = 0; j < 11; j++) field[i][j] = 0;
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++) cin >> field[i][j];
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++) field[n][i] += field[j][i];
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++) field[i][n] += field[i][j];
		}
		for (int i = 0; i < n; i++) field[n][n] += field[n][i];
		for (int i = 0; i <= n; i++){
			for (int j = 0; j <= n; j++)  printf("%5d",field[i][j]);
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 1020000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	string s; cin >> s;
	vl t(n);
	bool flag = true;
	rep(i,n){
		t[i] = s[i] - '0';
		if(t[i] == 2) flag = false;
	}
	if(flag){
		ll now = n;
		while(now > 1){
			ll p = 1;
			ll cnt = 0;
			while(now > 2*p) p *= 2;
			for(ll i=0; i+p<now; i++){
				t[i] = (t[i]==t[i+p]);
				cnt++;
			}
			now = cnt;
		}
		if(t[0]) cout << 0 << endl;
		else cout << 2 << endl;
	}else{
		ll now = n;
		while(now > 1){
			ll p = 1;
			ll cnt = 0;
			while(now > 2*p) p *= 2;
			for(ll i=0; i+p<now; i++){
				t[i] = (t[i]%2!=t[i+p]%2);
				cnt++;
			}
			now = cnt;
		}
		if(t[0]) cout << 1 << endl;
		else cout << 0 << endl;
	}
}

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

using namespace std;

int k, odd, even, jawaban;

int main () {
	cin >> k;
	if (k%2 == 0) {
		odd = k/2;
		even = k/2;
	}
	else {
		odd = k/2 + 1;
		even = k/2;
	}
	jawaban = odd * even;
	cout << jawaban << endl;
	return 0;
}


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

int main(){
	int n, r;
  	cin >> n >> r;
  	
  	int ans;
  	if(n < 10) ans = r+(10-n)*100;
  	else ans = r;
  	
  	cout << ans << endl;
}

Measured memory_bytes: 3580
#include<stdio.h>
#include<string.h>

int main(void){
	int i,j;
	char str[200],check[8]={};
	scanf("%s",str);
	
	if(strcmp(str,"keyence")==0){
		printf("YES");
		return 0;
	}
	
	for(i=0;i<=7;i++){
		for(j=1;j<=i;j++){
			check[j-1]=str[j-1];
		}
		for(j=1;j<=7-i;j++){
			check[j+i-1]=str[strlen(str)+j+i-8];
		}
		if(strcmp(check,"keyence")==0){
			printf("YES");
			return 0;
		}
	}
	printf("NO");
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n, x, t;
    cin >> n >> x >> t;

    cout << ((n - 1) / x + 1) * t << endl;
}

Measured memory_bytes: 3624
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=10005;
int fac[N],ifac[N];
void init(int n=1e4){
	fac[0]=ifac[0]=1;fp(i,1,n)fac[i]=mul(fac[i-1],i);
	ifac[n]=ksm(fac[n],P-2);fd(i,n-1,1)ifac[i]=mul(ifac[i+1],i+1);
}
inline int C(R int n,R int m){return m<0||m>n?0:1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
inline int ch(R int n,R int m){return n==0&&m==0?1:C(n+m-1,m-1);}
int n,a,b,c,res;
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d%d%d",&n,&a,&b,&c),res=0;
	init();
	if(b&1)return puts("0"),0;
	fp(i,0,a)fp(j,0,(c-i)/3){
		R int n1=i,n2=a-i,n3=j,n4=b>>1,k=c-i-j*3;
		if (n1<0||n2<0||n3<0||n4<0||k<0)continue;
		R int now=mul(fac[n1+n2+n3+n4],ch(k,n4));
		now=1ll*now*ifac[n1]%P*ifac[n2]%P*ifac[n3]%P*ifac[n4]%P;
		upd(res,now);
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

void bfs(ll n, vector<vector<ll>> &children, vector<ll> &cnt) {
  vector<ll> visit(n, 0);
  queue<ll> task;
  task.push(1);
  visit.at(0) = 1;
  while (task.size() > 0) {
    ll sz = task.size();
    for (int i = 0; i < sz; i++) {
      for (int j = 0; j < children.at(task.front() - 1).size(); j++) {
        if (visit.at(children.at(task.front() - 1).at(j) - 1) == 0) {
          cnt.at(children.at(task.front() - 1).at(j) - 1) += cnt.at(task.front() - 1);
          task.push(children.at(task.front() - 1).at(j));
          visit.at(children.at(task.front() - 1).at(j) - 1) = 1;
        }
      }
      task.pop();
    }
  }
  return;
}

int main() {
  ll n, q;
  cin >> n >> q;
  vector<ll> a(n - 1), b(n - 1), p(q), x(q), cnt(n);
  for (ll i = 0; i < n - 1; i++) cin >> a.at(i) >> b.at(i);
  for (ll i = 0; i < q; i++) cin >> p.at(i) >> x.at(i);
  for (ll i = 0; i < q; i++) cnt.at(p.at(i) - 1) += x.at(i);
  vector<vector<ll>> children(n);
  for (int i = 0; i < n - 1; i++) {
    children.at(a.at(i) - 1).push_back(b.at(i));
    children.at(b.at(i) - 1).push_back(a.at(i));
  }
  bfs(n, children, cnt);
  for (ll i = 0; i < n - 1; i++) cout << cnt.at(i) << " ";
  cout << cnt.at(n - 1) << endl;
}

Measured memory_bytes: 24148
#include <iostream>
#include <algorithm>
using namespace std;
#define MXN 100010
const int inf = 1000000000;
int h[MXN], dp[MXN];

int _abs(int x)
{
	return x<0? -x:x;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N; cin>>N;
	int K; cin>>K;
	for(int i=1; i<=N; i++) cin>>h[i];

	dp[1] = 0;
	dp[2] = _abs(h[2]-h[1]);
	for(int i=3; i<=N; i++)
	{
		dp[i] = inf;
		for(int j=max(i-K, 1); j<i; j++)
			if(_abs(h[i]-h[j])+dp[j]<dp[i]) dp[i] = _abs(h[i]-h[j])+dp[j];
	}
	cout << dp[N] << '\n';
	return 0;
}

Measured memory_bytes: 1024
import bisect
from itertools import accumulate
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
A2 = [0]+list(accumulate(A))
def judge(mid):
    count = 0
    for i in range(N):
        border = mid - A[i]
        ind = bisect.bisect_left(A,border)
        count += N-ind
    if count < M:
        return True
    else:
        return False
mina = 0
maxa = 2*(10**5) + 1
while maxa-mina > 1:
    mid = (maxa+mina)//2
    if judge(mid):
        maxa = mid
    else:
        mina = mid
count = 0
ans = 0
for i in range(N):
    border = maxa - A[i]
    ind = bisect.bisect_left(A,border)
    count += N-ind
    ans += A[i]*(N-ind) + A2[N]-A2[ind]
if count == M:
    print(ans)
else:
    rem = M-count
    print(ans+rem*mina)

Measured memory_bytes: 14256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

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

	vector<long long> A(N);
	

	long long all = 0;

	for(int i = 0; i < N; i++) {
		cin >> A[i];
		all += A[i];
	}

	long long min = 2222222222;
	long long count = 0;

	for(int i = 0; i < N; i++) {
		count += A[i];
		if(abs(all - count * 2) < min) {
			min = abs(all - count * 2);
		}
	}	

	cout << min << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

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

typedef long long ll;

const int INF = 1e8;

int main() {
  string w; cin >> w;
  bool flag = true;
  int map[26] = {};
  
  rep(i, w.length()) map[w[i]-'a']++;

  rep(i, 26) if(map[i]%2 != 0) flag = false;
    
  cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

	int a,b,c,d;

	scanf("%d %d %d %d",&a,&b,&c,&d);

	if(a<=c && c-a<=d){
	printf("Yes\n");
	}
	else if(a>=c && a-c<=d){
	printf("Yes\n");
	}
	else if(a<=b&&b<=c && b-a<=d&&c-b<=d){
	printf("Yes\n");
	}
	else if(c<=b&&b<=a&&b-c<=d&&a-b<=d){
	printf("Yes\n");
	}
	else{
	printf("No\n");
	}

return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  int n;
  cin >> n;
  vl ans;
  ll sum = 0;
  srep(i,1,n+1){
    sum+=i;
    ans.push_back(i);
    if(sum >= n)break;
  }
  
  int d = sum-n;
  for(auto v : ans){
    if(v == d)continue;
    cout<<v<<endl;
  }

  return 0;
}

Measured memory_bytes: 384
h,w,a,b=map(int,input().split())
mod=10**9+7

n=h+w+1
fc,inv=[1]*n,[1]*n
for i in range(1,n):
    fc[i]=i*fc[i-1]%mod
inv[n-1]=pow(fc[n-1],mod-2,mod)
for i in range(n-1,0,-1):
    inv[i-1]=inv[i]*i%mod
f=lambda a,b:fc[a+b]*inv[a]*inv[b]%mod

v=0
for i in range(b,w):
    v+=f(h-a-1,i)*f(a-1,w-i-1)%mod
print(v%mod)


Measured memory_bytes: 18804
import numpy as np
from itertools import product
H, W, K = map(int, input().split())
G = np.array([list(map(int, list(input()))) for _ in range(H)])

ans = float('inf')
for pattern in product([0, 1], repeat=H - 1):
    # スライスで横方向への割り方を表現する
    div = [0] + [i for i, p in enumerate(pattern, start=1) if p == 1] + [10]

    # 横方向へ割った後、各ブロックについて縦方向にホワイトチョコの数を修正
    rows = []
    for i in range(len(div) - 1):
        rows.append(np.sum(G[div[i]: div[i + 1]], axis=0))

    # 縦方向にすでにK個より多いホワイトチョコが含まれている場合はどうにもならない
    if [r for r in rows if np.any(r > K)]:
        continue

    # 縦方向に貪欲に割っていく
    rows = [r.tolist() for r in rows]
    tmp_ans = 0
    counts = [0] * len(rows)
    w = 0
    while w < W:
        for r in range(len(rows)):
            counts[r] += rows[r][w]
        if any([c > K for c in counts]):
            counts = [0] * len(rows)
            w -= 1
            tmp_ans += 1
        w += 1

    # 横に割った分を加算
    tmp_ans += len(div) - 2
    ans = min(ans, tmp_ans)

print(ans)


Measured memory_bytes: 20052
//ÃˆÃ“Ã£ Ã‡Ã¡Ã¡Ã¥ Ã¦Ã¡Ã‡ ÃÃ¦Ã¡ Ã¦Ã¡Ã‡ ÃžÃ¦Ã‰ Ã…Ã¡Ã‡ ÃˆÃ‡Ã¡Ã¡Ã¥
#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define pb push_back
#define ins insert
#define be begin
#define en end
#define fast ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
using namespace std;
const int INF=1e9;
//ll a,b;
ll a[202020],b[202020];
vector<ll>v;
pair<ll,ll>p;
map<string,int>mp;
//map<string,int>::iterator it;
set<ll>st;
set<ll>::iterator it;
string s,t;
ll q,n,m,k,z,x,y,d,sum,cnt,mx=0;
int MN(){
	int mn=1e9;
	int S=s.size();
	int T=t.size();
	for(int i=0;i<=S-T;i++){
		int cnt=0;
		for(int j=0;j<t.size();j++)
			if(t[j]!=s[i+j])
				cnt++;
		mn=min(mn,cnt);
	}
	return mn;
}
int main(){
	fast;
	cin>>s>>t;
	cout<<MN();
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int n,l,r,ans,i;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&l,&r);
		ans+=r-l+1;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int cnt,n,k;

int main()
{
	cin>>n>>k;
	while(n)
	{
		n/=k;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll d,g,x,y,z,w,a,b;
    cin>>d;
    x=0;
    while(d--)
    {
        cin>>g;
        g--;
        x+=g;
    }
    cout<<x<<endl;
}



Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))


int main() {
	string s;
	cin >> s;
	int n = s.size();
	bool flag = false;

	ll ans = 0,bcnt=0;
	for (int i = 0;i < n; i++) {
		if (s[i] == 'W') {
			ans += bcnt;
		} else {
			bcnt++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] h = new long[n];
        for(int i=0;i<n;i++){
            h[i] = sc.nextInt();
        }
        boolean[] noGood = new boolean[n];
        for(int i=0;i<m;i++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            if(h[a] <= h[b]){
                noGood[a] = true;
            }
            if(h[a] >= h[b]){
                noGood[b] = true;
            }
        }
        int ans = 0;
        for(int i=0;i<n;i++){
            if(!noGood[i]){
                ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 50592
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vec(a) vector<int>a
using namespace std;


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	ll a,b,c,d,i,j,k,l;
	cin>>a>>b>>c>>d;
	while(1)
	{
		c=c-b;
		if(c<=0)
		{
			cout<<"Yes\n";
			break;
		}
		a=a-d;
		if(a<=0)
		{
			cout<<"No\n";
			break;
		}
	}
	return 0;
}
	

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	string s;
	cin >> s;
	bool flag = false;
	rep(i, s.size()) {
		if (s[i] == 'C')flag = true;
		if (flag&&s[i] == 'F') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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


int main(){
    int n,R[200010],MAX=-2000000000;
    cin>>n;
    for(int i=0;i<n;i++)cin>>R[i];
    int MIN=R[0];
    for(int i=1;i<n;i++){
        MAX=max(MAX,R[i]-MIN);
        MIN=min(MIN,R[i]);
    }
    cout<<MAX<<endl;
    
}






Measured memory_bytes: 3880
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long c = sc.nextInt();
        long d = sc.nextInt();
        long e = sc.nextInt();
        long f = sc.nextInt();
        long answater = 100 * a;
        long anssuger = 0;
        double ansper = 0;
        for (long i = 0; 100 * a * i <= f; i++) {
            for (long j = 0; 100 * a * i + 100 * b * j <= f; j++) {
                for (long k = 0; 100 * a * i + 100 * b * j + k * c <= f; k++) {
                    for (long l = 0; 100 * a * i + 100 * b * j + k * c + l * d <= f; l++) {
                        if (c * k + d * l > (a * i + b * j) * e) {
                            continue;
                        }
                        double tmp = (k * c + l * d) * 1.0 / (100 * a * i + 100 * b * j + k * c + l * d);
 
                        if (tmp > ansper) {
                            ansper = tmp;
                            answater = 100 * a * i + 100 * b * j + k * c + l * d;
                            anssuger = k * c + l * d;
                        }
                    }
                }
            }
        }
        System.out.println(answater + " " + anssuger);
    }
}

Measured memory_bytes: 23508
#include<stdio.h>
#include<math.h>
int main(){
int n,a,num=1,m;
	
	
	scanf("%d",&n);
	m=n;
	while(n--)
	{
		scanf("%d",&a);
		if(a%2==1)num*=1;
		else num*=2;
		
	}
	printf("%d",(int)pow(3,m)-num);
	
	
	
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define fast       ios_base::sync_with_stdio(false); cin.tie(NULL);

int main (){
    ll R;
    cin>>R;
    double ans= 2*R*3.14;
    cout<<ans<<"\n";
    
}

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

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

template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

const int MAX_D = 10;

class Solver {
  public:    
    bool solve() {
        int N, M; cin >> N >> M;
        vector<vector<int>> E(N);
        rep(i, M) {
            int a, b; cin >> a >> b;
            a--; b--;
            E[a].push_back(b);
            E[b].push_back(a);
        }
        
        int Q; cin >> Q;
        vector<int> V(Q), D(Q), C(Q);
        rep(i, Q) {
            cin >> V[i] >> D[i] >> C[i];
            V[i]--;
        }
        
        vector<vector<int>> dp(N, vector<int>(MAX_D + 1, -1));

        function<void(int, int, int)> paint = [&] (int node, int time, int dist) {
            if(dist < 0 or dp[node][dist] >= 0) return;
            dp[node][dist] = time;
            for(int nxt : E[node]) paint(nxt, time, dist - 1);
        };
        
        for(int q = Q - 1; q >= 0; q--) paint(V[q], q, D[q]);

        rep(i, N) {
            int time = -1;
            rep(t, MAX_D + 1) set_max(time, dp[i][t]);
            cout << (time >= 0 ? C[time] : 0) << endl;
        }
        
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 16248
#include <bits/stdc++.h>
const long long INF = LLONG_MAX/2;
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

using namespace std;
ll ans=0, sum = 0;

ll n;
vector<ll> v;

int main()
{
	cin >> n;
	v.resize(n*2);
	REP(i, n*2) cin >> v[i];
	sort(v.begin(), v.end());
	for (int i = 0; i < n * 2; i += 2) ans += v[i];
	cout << ans << endl;
}

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

using ll = long long;
const ll INF = 1e18L+7;
const int nax = 405;
ll dp[nax][nax];
ll sum(int l, int r, vector<int>&a){
  ll s = 0;
  for(int i=l; i<=r; i++){
    s+=a[i];
  }
  return s;
}

void slime(int n, vector<int>&a){
  for(int L=n-1; L>=0; L--){
    for(int R=L; R<n; R++){
      if(R == L){
	dp[L][R] = 0;
      }else{
	dp[L][R] = INF;
	ll s = sum(L,R,a);
	for(int i=L; i<=R-1; i++){
	  dp[L][R] = min(dp[L][R], dp[L][i]+dp[i+1][R]+s);
	}
      }
    }
  }
  cout << dp[0][n-1];
}

int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  slime(n, a);
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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 ll mod = 1000000007;
const ll inf = 1LL << 60;

vll seen;
void dfs(vvll& graph, ll i){
	seen.at(i) = 1;
	vrep(j, graph.at(i)) if(seen.at(j) == 0) dfs(graph, j);
}

int main(){
	ll n, m;
	cin >> n >> m;
	vvll graph(n);
	rep(i, 0, m){
		ll x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		graph.at(x).push_back(y);
		graph.at(y).push_back(x);
	}

	seen.assign(n, 0);
	ll ans = 0;
	rep(i, 0, n) if(seen.at(i) == 0){
		dfs(graph, i);
		ans++;
	}
	cout << ans << endl;
}

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

const int INF = 10000000;
const int MAX_V = 51;

int d[MAX_V][MAX_V];
int V;

void warshall_floyd() {
  for ( int k = 0; k < V; k++ ) {
    for (int i = 0; i < V; i++ ) {
      for ( int j = 0; j < V; j++ ) {
	d[i][j] = min(d[i][j], d[i][k] + d[k][j] );
      }
    }
  }
}


int main() {

  cin >> V;

  for ( int i = 0; i < 51; i++ ) {
    for ( int j = 0; j < 51; j++ ) {
      if ( i == j ) d[i][j] = 0;
      else d[i][j] = INF;
    }
  }


  int m; cin >> m;
  int a,b,c,dd;
  char ch1,ch2,ch3;
  for ( int i = 0; i < m; i++ ) {

    cin >> a >> ch1 >> b >> ch2 >> c >> ch3 >> dd;
    a--; b--;
    d[a][b] = c;
    d[b][a] = dd;
  }

  int x1,x2,y1,y2;
  cin >> x1 >> ch1 >> x2 >> ch2 >> y1 >> ch3 >> y2;
  x1--; x2--;
  warshall_floyd();

  int ans = y1 - d[x1][x2] - d[x2][x1] - y2;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int count = 0;
  bool even = true;
  
  
  while(even){
    for (int i = 0; i < N; i++) {
      if(!(vec.at(i) % 2)){
        vec.at(i) = vec.at(i) / 2;
      }else{
      	even = false;
      }
    }
    if(even){
    	count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    vector<pii> v;

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j,a,b;
            cin>>n;
            for(i=1;i<=n;++i)
            {
                cin>>a>>b;
                v.pb({b,a});
            }
            sort(v.begin(),v.end());
            int cur=0;
            for(i=0;i<v.size();++i)
            {
                if(cur+v[i].s>v[i].f)
                {
                    cout<<"No"<<endl;
                    return 0;
                }
                cur=cur+v[i].s;
            }
            cout<<"Yes"<<endl;
        }
        return 0;
    }


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}


const ll MOD = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint& operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}
  mint& operator-=(const mint a) {if ((x += MOD-a.x) >= MOD) x -= MOD;return *this;}
  mint& operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}
  mint operator+(const mint a) const {mint res(*this);return res+=a;}
  mint operator-(const mint a) const {mint res(*this);return res-=a;}
  mint operator*(const mint a) const {mint res(*this);return res*=a;}
  mint pow(ll b) const {
    mint res(1), a(*this);
    while (b) {
      if (b & 1) res *= a;
      a *= a;
      b >>= 1;
    }
    return res;
  }
  // for prime MOD
  mint inv() const {return pow(MOD-2);}
  mint& operator/=(const mint a) {return (*this) *= a.inv();}
  mint operator/(const mint a) const {mint res(*this);return res/=a;}
};
ostream& operator<<(ostream& os, const mint& a) {os << a.x; return os;}



const int SZ = 312345;
ll inv[SZ];
ll fact[SZ];
ll fact_inv[SZ];
mint choose(int n, int r) {
  if (n < 0 || r < 0 || n < r) return 0;
  ll res = fact[n] * fact_inv[n-r] % MOD * fact_inv[r] % MOD;
  return mint(res);
}

mint f(int K, int N) {
  return choose(N+K-1, N);
}

mint solve(int N, int K, int P) {
  mint ans = 0;
  for (int p1 = 0; p1 <= P; p1++) {
    int p2 = P - p1;
    ans += f(K- 2*p1 - p2, N-p2) * mint(2).pow(p2) * choose(P, p1);
  }
  return ans;
}


int main2() {
  int K = nextLong();
  int N = nextLong();

  for (int i = 2; i <= 2*K; i++) {
    int j = min(i, 2*K+2-i);
    mint ans = 0;
    if (j % 2 == 0) {
      ans += solve(N, K-1, (j-1)/2);
      ans += solve(N-1, K-1, (j-1)/2);
    } else {
      ans += solve(N, K, j / 2);
    }
    cout << ans << endl;
  }
  return 0;
}

int main() {

  inv[1] = 1;
  for (int i = 2; i < SZ; i++) inv[i] = inv[(int) (MOD % i)] * (MOD - MOD / i) % MOD;
  fact[0] = 1;
  for (int i = 1; i < SZ; i++) fact[i] = fact[i-1] * i % MOD;
  fact_inv[0] = 1;
  for (int i = 1; i < SZ; i++) fact_inv[i] = fact_inv[i-1] * inv[i] % MOD;

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 11092
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int k = sc.nextInt();
		char[][] s = new char[h][w];
		for (int i = 0; i < h; i++) {
			s[i] = sc.next().toCharArray();
		}
		sc.close();

		int ans = Integer.MAX_VALUE;
		int end = 1 << h - 1;
		label:
		for (int i = 0; i < end; i++) {
			int[] g = new int[h];
			int idx = 0;
			for (int j = 0; j < h - 1; j++) {
				if ((i >> j & 1) == 1) {
					idx++;
				}
				g[j + 1] = idx;
			}

			int val = idx;
			int[] cnt = new int[idx + 1];
			for (int x = 0; x < w; x++) {
				for (int j = 0; j < h; j++) {
					if (s[j][x] == '1') {
						cnt[g[j]]++;
					}
				}
				boolean flg = true;
				for (int j = 0; j < cnt.length; j++) {
					if (cnt[j] > k) {
						flg = false;
						val++;
						break;
					}
				}
				if (!flg) {
					Arrays.fill(cnt, 0);
					for (int j = 0; j < h; j++) {
						if (s[j][x] == '1') {
							cnt[g[j]]++;
						}
					}
					for (int j = 0; j < cnt.length; j++) {
						if (cnt[j] > k) {
							continue label;
						}
					}
				}
			}
			ans = Math.min(ans, val);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25116
N = int(input())
a = [int(i) for i in input().split()]
count = 0
i = 0
while i<N-1:
    if a[i]<a[i+1]:
        i += 1
        while i<N-1:
            if a[i]<=a[i+1]:
                i+=1
            else:
                count+=1
                i+=1
                break
    elif a[i]>a[i+1]:
        i+=1
        while i<N-1:
            
            if a[i]>=a[i+1]: #
                i+=1
            else:
                count+=1
                i+=1
                break
    else:
        i+=1
        while i<N-1:
            if a[i]==a[i+1]:
                i+=1
            else:
                break
print(count+1)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

#define int long long

typedef pair<int, int> P;

int H, W, S;
vector< vector<int> > A;
bool m1[40][40][40][40];
P m2[40][40][40][40];
int m[50][50];

void setM(int x, int y, int val) {
	m[y+1][x+1] = val;
}
int getM(int x1, int y1, int x2, int y2) {
	return m[y2][x2] - m[y2][x1] - m[y1][x2] + m[y1][x1];
}
void initM() {
	REP(x, W+1) REP(y, H+1) {
		m[y+1][x] += m[y][x];
	}
	REP(x, W+1) REP(y, H+1) {
		m[y][x+1] += m[y][x];
	}
}

// [x1, x2) && [y1, y2)
P solve(int x1, int y1, int x2, int y2) {
	if (m1[x1][y1][x2][y2]) return m2[x1][y1][x2][y2];

	P res(1, S-(getM(0, 0, W, H) - getM(x1, y1, x2, y2)));
	if (res.second < 0) {
		res = P(-inf, -inf);
	}
	else {
		// [y1, y) [y, y2)
		FOR(y, y1+1, y2) {
			P a1 = solve(x1, y1, x2, y);
			P a2 = solve(x1, y, x2, y2);
			if (a1.first < 0 || a2.first < 0) continue;
			P a = P(a1.first+a2.first, min(a1.second, a2.second));
			res = max(res, a);
		}
		// [x1, x) [x, x2)
		FOR(x, x1+1, x2) {
			P a1 = solve(x1, y1, x, y2);
			P a2 = solve(x, y1, x2, y2);
			if (a1.first < 0 || a2.first < 0) continue;
			P a = P(a1.first+a2.first, min(a1.second, a2.second));
			res = max(res, a);
		}
	}
//	cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << res.first << " " << res.second << endl;
	return m1[x1][y1][x2][y2] = true, m2[x1][y1][x2][y2] = res;
}

signed main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	while (cin >> H >> W >> S, H || W || S) {
		fill(m[0], m[50], 0);
		fill(m1[0][0][0], m1[39][39][40], false);
		A = vector< vector<int> >(H, vector<int>(W, 0));
		REP(y, H) REP(x, W) {
			cin >> A[y][x];
			setM(x, y, A[y][x]);
		}
		initM();
		int sum = 0;
		REP(y, H) REP(x, W) sum += A[y][x];
		P ans = solve(0, 0, W, H);
		assert(ans.first >= 0 && ans.second >= 0);
		cout << ans.first << " " << ans.second << endl;
	}
}

Measured memory_bytes: 43776
#include<stdio.h>
#define NUM 2000

int n,A[NUM];

int solve(int, int);

int main(){
  int q,m[NUM],i;

  scanf("%d",&n);

  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);

  scanf("%d",&q);

  for(i = 0; i < q; i++){
    scanf("%d",&m[i]);
    if(solve(0,m[i]))
      printf("yes\n");

    else
      printf("no\n");
  }

  return 0;

}

int solve(int i, int m){
  int res;

  if(m == 0)
    return 1;

  if(i >= n)
    return 0;

  res = solve(i+1, m) || solve(i+1, m-A[i]);
  return res;
}

Measured memory_bytes: 588
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
	ll n;
	cin>>n;
	ll d[n]={0};
	ll x,y;
	cin>>x>>y;
	vi a[n+1];
	rep(i,1,n) a[i].pb(i+1),a[i+1].pb(i);
	a[x].pb(y);
	a[y].pb(x);
	rep(i,1,n+1)
	{
		ll vis[n+1]={0};
		ll dis[n+2]={0};
		rep(j,1,n+1) dis[j]=hell,vis[j]=0;
		vis[i]=1;
		dis[i]=0;
		queue <ll> q;
		q.push(i);
		while(!q.empty())
		{
			ll p=q.front()	;
			d[dis[p]]++;
			q.pop();
			for(auto i:a[p])
			{
				if(!vis[i])
				{
					vis[i]=1;
					dis[i]=dis[p]+1;
					q.push(i);
				}
			}
		}
	}
	rep(i,1,n) cout<<d[i]/2<<endl;	
}
signed main()
{
	
		/***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
		
	}
	TIME
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void){
    int a,b,i;
    char op;
    for(i=0;;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')printf("%d\n",a+b);
        else if(op=='-')printf("%d\n",a-b);
        else if(op=='*')printf("%d\n",a*b);
        else if(op=='/')printf("%d\n",a/b);
        else if(op=='?')break;
        
    }
    return 0;
}


Measured memory_bytes: 2068
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ld eps = (ld)1 / 1e9;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    fast_io;
    ll x, st = 100;
    ll s = 0;
    cin >> x;
    while (st < x)
    {
        st += st / 100;
        s++;
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 3640
N=int(input())
S=input()

def solve(s,s2):
  cnt=set(s.strip())
  cnt2=set(s2.strip())
  return len(cnt&cnt2)
  
ans=0
for i in range(1,N-1):
  ans=max(ans,solve(S[:i],S[i:]))

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n;

int dfs(ll num, int i3, int i5, int i7, ll jo){
	if(num > n) return 0;
	
	if(i3 && i5 && i7) return dfs(num+jo*3, i3+1, i5, i7, jo*10) + dfs(num+jo*5, i3, i5+1, i7, jo*10) + dfs(num+jo*7, i3, i5, i7+1, jo*10) + 1;
	return dfs(num+jo*3, i3+1, i5, i7, jo*10) + dfs(num+jo*5, i3, i5+1, i7, jo*10) + dfs(num+jo*7, i3, i5, i7+1, jo*10);
}

int main(){
	cin >> n;
	
	cout << dfs(0, 0, 0, 0, 1) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
map<string,int> mp;
string s;
int main()
{
	ios::sync_with_stdio(false);
	cin>>s,mp["SUN"]=7,mp["MON"]=6,mp["TUE"]=5,mp["WED"]=4,mp["THU"]=3,mp["FRI"]=2,mp["SAT"]=1;
	cout<<mp[s]<<'\n';
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
#define EPS (1e-7)

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


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


string s;

bool check_dream(int i) {
	if (s[i] == 'm'&&s[i - 1] == 'a'&&s[i - 2] == 'e'&&s[i - 3] == 'r'&&s[i - 4] == 'd') {
		return true;
	}
	else return false;
}
bool check_dreamer(int i) {
	if (s[i] == 'r'&&s[i - 1] == 'e'&&s[i - 2] == 'm'&&s[i - 3] == 'a'&&s[i - 4] == 'e'&&s[i - 5] == 'r'&&s[i - 6] == 'd') {
		return true;
	}
	else return false;
}
bool check_erase(int i) {
	if (s[i] == 'e'&&s[i - 1] == 's'&&s[i - 2] == 'a'&&s[i - 3] == 'r'&&s[i - 4] == 'e') {
		return true;
	}
	else return false;
}
bool check_eraser(int i) {
	if (s[i] == 'r'&&s[i - 1] == 'e'&&s[i - 2] == 's'&&s[i - 3] == 'a'&&s[i - 4] == 'r'&&s[i - 5] == 'e') {
		return true;
	}
	else return false;
}




int main() {
	
	cin >> s;

	int n = s.length();
	int i = n - 1;

	while (true) {
		if (check_dream(i)) {
			i -= 5;
		}
		else if (check_dreamer(i)) {
			i -= 7;
		}
		else if (check_erase(i)) {
			i -= 5;
		}
		else if (check_eraser(i)) {
			i -= 6;
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
		if (i == -1) {
			cout << "YES" << endl;
			return 0;
		}

	}



	return 0;
}



Measured memory_bytes: 512
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

fn main() {
    let q: Vec<usize> = read_vec();
    let (n, m) = (q[0], q[1]);

    let mut xs: Vec<i32> = read_vec();
    xs.sort();
    let mut intervals: Vec<i32> = (0..(m - 1)).map(|i| xs[i + 1] - xs[i]).collect();
    intervals.sort();

    let mut ans = 0;
    if n < m {
        ans = intervals[0..(m - n)].iter().fold(0, |sum, x| sum + x);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#define ll long long 
#include <algorithm>
using namespace std;
inline void read(ll &k)
{
	ll f=1,c=getchar();k=0;
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();
	k*=f;
}
const int maxn=100000*2+100;
bool is=1;
int col[maxn];
ll n,m,u,tot=0,vv,a[maxn],b[maxn],last[maxn],to[maxn],qaq[maxn];
void dfs(int now)
{
//	cout <<now<<endl;
	for (ll i=last[now];i;i=qaq[i])
	{
		if (!col[to[i]])col[to[i]]=3-col[now],dfs(to[i]);
		else if (col[to[i]]==col[now])is=0;
	}
}
int main()
{
	read(n);read(m);
	for (register int i=1;i<=m;i++)
	{
		read(u);read(vv);
		qaq[++tot]=last[u];
		last[u]=tot;
		to[tot]=vv;
		qaq[++tot]=last[vv];
		last[vv]=tot;
		to[tot]=u;
	}
	col[1]=1;
	dfs(1);
	ll b=0;
//	for (int i=1;i<=n;i++)cout << col[i]<<" ";cout <<endl;
	for (register int i=1;i<=n;i++)
	if (col[i]==2)b++;
//	cout << (int)is<<endl;
	if (is)printf("%lld\n",b*(n-b)-m);else printf("%lld\n",n*(n-1)/2-m);
}

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

using namespace std;

typedef long long int ll;

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

  ll n, K;
  cin >> n >> K;
  vector < pair < ll, ll > > pts;
  for(int i = 0; i < n; i++){
    ll x, y;
    cin >> x >> y;
    pts.push_back({x, y});
  }

  sort(pts.begin(), pts.end());

  ll area = LLONG_MAX;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      if(j - i + 1 < K) continue;
      vector < ll > v;
      for(int k = i; k <= j; k++) v.push_back(pts[k].second);
      sort(v.begin(), v.end());
      ll mi = LLONG_MAX;
      for(int k = 0; k < v.size() && K + k - 1 < v.size(); k++){
        mi = min(mi, v[K - 1 + k] - v[k]);
      }
      ll tmp_area = mi;
      tmp_area *= (pts[j].first - pts[i].first);
      area = min(area, tmp_area);
    }
  }

  cout << area << '\n';
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, K;
  cin >> N >> K;
  int S = 1;
  for (int i = 0; i < N; i++){
    
    if (S * 2 < S + K){
      S *= 2;
    }
    else {
      S += K;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000000000000
#define lli long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli n;
    cin>>n;
    lli arr[n][3], dp[n][3];
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<3; j++)
        {
            cin>>arr[i][j];
            if(!i)
                dp[i][j]=arr[i][j];
        }
    }
    for(int i=1; i<n; i++)
        dp[i][0]=arr[i][0]+max(dp[i-1][2], dp[i-1][1]), dp[i][1]=arr[i][1]+max(dp[i-1][0], dp[i-1][2]), dp[i][2]=arr[i][2]+max(dp[i-1][0], dp[i-1][1]);
    cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
    return 0;
}

Measured memory_bytes: 8252
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	char input[25];
	int a, b;
	int d;
	int r;
	double f;
	
	fgets(input, sizeof(input), stdin);
	a = atoi(strtok(input, " "));
	b = atoi(strtok(NULL, " "));
	
	d = a / b;
	r = a % b;
	f = (double)a / b;
	
	printf("%d %d %.5f\n", d, r, f);
	
	return 0;
}

Measured memory_bytes: 580