akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll n,k; cin>>n>>k;
    vector<ll> a(n),f(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>f[i];

    sort(a.begin(), a.end(),greater<>());
    sort(f.begin(), f.end());

    auto check = [&](ll x) -> bool {
        ll cnt = 0;
        rep(i,n) {
            cnt += max((a[i]-(x/f[i])),0ll);
        }
        return (k>=cnt);
    };

    ll ok = LINF; ll ng = -1;
    while (abs(ok-ng)>1) {
        ll mid = (ok+ng)/2;
        if (check(mid)) ok = mid;
        else ng = mid;
    }

    cout << ok << '\n';
    return 0;
}

Measured memory_bytes: 3328
(R, D, M) = list(map(int, input().split()))
R_yen = list(map(int, input().split()))
D_yen = list(map(int, input().split()))
min = 100000000
min_R = 10000000
min_D = 10000000
for i in range(M):
  (R_dis, D_dis, Dis) = list(map(int, input().split()))
  a = R_dis-1
  b = D_dis-1
  k = R_yen[a] + D_yen[b] - Dis
  if min > k:
    min = k
for i in R_yen:
  if min_R > i:
    min_R = i
for i in D_yen:
  if min_D > i:
    min_D = i
if min > min_R + min_D:
  min = min_R + min_D
print(str(min))

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

int main() {
	long long R, C, N;
	vector<pair<int, int> > V;
	cin >> R >> C >> N;
	for (int i = 0; i < N; i++) {
		int X1, Y1, X2, Y2;
		cin >> X1 >> Y1 >> X2 >> Y2;
		if ((X1 == 0 || X1 == R || Y1 == 0 || Y1 == C) && (X2 == 0 || X2 == R || Y2 == 0 || Y2 == C)) {
			long long First, Second;
			if (X1 == 0) First = Y1;
			else if (Y1 == C) First = C + X1;
			else if (X1 == R) First = C * 2 + R - Y1;
			else if (Y1 == 0) First = C * 2 + R * 2 - X1;
			if (X2 == 0) Second = Y2;
			else if (Y2 == C) Second = C + X2;
			else if (X2 == R) Second = C * 2 + R - Y2;
			else if (Y2 == 0) Second = C * 2 + R * 2 - X2;
			if (First > Second) swap(First, Second);
			V.push_back({ First, i * 2 });
			V.push_back({ Second,i * 2 + 1 });
		}
	}
	sort(V.begin(), V.end());
	stack<int> ST;
	for (int i = 0; i < V.size(); i++) {
		if (V[i].second % 2 == 0) {
			ST.push(V[i].second / 2);
		}
		else {
			if (ST.top() != V[i].second / 2) {
				cout << "NO" << endl;
				return 0;
			}
			ST.pop();
		}
	}
	cout << "YES" << endl;
}

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

ll solve() {
    string S, T;
    cin >> S >> T;
    vector<vector<int>> pos(26, vector<int>());
    ll ns = S.size(), nt = T.size();
    for ( int i = 0; i < ns; i++ ) {
        pos[S[i] - 'a'].push_back(i);
    }
    ll lp = 0, ps = 0;
    for ( int pt = 0; pt < nt; pt++ ) {
        int c = T[pt] - 'a';
        auto ips = lower_bound(pos[c].begin(), pos[c].end(), ps);
        if ( ips == pos[c].end() ) {
            lp++;
            ips = lower_bound(pos[c].begin(), pos[c].end(), 0);
            if ( ips == pos[c].end() ) return -1;
        }
        ps = *ips + 1;
    }
    ll ans = lp * ns + ps;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

int main() {
  int N, M, a, b, i;
  cin >> N >> M;
  vector<int> r(N);
  
  for(i=0; i<M; i++) {
    cin >> a >> b;
    r.at(a-1)++;
    r.at(b-1)++;
  }
  
  for(i=0; i<N; i++)
    cout << r.at(i) << endl;
}

Measured memory_bytes: 256
-- 127 e
import Data.Int

modv_ = 1000000007 :: Int64

mul_ :: Int64 -> Int64 -> Int64
mul_ x y = ( x * y ) `mod` modv_

div_ :: Int64 -> Int64 -> Int64
div_ x y = x `mul_` (power_ y (modv_ - 2))

power_ :: Int64 -> Int64 -> Int64
power_ _ 0 = 1 
power_ x y = power_ (x `mul_` x) (y `div` 2) `mul_` if even y then 1 else x

combination :: Int64 -> Int64 -> Int64
combination n 0 = 1
combination n m = (combination (n-1) (m-1)) `mul_` n `div_` m

sum_ :: Int64 -> Int64 
sum_ i = (sum1 - sum2) `mod` modv_
    where
        sum1 = i * i * (i+1) `div` 2
        sum2 = i * (i+1) * (2*i+1) `div` 6

solve :: [Int64] -> Int64
solve (n:m:k:rest) = 
    result `mul_` resultc
    where
        result = (m * m * (sum_ n) + n * n * (sum_ m)) `mod` modv_
        resultc = combination (n * m - 2) (k - 2)

main = interact $ show.solve.map read.words


Measured memory_bytes: 6012
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;i++) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD=1e9+7;
vector<ll> G[100005];
ll dp[2][100005];

void dfs(ll u,ll f)
{
	dp[0][u]=dp[1][u]=1;
	for(ll i:G[u])
		if(i!=f)
			dfs(i,u),dp[0][u]=dp[0][u]*(dp[0][i]+dp[1][i])%MOD,dp[1][u]=dp[1][u]*dp[0][i]%MOD;
}

int main()
{jizz
	ll n,a,b;
	cin >> n;
	for(int i=1;i<n;++i)
		cin >> a >> b,G[a].pb(b),G[b].pb(a);
	dfs(1,1);
	cout << (dp[0][1]+dp[1][1])%MOD << '\n';
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

Vi digits;

ll nxt(ll x) {
    if (x <= 9) {
        return x + 1;
    }

    digits.clear();
    while (x > 0) {
        digits.push_back(x % 10);
        x /= 10;
    }

    digits.push_back(0);
    int nd = (int)digits.size();

    bool kur = true;
    int cur = -1;
    for (int i = 0; i < nd - 1; i++) {
        if (digits[i] != 9 && digits[i + 1] - digits[i] >= 0) {
            ++digits[i];
            cur = i;
            kur = false;
            break;
        }
    }

    if (kur) {
        if (digits[nd - 2] < 9) {
            ++digits[nd - 2];
            for (int i = nd - 2; i >= 1; i--) {
                digits[i - 1] = max(0, digits[i] - 1);
            }
        }
        else {
            digits[nd - 1] = 1;
            for (int i = nd - 2; i >= 0; i--) {
                digits[i] = 0;
            }
        }
    }
    else {
        for (int i = cur; i >= 1; i--) {
            digits[i - 1] = max(0, digits[i] - 1);
        }
    }

    ll res = 0;
    ll base = 1;
    for (int i = 0; i < nd; i++) {
        res += digits[i] * base;
        base *= 10;
    }

    return res;
}

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    int K;
    cin >> K;

    ll x = 1;
    for (int i = 0; i < K - 1; i++) {
        x = nxt(x);
    }

    cout << x << endl;

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

from collections import defaultdict, deque
import heapq
g = defaultdict(list)
for a, b in ab:
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)


d = [float('inf')] * n
d[0] = 0

q = [(0, 0)] # min-heap, (距離, 頂点)
prev = [float('inf')] * n # 経路をたどるときに使う
heapq.heapify(q)
while q:
    du, u = heapq.heappop(q) # 最短距離とその頂点
    if d[u] < du:
        continue
    for v in g[u]:
        if du + 1 < d[v]:
            d[v] = du + 1
            prev[v] = u
            heapq.heappush(q, (d[v], v))

f = True
prev2 = []
for i in range(1, n):
    if prev[i] == float('inf'):
        f = False
    prev2.append(prev[i] + 1)

if f:
    print('Yes')
    for p in prev2:
        print(p)
else:
    print('No')


Measured memory_bytes: 133304
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a+b);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a-b);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int n, m, c;
	cin >> n >> m >> c;
	vector<pair<int, int>> sx(n), sy(m);
	for (int i = 0; i < n; i++) {
		sx[i].second = i;
	}
	for (int i = 0; i < m; i++) {
		sy[i].second = i;
	}
	set<pair<int, int>> a;
	for (int i = 0; i < c; i++) {
		int x, y;
		cin >> x >> y;
		--x;
		--y;
		++sx[x].first;
		++sy[y].first;
		a.insert(make_pair(x, y));
	}
	sort(sx.rbegin(), sx.rend());
	sort(sy.rbegin(), sy.rend());
	int ret = 0;
	for (const auto& gx : sx) {
		for (const auto& gy : sy) {
			int d = a.count(make_pair(gx.second, gy.second));
			ret = max(ret, gx.first + gy.first - d);
			if (d == 0) {
				break;
			}
		}
	}
	cout << ret << endl;
	return;
	
	
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

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

int main(void){
    int x;cin>>x;
    int ans=0;
    while(true){
        if(x-500>=0){x-=500;ans+=1000;}
        else break;
    }
    while(true){
        if(x-5>=0){x-=5;ans+=5;}
        else break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char str[200];
int len;
int count(int num)
{
	int i;
	int j;
	char stat[27];
	int index=0;
	int x=1;
	int flag=0;
	int ret=0;
	for(i=0;i<=num-1;i++)
	{
		flag=0;
		for(x=1;x<=index;x++)
		{
			if(stat[x]==str[i])
			{
				flag=1;
				break;
			}
		}
		
		if(flag==1)
		{
			;
		}else {
			
			stat[++index]=str[i];
			flag=0;
			for(j=num;j<=len-1;j++)
			{
				if(str[i]==str[j])
				{
					flag=1;
				}
			}
			if(flag==1)
			{
				ret++;
			}else {
				;
			}
		}
	}
	return ret;
}
int main()
{
	
	int max;
	int i;
	int temp;
	scanf("%d",&len);
	scanf("%s",&str);

	max=0;
	for(i=1;i<=len-1;i++)
	{
		temp=count(i);
	//	printf("%d<<<<<\n",temp);
		if(max<temp)
		{
	//		printf("%d   %d\n",i,temp);
			max=temp;
		}
	}
	printf("%d\n",max);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;
constexpr long long logN = 60;


signed main(){
	int N,K;
	cin>>N>>K;
	K=K*N;
	vector<int>a(N*2);
	REP(i,N)cin>>a[i];
	REP(i,N)a[i+N]=a[i];
	map<int,vector<int>>idx;
	REP(i,2*N)idx[a[i]].push_back(i);
	vector<int>b(N);
	REP(i,N)b[i]=*lower_bound(ALL(idx[a[i]]),i+1)-i+1;
	vector<vector<int>>dp(logN+1,vector<int>(N,-1));
	REP(i,N)dp[0][i]=b[i];
	int maxK = 3e17;
	REP(i,logN)REP(j,N){
		if(dp[i][j]==-1)continue;
		dp[i+1][j]=min(maxK,dp[i][(j+dp[i][j])%N]+dp[i][j]);
	}
	int now = 0;
	RREP(i,logN+1){
		if(now+dp[i][now%N]>K)continue;
		now += dp[i][now%N];
		
	}
	if(K==0)return 0;
	int cnt = K - now;
	set<int>st;
	vector<int>v;
	REP(i,cnt){
		int ni = (now+i)%N;
		if(st.find(a[ni])!=st.end()){
			while(st.find(a[ni])!=st.end()){
				int t = v.back();
				st.erase(v.back());
				v.pop_back();
			}
		}else{
			st.insert(a[ni]);
			v.push_back(a[ni]);
		}
	}
	REP(i,v.size())cout << v[i] << " \n"[i+1 == v.size()];
}

Measured memory_bytes: 134856
from functools import reduce; from operator import add; print((lambda T, L: (reduce(add, (lambda t, l: [min(i - j, t) for i, j in zip(l[1:], l[:-1])])(T, L)) + T) if len(L) > 1 else T)(int(input().split()[1]), list(map(int, input().split()))))


Measured memory_bytes: 25700
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N;
int main(){
    cin >> N;
    vector<int> A(N+2),B(N+1),C(N+1);
    rep1(i,N) cin >> A[i] >> B[i] >> C[i];
    
    int dp[100100][3];
    
    dp[1][0] = A[1], dp[1][1] = B[1], dp[1][2] = C[1];
    
    rep1(i,N){
        dp[i+1][0] = max(dp[i][1]+A[i+1],dp[i][2]+A[i+1]);
        dp[i+1][1] = max(dp[i][0]+B[i+1],dp[i][2]+B[i+1]);
        dp[i+1][2] = max(dp[i][0]+C[i+1],dp[i][1]+C[i+1]);
    }
    
    pr(max(dp[N][0],max(dp[N][1],dp[N][2])));
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}

int64_t dp[101][4][4][4];

bool ng(int a, int b, int c){
    return (a==1 && b==2 && c==3);
}

int main(){
    int N;
    cin >> N;
    dp[0][0][0][0] = 1;
    for(int i=0; i<N; i++) for(int a=0; a<4; a++) for(int b=0; b<4; b++) for(int c=0; c<4; c++) for(int d=0; d<4; d++){
        if(ng(a, b, c) || ng(a, c, d) || ng(a, b, d) || ng(b, c, d)) continue;
        if(ng(c, b, d) || ng(b, d, c)) continue;
        add(dp[i+1][b][c][d], dp[i][a][b][c]);
    }
    int64_t ans = 0;
    for(int a=0; a<4; a++) for(int b=0; b<4; b++) for(int c=0; c<4; c++) add(ans, dp[N][a][b][c]);
    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++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
int a[50],b[50],c[50];
int dp[50][500][500];
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  // 
  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n,ma,mb;cin>>n>>ma>>mb;
  REP(i,n){
    cin>>a[i]>>b[i]>>c[i];
  }
  REP(i,n+1){
    REP(j,401){
      REP(k, 401){
        dp[i][j][k]=INF;
      }
    }
  }
  dp[0][0][0]=0;
  REP(i,n){
    REP(ca,401){
      REP(cb,401){
        if(dp[i][ca][cb]==INF)continue;
        dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
        dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb] + c[i]);
      }
    }
  }
  int ans=INF;
  for(int i=1;i<=400;i++) {
    for(int j=1;j<=400;j++) {
      if(mb*i==ma*j){
        ans=min(ans, dp[n][i][j]);
      }
    }
  }
  if(ans==INF)ans=-1;
  P(ans);
  return 0;
}


Measured memory_bytes: 40832
#include <stdio.h>

int main(void){
	int a,b,ans;
	int i;
	
	for(i=0;i<4;i++){
		scanf("%d %d",&a,&b);
		if(a==1){
			ans=6000*b;
			printf("%d\n",ans);
		}else if(a==2){
			ans=4000*b;
			printf("%d\n",ans);
		}else if(a==3){
			ans=3000*b;
			printf("%d\n",ans);
		}else if(a==4){
			ans=2000*b;
			printf("%d\n",ans);
		}
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  ll A, B, N;
  cin >> A >> B >> N;
  auto f = [&](ll x){
    return A * x / B;
  };
  ll min_x = min(B - 1, N);
  cout << f(min_x) << endl;
  return 0;
}


Measured memory_bytes: 3564
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans=0;
    for(int i=0;i<n-1;i++){
        set<char> st1,st2;
        ll cnt=0;
        for(int j=0;j<=i;j++) st1.insert(s[j]);
        for(int j=i+1;j<n;j++) st2.insert(s[j]);
        while(!st1.empty()){
            char c=*begin(st1);
            st1.erase(c);
            if(st2.count(c)) cnt++;
        }
        if(cnt>ans) ans=cnt;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int ar[10];
bool dfs(int i,int L,int R)
{
    if(i==10)
        return true;
    if(ar[i]<L&&ar[i]<R)
        return false;
    if(ar[i]>L)
    {
        if(dfs(i+1,ar[i],R))
            return true;
    }
    else if(dfs(i+1,L,ar[i]))
        return true;
    return false;
}
int main()
{
    scanf("%d",&N);
    while(N--)
    {
        for(int i=0;i<10;i++)
            scanf("%d",&ar[i]);
        if(dfs(0,0,0))
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    bool flag = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if ((a % 2 == 0) && !(a % 3 == 0 || a % 5 == 0))
            flag = false;
    }
    
    if (flag)
        cout << "APPROVED";
    else
        cout << "DENIED";
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int num = sc.nextInt();
		
        int[] array = new int[num];
        for(int i = 0; i < num;i++){
          array[i] = sc.nextInt();
        }
 
        int max = 0;
        for(int i = 0; i < array.length; i++){
          int count = 0;
          for(int j = i; j < array.length - 1; j++){
            if(array[j] >= array[j+1]){
              count++;
            } else{
              break;
            }
          }
          max = max < count ? count : max;
          
          if(max == array.length - i - 1){
            break;
          }
        }
      
		// 出力
		System.out.println(max);
	}
}

Measured memory_bytes: 48856
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize=read();
    let a: Vec<usize>=(0..n).map(|_| {read()}).collect();
    let mut v=vec![0i64;n+1];
    for &a in &a{
        v[a]+=1;
    }
    let s=v.iter().map(|v|v*(v-1)/2).sum::<i64>();

    for a in a{
        let v=v[a];
        println!("{}",s-v*(v-1)/2+(v-1)*(v-2)/2);
    }
}

Measured memory_bytes: 5168
//最長共通部分列
//要は何枚のコインで支払えますか問題。

// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000019
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int dp[2000][2000];
vector<int> w(2000);
vector<int> v(2000);

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    //double mini=INF;
    int maxi=0,f=0,sum=0;
    int i;
    double h;
    int n,x,m;
    int a,b,d,c;
    //int e,weight;
    int target;
    //targetが目的値、nが個数
    cin>>n;

    rep(_,n){
        string str1,str2;
        cin>>str1>>str2;

        //DPテーブルを0で初期化
        for(ll i=0;i<str1.length()+1;i++){
            for(ll j=0;j<str2.length()+2;j++){
                dp[i][j]=0;
            }
        }
        rep(i,str1.length()){
            rep(j,str2.length()){
                if(str1[i]==str2[j]){
                    dp[i+1][j+1]=dp[i][j]+1;
                }else{
                    dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
                }
            }
        }
        cout<<dp[str1.length()][str2.length()]<<endl;;
    }


    //dpテーブルのこたえにあたる部分を出力
    //今回は配るDPなのでn番目を出力しているところに注意!
    //cout<<dp[n][target]<<endl;


    return 0;
}



Measured memory_bytes: 11044
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int d,t,s; cin>>d>>t>>s;
    if(d<=t*s){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3632
/*input
3
1 2 3
1 2 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

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

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    int a = 1, b = 1;
    vector<int> p(n);
    vector<int> q(n);
    vector<int> v1(n);
    vector<int> v2(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    for(int i = 0; i < n; i++) cin >> q[i];
    for(int i = 0; i < n; i++)
    {
    	v1[i] = i + 1;
    	v2[i] = i + 1;
    }
    do
    {
    	if(v1 != p) a++;
    	else break;
    }
    while(next_permutation(v1.begin(), v1.end()));
    do
	{
		if(v2 != q) b++;
		else break;
	}
	while(next_permutation(v2.begin(), v2.end()));
	cout << abs(a - b);

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double r;cin >>r;
    double s = r*pi*r;
    double l = 2*r*pi;
    cout << fixed << setprecision(20) << s << " " << l << "\n";
}



Measured memory_bytes: 3284
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))

int main(void) {
	double r;
	scanf("%lf", &r);
	double pi = acos(-1.0);
	printf("%.2lf\n", pi * 2 * r);
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define oo 0x3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[]{ -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[]{ 0, 1, 1, 1, 0, -1, -1, -1 };
void run() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
}

int main() {
	run();
	int x, y;
	cin >> x >> y;
	vector<int> v = { 300000 ,200000 ,100000 ,0 };
	ll sum = v[min(x - 1, 3)] + v[min(y - 1, 3)];
	if (x == y && x == 1)sum += 400000;
	cout << sum;
}

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

previous = S[0]
counter = 1

new_S = []

#1の人が並んでいる個数 +整数、0の人が並んでいるとき -整数とする
#→同じ人が3人並んでいたら+3などと表記する

for i in range(1,N):
    if S[i] == previous:
        counter += 1

        if i == N-1:
            if previous == '0':
                counter *= -1
            new_S.append(counter)

    else:
        if previous == '0':
            counter *= -1

        new_S.append(counter)

        previous = S[i]
        counter = 1

        if i == N-1:
            if previous == '0':
                counter *= -1
            new_S.append(counter)

if S[0] == '1' and len(S) == 1:
    new_S = [1]
elif S[0] == '0' and len(S) == 1:
    new_S = [0]

#以下、尺取り法
length = len(new_S)
l = 0

score = 0
ans = 0
minus = 0

# #l,rの区間の間で-がK個となる区間を探せば良い
for r in range(length):

    if new_S[r] < 0:
        minus += 1

    score += abs(new_S[r])

    if minus > K:
        #次のマイナスが出てくるまで減らし続ける
        for i in range(l,r+1):
            l += 1
            score -= abs(new_S[i])
        
            if new_S[i] < 0:
                minus -= 1
                break

    ans = max(score,ans)

print(ans)

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

int main()
{
	int n;
	string s;
	cin >> n;
	cin >> s;
	for(int i=0; i<s.size(); i++){
		if(s[i]+n>90) s[i] = 'A'+((s[i]+n)-90)-1;
		else s[i]=s[i]+n;
	}
	cout<<s<<endl;
	return 0;
}	


Measured memory_bytes: 256
N = int(input())
X = list(input())
X = [int(x) for x in X]
popcnt = 0
for i in range(N):
    if X[i]:
        popcnt += 1

Ys = [0,0]
for i in range(N):
    if X[i]:
        Ys[0] += pow(2,N-1-i,popcnt+1)
        Ys[0] %= popcnt+1

if popcnt > 1:
    for i in range(N):
        if X[i]:
            Ys[1] += pow(2,N-1-i,popcnt-1)
            Ys[1] %= popcnt-1


for i in range(N):
    if X[i]:#1->0
        mod = popcnt-1
        if mod == 0:
            print(0)
            continue
        Y = Ys[1] - pow(2,N-1-i,mod)
    else:#0->1
        mod = popcnt+1
        Y = Ys[0] + pow(2,N-1-i,mod)
	
    Y %= mod
    ans = 1

    if Y == 0:
        print(ans)
        continue
        
    while Y > 0:
        L = Y.bit_length()
        mod = 0
        for j in range(L):
            if Y>>j&1:
                mod += 1
        Y %= mod
        ans += 1
    print(ans)

Measured memory_bytes: 95416
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

void print(vector<int> v) {
    for (auto x : v) cout << x << " ";
    cout << endl;
}

int main()
{
    int n;
    long long k;
    cin >> n >> k;
    vector<int> a(n + 1);
    for (int i = 0; i < n; i++) {
        cin >> a[i + 1];
    }

    vector<int> cur(1, 1);
    vector<int> visited(n + 1, -1);
    visited[1] = 0;
    long long pos = -1;

    for (int i = 0; i < n + 1; i++) {
        int x = a[cur[i]];

        if (visited[x] >= 0) {
            pos = visited[x];
            break;
        }
        visited[x] = i + 1;
        cur.push_back(x);
    }

    if (k <= pos) {
        cout << cur[k] << endl;
    } else {
        int loop = cur.size() - pos;
        cout << cur[(k - pos) % loop + pos] << endl;
    }
    return 0;
}

Measured memory_bytes: 5868
n,x,y=map(int, input().split())
ans=[0]*n
for i in range(1,n+1):
    for j in range(1,n+1):
        if i>=j:
            continue
        ans[min(j-i, abs(x-i)+abs(y-j)+1)]+=1
for k in range(1,n):
    print(ans[k])

Measured memory_bytes: 3444
h, n = map(int, (input().split()))
lst = [list(map(int, input().split())) for i in range(n)]

dp = [float('inf')] * ((10 ** 5) + 1)
dp[0] = 0

for i in range(n):
    for j in range(1, h+1):
        if j - lst[i][0] < 0:
            dp[j] = min(dp[0] + lst[i][1], dp[j])
        else:
            dp[j] = min(dp[j - lst[i][0]] + lst[i][1], dp[j])

print(dp[h])


Measured memory_bytes: 51276
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef unsigned long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n;
	string s; cin >> n >> s;
	
	vector<ll> base(1, 1);
	rep(i, n) base.pb(base[i] * 29);
	
	int lo = 0, hi = n / 2 + 1;
	while(lo + 1 < hi){
		int k = (lo + hi) / 2;
		bool ok = 0;
		ll h = 0;
		map<ll, int> pos;
		rep(i, n){
			h = h * 29 + s[i] - 'a' + 1;
			if(i >= k){
				h -= base[k] * (s[i - k] - 'a' + 1);
				if(pos.count(h) && pos[h] <= i - k){
					ok = 1;
					break;
				}
			}
			if(i >= k - 1 && !pos.count(h)) pos[h] = i;
		}
		if(ok) lo = k;
		else hi = k;
	}
	cout << lo << endl;
	return 0;
}

Measured memory_bytes: 640
from collections import deque
n, m = map(int, input().split())
lis = [[] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int, input().split())
    lis[a].append(b)
    lis[b].append(a)
queue = deque([1])
dist_list = [-1]*(n+1)
dist_list[1] = 0
while len(queue) != 0:
    now = queue.popleft()
    for v in lis[now]:
        if dist_list[v] == -1:
            dist_list[v] = dist_list[now] + 1
            queue.append(v)
print("Yes")
for i in range(2, n+1):
    for v in lis[i]:
        if dist_list[v] == dist_list[i]-1:
            print(v)
            break

Measured memory_bytes: 33984
import sys
readline = sys.stdin.readline
a, b, m = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))
xyc = [list(map(int, readline().split())) for _ in range(m)]

ans = min(a) + min(b)
for x, y, c in xyc:
    price = a[x-1] + b[y-1] - c
    if price < ans:
        ans = price
print(ans)


Measured memory_bytes: 38436
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        int i = 1;
        int oldRank = -1;
        Scanner sc = new Scanner(System.in);
        List<Team> team = new ArrayList<Team>();
        while (true) {
            String[] in = sc.nextLine().split(",");
            int num = Integer.parseInt(in[0]);
            int ac = Integer.parseInt(in[1]);
            if (num == 0 && ac == 0) {
                break;
            }
            team.add(new Team(num, ac));
        }
        Collections.sort(team, new Team());
        for (Team t : team) {
            if (oldRank == -1) {
                oldRank = t.getAccept();
            }
            if (oldRank != t.getAccept()) {
                i++;
            }
            t.setRank(i);
            oldRank = t.getAccept();
        }
        while (sc.hasNext()) {
            int teamNumber = sc.nextInt();
            for (Team t : team) {
                if (teamNumber == t.getTeamNum()) {
                    System.out.println(t.getRank());
                }
            }
        }
    }
}
class Team implements Comparator<Team> {
    private int teamNumber;
    private int teamAccept;
    private int teamRank;
 
    public Team(int num, int ac) {
        this.teamNumber = num;
        this.teamAccept = ac;
    }
 
    public Team() {
    }
    
    public String getTeamString() {
        return "(" + teamNumber + "," + teamAccept + ")" + teamRank;
    }
 
    public void setRank(int rank) {
        this.teamRank = rank;
    }
 
    public int getRank() {
        return this.teamRank;
    }
 
    public int getAccept() {
        return this.teamAccept;
    }
 
    public int getTeamNum() {
        return this.teamNumber;
    }
 
    public int compare(Team o1, Team o2) {
        int team1 = o1.teamAccept;
        int team2 = o2.teamAccept;
        if (team1 > team2) {
            return -1;
        } else if (team1 == team2) {
            return 0;
        } else {
            return 1;
        }
    }
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
typedef long long ll;
const int maxn = 200050;

int n, m, dis[maxn];
vector<int> nex[maxn];

int main()
{
	scanf("%d%d",&n,&m);
	memset(dis,0x3f,sizeof(dis));
	dis[1] = 0;
	fo(i,1,m)
	{
		int u, v; scanf("%d%d",&u,&v);
		nex[u].push_back(v);
		nex[v].push_back(u);
	}
	queue<int> q; int h;
	q.push(1);
	while(!q.empty())
	{
		h=q.front();q.pop();
		for(auto p:nex[h])if(dis[p]>dis[h]+1){dis[p]=dis[h]+1;q.push(p);}
	}
	if(dis[n]<=2)puts("POSSIBLE");else puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 13168
#include<iostream>
#include<string>
using namespace std;
int main() {
	int g = 0;
	string s, r;
		cin >> s;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '0' || s[i] == '1') {
				r += (s[i]);
				g++;
			}
			else if (s[i] == 'B') {
				if (!r.empty()) {
					r.erase(g - 1, 1);
					g--;
				}
			}

				
		}
		if (!r.empty())
		cout << r << endl;

	return 0;
}

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

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

 int left;
 left = a + b;

 int right;
 right = c + d;

if (left > right){
  std::cout << "Left" << '\n';
}

else if (left == right) {
  std::cout << "Balanced" << '\n';
}

else if (left <right){
  std::cout << "Right" << '\n';
}
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int x, i = 1;;
	int a[10001] = { 0 };

	while (1)
	{
		cin >> x;
		if (!x)
		{
			break;
		}
		a[i++] = x;
	}
	for (int k = 1; k != i; ++k)
	{
		cout <<"Case "<<k<<": "<< a[k] << endl;
	}

	return 0;
}


Measured memory_bytes: 3048
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n, x, y,  t;
  string r = "Yes";
  cin >> n;
  rep(i, n) {
    cin >> t >> x >> y;
    if ((x + y) > t || (t % 2) != (x + y) % 2) {
      r = "No";
      break;
    }
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
X, Y = input().split()

if (Y == "F"):
    if (X == "F"):
        print("=")
    else:
        print("<")

elif(Y == "E"):
    if (X == "F"):
        print(">")
    elif (X == "E"):
        print("=")
    else:
        print("<")

elif(Y == "D"):
    if (X == "F"):
        print(">")
    elif (X == "E"):
        print(">")
    elif (X == "D"):
        print("=")
    else:
        print("<")

elif (Y == "C"):
    if (X == "F"):
        print(">")
    elif (X == "E"):
        print(">")
    elif (X == "D"):
        print(">")
    elif (X == "C"):
        print("=")
    else:
        print("<")

elif (Y == "B"):
    if (X == "F"):
        print(">")
    elif (X == "E"):
        print(">")
    elif (X == "D"):
        print(">")
    elif (X == "C"):
        print(">")
    elif (X == "B"):
        print("=")
    else:
        print("<")
    
elif (Y == "A"):
    if (X == "A"):
        print("=")
    else:
        print(">")


Measured memory_bytes: 9012
/*input
happy,newyear,enjoy
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d);
	return 0;
}


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

using namespace std;

int main() {
    string s, t;    cin >> s >> t;

    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != t[i])
            ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3924
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	if N % 2:
		print(0)
	else:
		fives = 0
		for i in range(1, 27):
			if N//2 >= 5**i:
				fives += (N//2)//(5**i)
		print(fives)

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
n,k=[int(i) for i in input().split()]
ans=0
hoge=1
while hoge<k:
    hoge*=2
for i in range(1,n+1):
    while i*hoge//2>=k:
        if hoge==1.0:
            break
        hoge/=2
    ans+=(1/n)*(1/hoge)
    #print(hoge)
print(ans)

Measured memory_bytes: 2940
#include "bits/stdc++.h"

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int

#define pb push_back
#define m <i> map<int>
#define v <i> vector<int>

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

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


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a[i][j];
    }
  }
  
  vector<int> h(H, 0), w(W, 0);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a[i][j] == '#') {
        h[i]++; w[j]++;
      }
    }
  }

  for (int i = 0; i < H; i++) {
    if (h[i] == 0) continue;
    for (int j = 0; j < W; j++) {
      if (w[j] == 0) continue;
      cout << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

using vec = vector<int>;
using mat = vector<vec>;

mat mul(mat& A, mat& B) {
  mat C(A.size(), vec(B[0].size()));
  for (int i = 0; i < A.size(); i++) {
    for (int k = 0; k < B.size(); k++) {
      for (int j = 0; j < B[0].size(); j++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }
  return C;
}

mat pow(mat A, int n) {
  mat B(A.size(), vec(A.size()));
  for (int i = 0; i < A.size(); i++) {
    B[i][i] = 1;
  }
  while (n > 0) {
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

int N, K;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> K;
  mat A(N, vec(N));
  REP(i, N) REP(j, N) cin >> A[i][j];
  A = pow(A, K);
  int ans = 0;
  REP(i, N) REP(j, N) {
    (ans += A[i][j]) %= MOD;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        HashSet<String> set = new HashSet<>();

        String ans = "None";
      String alp = "abcdefghijklmnopqrstuvwxyz";

        for(int i = 0; i < alp.length(); i++) {
            String tmp =  String.valueOf(alp.charAt(i));

                if(s.contains(tmp)) {
                    continue;
                }
                ans=tmp;
               
                break;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 25544
#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
#define setbits(x)          __builtin_popcountll(x)
#define ff first
#define ss second
using namespace std;

int nCrevenoroddfinder(int n,int r)
{
    int a=r;
    int b=n-r;
    for(int i=0;i<30;i++)
    {
        int x=1<<i;
        if((x&a)&&(x&b))
        {
            return 0;//even
        }
    }
    return 1;//odd
}

ll gcd(ll a, ll b) {
  if (a == 0)return b;
  return gcd(b % a, a);
}
bool isperfect(ll n) {
  ll y = sqrt(n);
  if (n % y == 0 && y * y == n)return true;
  return false;
}
bool comp(pair<int,int> a, pair<int,int> b) {
    if(a.first == b.first) return a.second>b.second;
  return a.first < b.first;
}
 ll powi(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)ans = (ans * a);
    b = b >> 1;
    a = (a * a);
  }
  return ans;
}
bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)return false;
  }
  return true;
}
bool prime[10000000];
void seive() {

  prime[1] = true;
  for (int i = 2; i * i < 10000000; i++) {

    if (prime[i])continue;
    for (int j = i * i; j < 10000000; j += i) {
      prime[j] = true;
    }

  }
}

int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  string s,t;cin>>s>>t;
  ll ans=INT_MAX;
  ll n=s.size(),m=t.size();
  for(int i=0;i<n;i++)
  {
        ll k=i+m-1;
        if(k>=n) continue;
        string h=s.substr(i,m);
        ll cnt=0;
        for(int j=0;j<h.size();j++){
              cnt+=(h[j]!=t[j]);
        }
        ans=min(cnt,ans);
  }
  cout<<ans;
}



  

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll gcd(ll a,ll b)
{
  if (b == 0) 
        return a; 
    return gcd(b, a % b);  
}

int  main()
{
 
   IOS;
    char s;
    cin>>s;
    cout<<char(s+1);
      

   }


Measured memory_bytes: 256
#include<stdio.h>
void InsertionSort(int a[],int n){
    int loop,loop2,swap;
    for(loop=1;loop<n;loop++){
        for(loop2=0;loop2<n;loop2++){
            printf("%d",a[loop2]);
            if(loop2!=n-1){
                putchar(' ');
            }else{
                putchar('\n');
            }
        }
        swap=a[loop];
        loop2=loop-1;
        while(loop2>=0 && a[loop2]>swap){
            a[loop2+1]=a[loop2];
            loop2--;
        }
        a[loop2+1]=swap;
    }
}
int main(void){
    int n,a[101],loop;
    scanf("%d",&n);
    for(loop=0;loop<n;loop++){
        scanf("%d",&a[loop]);
    }
    InsertionSort(a,n);
    for(loop=0;loop<n;loop++){
        printf("%d",a[loop]);
        if(loop!=n-1){
            putchar(' ');
        }else{
            putchar('\n');
        }
    }
    return 0;
}


Measured memory_bytes: 2096