akhauriyash/Code-Regression huggingface dataset:
x = int(input())
if x > 11:
    if x % 11 == 0:
        print((x//11) * 2)
    elif x % 11 < 7:
        print((x//11) * 2 + 1)
    else:
        print((x//11) * 2 + 2)

elif x < 7:
    print(1)
    
else:
    print(2)

Measured memory_bytes: 8948
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1 << 18;
int n;
VI g[N];
char used[N];
int d[N];

void bfs(int v)
{
	FILL(used, 0);
	used[v] = 1;
	d[v] = 0;
	queue<int> q;
	q.push(v);
	
	while(!q.empty())
	{
		v = q.front();
		q.pop();
		for(auto i: g[v])
			if (!used[i])
			{
				used[i] = 1;
				d[i] = d[v] + 1;
				q.push(i);
			}
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	cin >> n;
	FOR(i, 0, n - 1)
	{
		int u, v;
		cin >> u >> v;
		g[u].PB(v);
		g[v].PB(u);
	}
	
	bfs(1);
	int mx = 1;
	FOR(i, 2, n + 1)
		if (d[i] > d[mx])
			mx = i;
	
	bfs(mx);
	mx = 1;
	FOR(i, 2, n + 1)
		if (d[i] > d[mx])
			mx = i;
	
	mx = d[mx];
//	debug(mx)
	if (mx % 3 == 1)
		cout << "Second" << endl;
	else
		cout << "First" << endl;
		
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 15348
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  int N, A, B;
  cin >> N >> A >> B;
  string s;
  cin >> s;
  int a = 0, b = 0;
  FOR(i,0,N) {
    if(s[i]=='a') {
      if(a+b < A+B) {
        puts("Yes");
        a++;
      } else {
        puts("No");
      }
    } else if(s[i]=='b') {
      if(a+b<A+B && b + 1 <= B) {
        puts("Yes");
        b++;
      } else {
        puts("No");
      }
    } else {
      puts("No");
    }
  }
  return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();

        for (int i = 0; i <= B; ++i){
 
            if ((A*i) % B == C){  //条件に合致したら終了
                System.out.println("YES");
                System.exit(0);
            }
        }
      
        System.out.println("NO");
        
    }       
}


Measured memory_bytes: 36024
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N, A, B, C;
    vi abc(3);
    cin >> N;
    int sum = 0;
    rep(i, 3) {
        cin >> abc[i];
        sum += abc[i];
    }
    V(P) S(N);
    rep(i, N) {
        string s;
        cin >> s;
        S[i] = P(s[0]-'A', s[1]-'A');
    }

    vi res;

    //A+B+Cの合計で場合分け
    //合計が0なら明らかに不可
    if(sum==0) {
        cout << "No" << endl;
        return 0;
    //合計が1なら、解は1通りしか存在しない
    } else if(sum==1) {
        rep(i, N) {
            if(abc[S[i].fi]==0 && abc[S[i].se]==0) {
                cout << "No" << endl;
                return 0;
            } else {
                if(abc[S[i].fi]) {
                    res.pb(S[i].se);
                    abc[S[i].fi]--;
                    abc[S[i].se]++;
                } else {
                    res.pb(S[i].fi);
                    abc[S[i].fi]++;
                    abc[S[i].se]--;
                }
            }
        }

    //合計が2以上なら、現在の状態とクエリでさらに場合分け
    } else {
        rep(i, N) {
            //クエリの文字の数が両方とも0なら、その時点で不可
            if(abc[S[i].fi]==0 && abc[S[i].se]==0) {
                cout << "No" << endl;
                return 0;
            }
            //クエリの文字の数のうちどちらか一方が0なら、そちらに足す
            else if(abc[S[i].fi]==0 || abc[S[i].se]==0) {
               if(abc[S[i].fi]) {
                    res.pb(S[i].se);
                    abc[S[i].fi]--;
                    abc[S[i].se]++;
                } else {
                    res.pb(S[i].fi);
                    abc[S[i].fi]++;
                    abc[S[i].se]--;
                }
            //クエリの文字の数が両方とも正なら、次のクエリを見て判定する
            //次のクエリに含まれている文字のほうに足せば最適
            //次のクエリと現在のクエリが同じなら、好きなほうに足せばよい
            } else {
               if(i<N-1) {
                   P np = S[i+1];
                   if(S[i].fi==np.fi || S[i].fi==np.se) {
                       res.pb(S[i].fi);
                       abc[S[i].fi]++;
                       abc[S[i].se]--;
                   } else {
                       res.pb(S[i].se);
                       abc[S[i].fi]--;
                       abc[S[i].se]++;
                   }
               } else {
                   res.pb(S[i].fi);
               }
           }
        }
    }

    cout << "Yes" << endl;
    rep(i, N) cout << char(res[i]+'A') << endl;
    

    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
  double x,h,s;
  
  cin >> x >> h;
  while(x!=0&&h!=0){
    s=x*x+sqrt(h*h+x*x/4)*x*2;
    printf("%.6f\n",s);
    cin >> x >> h;
  }
  return 0;
}



Measured memory_bytes: 3156
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
using namespace std;
typedef long long ll;

const int INF = 1001001001;

int main() {
    int n; cin >> n;
    vector<int> a(n+10, 0);
    for (int i = 0; i < n; i++) cin >> a[i+1];
    vector<int> b(n+10, 0);
    for (int i = n; i >= 1; i--) {
        int cnt = 0;
        for (int j = i+i; j <= n; j +=i) {
            cnt ^= b[j];
        }
        b[i] = a[i]^cnt;
    }
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
        if (b[i]) ans.push_back(i);
    }
    cout << ans.size() << endl;
    for (int i = 0; i < (int)ans.size(); i++) {
        printf("%d%c", ans[i], i+1==ans.size()?'\n':' ');
    }
    return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

vector<int> get_prime(int n) {
    if(n <= 1) return vector<int>{};
    vector<bool> is_composite(n+1);
    vector<int> prime;
    for (int i = 2; i <= n; ++i) {
        if(!is_composite[i]) prime.push_back(i);
        for (auto &&j : prime) {
            if((ll)i*j > n) continue;
            is_composite[i*j] = true;
            if(i % j == 0) break;
        }
    }
    return prime;
}
const auto primes = get_prime(65535);

template<class T>
vector<T> prime_factor(T n){
    vector<T> res;
    for (auto &&i : primes) {
        while (n % i == 0){
            res.emplace_back(i);
            n /= i;
        }
    }
    if(n != 1) res.emplace_back(n);
    return res;
}

int main() {
    int p, q;
    cin >> p >> q;
    int g = __gcd(p, q);
    p /= g, q /= g;
    auto v = prime_factor(q);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    int ans = 1;
    for (auto &&i : v) {
        ans *= i;
    }
    cout << ans << "\n";
    return 0;

}


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

const int N=2e5+10;


int n,m,a[N],h[N],b[N];

int main()
{
	scanf("%d%d",&n,&m);
	int Ans=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		a[i]=x;
		int y=x-h[x];
		y=max(1,y);
		if(b[y]) Ans++;
		b[y]++;
		h[x]++;
	}
	while(m--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		h[a[x]]--;
		int z=a[x]-h[a[x]];
		z=max(z,1);
		b[z]--;
		if(b[z]==0) Ans++;
		z=y-h[y];
		z=max(z,1);
		if(b[z]==0) Ans--;
		b[z]++;
		h[y]++;
		a[x]=y;
		printf("%d\n",Ans);
	}
	return 0;
}
	
		
	
 

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A;
  int B;
  int C;
  int D;
  cin>>A>>B>>C>>D;
  if (A+B > C+D) {
    cout<<"Left"<<endl;
  }
  if (A+B == C+D) {
    cout<<"Balanced"<<endl;
  }
  if (A+B <C+D) {
    cout<<"Right"<<endl;
  }
}

Measured memory_bytes: 256
class DisjointSparseTable():
    def __init__(self,data,f):
        from math import ceil,log#2
        self.n=n=len(data)
        m=ceil(log(n,2)) # ceil(log2(n))
        self.f=f
        self.h=[0,0]
        for i in range(2,2**m):self.h.append(self.h[i//2]+1)
        self.data=[data]
        for i in range(1,m):
            d=[0]*n
            w=2**i
            for j in range(0,n,w*2):
                c=min(j+w,n)
                d[c-1]=data[c-1]
                for k in range(c-2,j-1,-1):d[k]=f(data[k],d[k+1])
                if c<n:
                    d[c]=data[c]
                    for k in range(c+1,min(j+w*2,n)):d[k]=f(data[k],d[k-1])
            self.data.append(d)
    def get(self,l,r): # [l,r)
        r-=1
        if l==r:return self.data[0][l]
        d=self.data[self.h[l^r]]
        return self.f(d[l],d[r])
def main():
    from fractions import gcd
    n,*a=map(int,open(0).read().split())
    f=DisjointSparseTable(a,gcd).get
    m=max(f(1,n),f(0,n-1))
    for i in range(n-2):
        m=max(m,gcd(f(0,i+1),f(i+2,n)))
    print(m)
main()

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

using namespace std;

int main(){
    int n;
    int k;
    cin >> n >> k;
    long long result = 0;
    vector<long long> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    sort(h.begin(), h.end(), greater<int>());
    for(int i = k; i < n; i++){
        if(n <= k){
            cout << 0 << endl;
            return 0;
        }
        else{
            result += h[i];
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int n,M[110][110];

int minimum(){
  int color[110],d[110],p[110];
  int i=0,s=0;
  int mincost,v,u;
  while(i<=n){color[i]=0;d[i]=5000;p[i]=-1;i++;}
  d[0]=0;
  while(1){
    mincost = 5000;
    for(i=0;i<n;i++){
      if(color[i] != 2 && d[i]<mincost){
	mincost = d[i];
	u=i;
      }
    }
    if(mincost == 5000){
      break;
    }
    color[u] = 2;
    for(v=0;v<n;v++){
      if(color[v] != 2 && M[u][v]<d[v] && M[u][v]!=-1){
	d[v] = M[u][v];
	p[v] = u;
	color[v] = 1;
      }
    }
  }
  for(i=0;i<n;i++){
    if(d[i]!=5000) s+=d[i];
  }
  return s;
}
int main(void){
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&M[i][j]);
    }
  }
  printf("%d\n",minimum());
  return 0;
}



Measured memory_bytes: 2788
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
import Data.Maybe
import Data.Bits
import Data.Ord
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Debug.Trace

listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt

divisors n = [i | i<-[1..n], n `mod` i == 0]

main :: IO ()
main = do
  n <- readLn :: IO Int

  print $ length [i | i<-[1..n], odd i, length (divisors i) == 8]


Measured memory_bytes: 508
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb emplace_back
#define pi pair<int,int>
using namespace std;
const int maxn = 3e2 + 4;

int n, a;
int cnt[4];
ld dp[maxn][maxn][maxn];

int main(){
	cin>>n;
	for (int i = 0; i < n; ++i){
		cin>>a;
		cnt[a]++;
	}
	for (int k = 0; k <= n; ++k){
		for (int j = 0; j <= n; ++j){
			for (int i = 0; i <= n; ++i){
				if (i==0 && j==0 && k==0)
					continue;
				if (i)
					dp[i][j][k] += i*dp[i-1][j][k];
				if (j)
					dp[i][j][k] += j*dp[i+1][j-1][k];
				if (k)
					dp[i][j][k] += k*dp[i][j+1][k-1];
				dp[i][j][k] += n;
				dp[i][j][k] /= (i+j+k);
			}
		}
	}
	cout<<fixed<<setprecision(10);
	cout<<dp[cnt[1]][cnt[2]][cnt[3]]<<'\n';
}

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

using namespace std;

struct A {
    int c;
    int s;
    int f;  
};

int main()
{
    int n;
    cin >> n;
    vector<A> vs(n);
    for (int i = 0; i < n - 1; i++) {
        cin >> vs[i].c;
        cin >> vs[i].s;
        cin >> vs[i].f;
    }
    
    for (int i = 0; i < n - 1; i++) {
        int st = vs[i].s;
        for (int j = i; j < n - 1; j++) {
            while (st % vs[j].f != 0) st++;
            st = max(st, vs[j].s);
            st += vs[j].c;
        }
        cout << st << endl;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

llong N, A, B, C, D;
int main(int argc, char **argv) {
    cin >> N >> A >> B >> C >> D;

    bool res = false;
    for(llong i = 0; i < N; ++i) {
        if(-i * D + (N - 1 - i) * C <= B - A &&
            B - A <= -i * C + (N - 1 - i) * D) {
                res = true;
                break;
            }
    }
    
    cout << (res ? "YES" : "NO") << endl;
}

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

#define int             long long int
#define ld              long double
#define ff              first
#define ss              second
#define mp              make_pair
#define pb              push_back
#define endl            "\n"

#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpii            vector <pii>
#define mii             map <int, int>
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))


#define M               1000000007
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
	int x = 1;
	while (b)
	{
		if (b & 1) x *= a;
		a *= a;
		b >>= 1;
	}
	return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 3e5 + 7;
vector <vi > adj;
bool vis[N];
double dp[3003][3003];
int n;
double p[3003];

double help(int idx, int cnt)
{
	//bug(cnt);
	if (idx < 0) return 0;
	if (cnt < 0) return 0;
	if (idx + 1 < cnt) return 0;

	if (idx == 0)
	{
		if (cnt == 0) return 1 - p[idx];
		else if (cnt == 1) return p[idx];
		else return 0;
	}
	if (dp[idx][cnt] != -1.0) return dp[idx][cnt];

	return dp[idx][cnt] = help(idx - 1, cnt) * (1 - p[idx]) + help(idx - 1, cnt - 1) * p[idx];
	//bug(idx, cnt, dp[idx][cnt]);
	//return dp[idx][cnt];
}

void solve()
{

	cin >> n;
	loop(i, 0, n) cin >> p[i];
	loop(i, 0, 3003)
	{
		loop(j, 0, 3003) dp[i][j] = -1.0;
	}
	double ans = 0;
	for (int i = n / 2 + 1; i <= n; i++)
	{
		ans += help(n - 1, i);
		//bug(dp[n - 1][i]);
		//bug(ans, i);
	}
	cout << fixed << setprecision(10) << ans << endl;
	return;

}

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


	cout << setprecision(9) << fixed;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}


	return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = rbegin(s); i != rend(s); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }
template<class a, int N, class T>
void fillArray(a(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }


ll h, w;
void solve() {
    cin >> h >> w;
    if (h == 1 || w == 1) cout << 1 << endn;
    else cout << (h * w + 2 - 1) / 2 << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		long K = fs.nextLong();

		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = fs.nextInt();
		}

		Integer[] F = new Integer[N];
		for (int i = 0; i < N; i++) {
			F[i] = fs.nextInt();
		}

		Arrays.sort(A);
		Arrays.sort(F, Collections.reverseOrder());

		long left = 0;
		long right = 0;
		for(int i = 0;i < N;i++) {
			right = Math.max(right, (long)A[i] * F[i]);
		}

		while(left != right) {
			long j = (left + right) / 2;
			long result = 0;
			for(int i = 0;i < N;i++) {
				result += Math.max(0, A[i] - j / F[i]);
				if(result > K) break;
			}
			if(result <= K) {
				right = j;
			}else {
				left = j + 1;
			}
		}

		System.out.println(left);

	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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


Measured memory_bytes: 36568
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
ll ncd(ll n,ll d){
    ll x = 1,y=1;
    for(int i=0;i<d;i++){
        x = x*(n-i)%mod;
        y = y*(i+1)%mod;
    }
    return x*modpow(y,mod-2,mod)%mod;
}
int main() {    
    srand(time(NULL));
    ll d;
    cin >> d;
    for(int i=0;i<d;i++){
          cout<<rand()%26+1<<endl;  
    }
}
    



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define rint register int
inline int read(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}
string S; set<string> Q;
int main()
{
	cin >> S; for(rint r = 0, l; r < S.length(); r++) for(l = max(0,r-5); l <= r; Q.insert(S.substr(l,r-l+1)), l++);
	for(rint i = 1, K = read(); i < K; Q.erase(Q.begin()), i++);  cout << *Q.begin() << endl; return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int n, m, k; scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      if ((m-j)*(n-i)+i*j == k) {
	puts("Yes");
	return;
      }
    }
  }
  puts("No");
  
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    int flag=0;
    cin>>s>>t;
    for(int i=0;i<s.length();i++)
    {
        if(s==t)
        {   flag=1;
            break;
        }
        s=s.back() +s.substr(0,s.size()-1);    }
    if(flag==1)
    {
        cout<<"Yes"<<"\n";
    }
    else{
    cout<<"No"<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int P = sc.nextInt();
		char[] c = sc.next().toCharArray();
		int[] v = new int[N];
		for(int i=0; i<N; i++)
			v[i] = c[i]-'0';

		long ans = 0;
		
		if(P==2 || P==5) {
			for(int i=0; i<N; i++) {
				if(v[i]%P==0) {
					ans += i+1;
				}
			}
		} else {
			int[] mod = new int[P];
			mod[0]++;
			long a = 1;
			long cur = 0;
			for(int i=N-1; i>=0; i--) {
				cur = (cur + v[i]*a)%P;
				ans += mod[(int)cur];
				mod[(int)cur]++;
				a = (a*10)%P;
			}
		}
		System.out.println(ans);
		sc.close();
//			return;
//		
//		int[] mod = new int[P];
//		long ans = 0;
//		long a = 1; // a = 10000000...
//		long b = 0;
//		
//		mod[v[0]%P]++;
//		a *= 10;
//		ans += mod[0];
//		mod[0]++;
//
//		for(int i=1; i<N; i++) {
//			b = (b*10+v[i])%P;
//			int index = (int)(((P-(b%P)) * rev(a, P))%P);
//			ans += mod[index];
//			mod[index]++;
//			a = (a * 10)%P;
//		}
//		
//		System.out.println(ans);
//		sc.close();
//	}
//	
//	static long rev(long a, long MOD) {
//		return pow(a, MOD-2, MOD);
//	}
//	
//	static long pow(long a, long b, long MOD) {
//		long ans = 1;
//		while(b>0) {
//			if((b&1)!=0) {
//				ans = (ans * a)%MOD;
//			}
//			b>>=1;
//			a = (a*a)%MOD;
//		}
//		return ans;
	}

}



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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

/*
int main(void){
	int32 N;
	cin >> N;
	vector<int64> v(N);
	REP(i, N) cin >> v[i];

	int64 maxi = 0;
	int64 res = 0;
	REP(i, N){
		int64 cnt = (v[i]-1)/(maxi+1);
		if(cnt){ res += cnt; chmax(maxi, 1); }
		else maxi = v[i];
	}
	cout << res << endl;
}
*/
int64 N, K;
int main(void){
	cin >> N >> K;
	vector<PLL> v(N);
	REP(i, N) cin >> v[i].fs >> v[i].sc;
	sort(all(v));
	int64 sum = 0;
	REP(i, N){
		sum += v[i].sc;
		if(sum >= K){
			cout << v[i].fs << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  int N;
  int A;
  cin >> N >> A;
  cout << N * N - A << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int i;
	int A[1000];
	int N;
	int a = 0;


	cin >> N;


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

		if (i % 2 != 0 && A[i] % 2 != 0) {
			a++;
		}


	}
	cout << a;













}



Measured memory_bytes: 3600
#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, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(s.begin(), s.end());
  rep(i, n) cout << s[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 3580
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let S: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let ans = (0..1000)
        .filter(|&i| {
            let s = format!("{:03}", i).chars().collect::<Vec<_>>();
            S.iter().fold(0, |cnt, &c| {
                if cnt <= 2 && s[cnt] == c {
                    cnt + 1
                } else {
                    cnt
                }
            }) == 3
        })
        .count();

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
	int a[6];
	int i=0;
	int s=0;
	for(i=0;i<6;i++){
		cin>>a[i];
	}
	s=a[0]+a[1]*5+a[2]*10+a[3]*50+a[4]*100+a[5]*500;
	if(s>=1000){
		cout<<"1"<<endl;
	}else{
		cout<<"0"<<endl;
	}
}

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

int main(){

	fastcin
	
	int n, k;
	cin >> n >> k;
	
	int f[n+1];
	
	memset(f, 0, sizeof f);
	
	while(k--){
		int d, x;
		cin >> d;
		for(int i=0; i<d; i++){
			cin >> x;
			f[x] = 1;
		}
	}
	
	int ans = 0;
	
	for(int i=1; i<=n; i++){
		if(f[i] == 0) ans++;
	}
	
	cout << ans << endl;
	      
	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int a,b;
  cin >> a >> b;
  for(int i=1;i<4;i++){
    if(a!=i && b!=i) cout<< i <<endl;
  }
}


Measured memory_bytes: 256
import sys

s=list(input())

def f(i,tmp,func):
  if i==4:
    if tmp == 7:
      print(func+"=7")
      sys.exit()
  else:
    f(i+1,tmp+int(s[i]),func+"+"+s[i])
    f(i+1,tmp-int(s[i]),func+"-"+s[i])
    
f(1,int(s[0]),s[0])

Measured memory_bytes: 3060
W, H, x ,y ,r = map(int, input().split())

word = "Yes"

if x < 0 or y < 0:
    word = "No"

if (x + r) > W:
    word = "No"

if (x - r ) < 0:
    word = "No"

if (y + r) > H:
    word = "No"

if (x - r ) < 0:
    word = "No"

print(word)


Measured memory_bytes: 5596
def main():
	N = int(input())
	A = list(map(int, input().split()))
	ans = ["0"]*N
	this_ans = 0
	offset = [1, -1]
	for i in range(N):
		this_ans += A[i]*offset[i%2]
	ans[0] = str(this_ans)
	for i in range(N-1):
		this_ans = A[i] - int(ans[i])//2
		ans[i+1] = str(this_ans*2)
	print(" ".join(ans))


if __name__ == '__main__':
	main()

Measured memory_bytes: 17216
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)
 
using ll  = long long;
using ull = unsigned long long;

int main(int argc, char *argv[])
{
    int A;
    std::cin >> A;

    char op;
    std::cin >> op;

    int B;
    std::cin >> B;

    if (op == '+') {
        std::cout << A + B << std::endl;
    } else {
        std::cout << A - B << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    int n;
    cin>>n;
    vector<int> v(n);
    for(int &x:v) cin>>x;
    for(int x:v)
    {
        if(x%2==0) 
        {
            if(x%3==0 || x%5==0) continue;
            cout<<"DENIED";
            return 0;
        }
    }
    cout<<"APPROVED";
    return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
    int x, n; cin >> x >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++)cin >> p[i];
    sort(p.begin(), p.end());
    int nin = 300;
    for(int i = -100; i <= 200; i++) {
        if(binary_search(p.begin(), p.end(), i))continue;
        if(abs(x - i) < abs(nin - x)) {
            nin = i;
        }
    }
    cout << nin << endl;

}

Measured memory_bytes: 3644
import java.util.*

val sc = Scanner(System.`in`)
val S: String = sc.next()

fun main(args: Array<String>) {
    println(judge(S))
}

fun judge(s: String): String {
    for (c in 'a'..'z') {
        if (!s.contains(c)) {
            return c.toString()
        }
    }
    return "None"
}


Measured memory_bytes: 34392
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, f, b, ans, t = true;
string s;
int main(){
	scanf("%d", &n);
	rep(i,n){
		cin >> s;
		bool a = false;
		for(char c: s){
			if(c == 'A') a = true;
			else if(c == 'B' && a){
				a = false;
				ans++;
			}else a = false;
		}
		if(a) b++;
		if(s[0] == 'B') f++;
		if(b != f) t = false;
	}
	if(b == 0 || f == 0) t = false;
	printf("%d\n", ans + min(f, b) - t);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
using namespace std;
int main()
{
    string a;
    cin>>a;
    int flag=1;

 for(int i=0;i<a.size();i++)
 {

     if(i%2==0)
     {
         if(a[i]!='R'&&a[i]!='U'&&a[i]!='D')
         {
             flag=0; break;
         }
     }
     else
     {
         if(a[i]!='L'&&a[i]!='U'&&a[i]!='D')
         {
             flag=0; break;
         }
     }
 }
 if(flag) printf("Yes\n");
 else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
n,y=map(int,input().split())
y=y//1000
f=0
ans=[-1,-1,-1]
for i in range(y//10+1):
    z=y-i*10
    for j in range(z//5+1):
        w=z-j*5
        if w+i+j==n:
            ans=[i,j,w]
            f=1
            break
    if f==1:
        break
print(" ".join(list(map(str,ans))))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int N,cnt=0;
  cin>>N;
  	for(int i=1;i<=N;i++){
      double j=log10(i);
      int k=j;
      if(k%2==0){
        cnt++;
      }
    }
  cout<<cnt<<endl;
}


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

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		int[] p = Input().ToInt();
		int h = p[0];
		int w = p[1];
		int[,] grid = new int[w+1, h+1];
		for(int i = 0; i < h;i++)
		{
			string c = Console.ReadLine();
			for(int j = 0; j < w; j++)
			{
				grid[j,i] = (c[j]=='.') ? 0 : 1 ;
			}
		}
		long[,] dp = new long[w+3, h+3];
		dp[0,0] = 1;
		for(int y = 0; y < h; y++)
		{
			for(int x = 0; x < w; x++)
			{
				if(x + 1 < w && grid[x + 1,y] == 0)
				{
					dp[x+1, y] += dp[x, y] % Giri;
				}
				if(y+1<h && grid[x,y+1] == 0)
				{
					dp[x,y+1] += dp[x, y] % Giri;
				}
			}
		}
		Console.WriteLine(dp[w-1, h-1] % Giri);
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1) return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 26716
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n];
    int tmp[n];
    int ans=0;
    rep(i,0,n-1) {cin>>a[i]; tmp[i]=a[i];}
    sort(a,a+n);
    rep(i,0,n-1){
        if(a[n-1]!=tmp[i]) printf("%d\n",a[n-1]);
        else printf("%d\n",a[n-2]);
    }
    return 0;
}

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

void solv() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}

int main() {
    solv();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
public class ABC143C {
    public static void Main() {
        int N, ans = 1;
        N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        char current = S[0];
        for (int i = 0; i < N; i++) {
            if (S[i] == current) continue;
            current = S[i];
            ans++;
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13280
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,m;
	cin >> n >> m;
	ll k;
	cin >> k;
	vector<ll> a(n);
	for(int i = 0;i < n;i++)cin >> a[i];
	
	vector<ll> b(m);
	for(int i = 0;i < m;i++)cin >> b[i];

	vector<ll> sum_a_time(n);
	sum_a_time[0] = a[0];
	for(int i = 0;i < n-1;i++)sum_a_time[i+1] = a[i+1] + sum_a_time[i];

	vector<ll> sum_b_time(m);
	sum_b_time[0] = b[0];
	for(int i = 0;i < m-1;i++)sum_b_time[i+1] = b[i+1] + sum_b_time[i];

	ll ans = 0;

	for(int i = 0;i < n;i++){
		if(sum_a_time[i] > k)break;
		ll num = upper_bound(sum_b_time.begin(),sum_b_time.end(),k-sum_a_time[i]) - sum_b_time.begin();
		ans = max(ans,(ll)i+1+num);
	}

	for(int i = 0;i < m;i++){
		if(sum_b_time[i] > k)break;
		ll num = upper_bound(sum_a_time.begin(),sum_a_time.end(),k-sum_b_time[i]) - sum_a_time.begin();
		ans = max(ans,(ll)i+1+num);
	}



	cout << ans << endl;
}


Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int h,w;
    cin >> h >> w;
    bool flag[h][w];
    char math[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> math[i][j];
            if(math[i][j] == '.') flag[i][j] = true;
            else flag[i][j] = false;
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w-1; j++){
            if(math[i][j] =='#' && math[i][j+1] == '#'){
                flag[i][j] = true;
                flag[i][j+1] = true;
            }
        }
    }
    for(int i = 0; i < w; i++){
        for(int j = 0; j < h-1; j++){
            if(math[j][i] =='#' && math[j+1][i] == '#'){
                flag[j][i] = true;
                flag[j+1][i] = true;
            }
        }
    }
    bool ans = true;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(!flag[i][j]) ans = false;
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

ll dig(ll n)
{
    ll r=0;
    
    while(n)
    {
    r++;
    n/=10;
    }
    
    return r;
}
int main() {
    
    string s;
    cin>>s;
    
    ll i=0,j=s.length()-1,ans=0;
    
    while(i<j)
    {
        if(s[i]!=s[j])
        ans++;
        i++;
        j--;
    }
    
    cout<<ans<<"\n";
}

Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        int n; cin >> n;
        vi a(n);
        rep(i,n) cin >> a[i];
        int cnt = 0;
        int ans =0;
        for(int i = n-2; i>=0; i--){
            if(a[i]>=a[i+1]){
                cnt++;
                ans  = max(ans, cnt);
            }
            else cnt=0;
        }
        cout<<ans<<endl;

return 0;
}




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

ll MOD = 1e9+7;



int main(){
    ll H, W; cin >> H >> W;
    vector<string> V(H); for(int i = 0; i < H; i++) cin >> V[i];
    vector<vector<ll>> DP(H, vector<ll>(W));
    DP[H-1][W-1] = 1;
    
    for(int i = H-2; i >= 0; i--) {
        if(V[i][W-1] == '.') DP[i][W-1] = DP[i+1][W-1];
        else DP[i][W-1] = 0;
    }
    for(int i = W-2; i >= 0; i--) {
        if(V[H-1][i] == '.') DP[H-1][i] = DP[H-1][i+1];
        else DP[H-1][i] = 0;
    }

    for(int i = H-2; i >= 0; i--){
        for(int j = W-2; j >= 0; j--){
            if(V[i][j] == '.') DP[i][j] = (DP[i+1][j]+DP[i][j+1])%MOD;
            else DP[i][j] = 0;
        }
    }
    cout << DP[0][0]%MOD << endl;
    





}


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

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

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	ll sum = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum <= n) {
		cout << (n - sum) << endl;
	} else {
		cout << "-1" << endl;
	}
	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>

using namespace std;

int main() {

	char x;
	char y;

	cin >> x >> y;

	if (x > y) {
		cout << '>' << endl;
	}
	else if(x < y) {
		cout << '<' << endl;
	}
	else {
		cout << '=' << endl;
	}


	return 0;
}

Measured memory_bytes: 256
use proconio::input;
use std::str;

fn main() {
    input! {
        mut n: u64,
    }

    for exp in 1..=100 {
        if n <= 26u64.pow(exp) {
            let ans = (0..exp)
                .map(|i| b'a' + (((n - 1) / 26u64.pow(i)) % 26) as u8)
                .rev()
                .collect::<Vec<_>>();
            println!("{}", str::from_utf8(&ans).unwrap());
            return;
        }
        n -= 26u64.pow(exp);
    }
    unreachable!();
}


Measured memory_bytes: 2168
'use strict'

function main(inp) {
  inp = inp.trim().split('\n');
  let ans = 0
  for (let i = 1; i <= 3; i++) {
    if (inp.indexOf(String(i)) === -1) ans = i
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 22076
s=gets.chomp
n=s.size

m=10**9+7

a=[]
c=[]
q=[]
t=[1]

s.chars{|x|
  a.push (a.last||0)+(x==?A?1:0)
  c.push (c.last||0)+(x==?C?1:0)
  q.push (q.last||0)+(x==???1:0)
  t.push t.last*3%m
}

r=0
(1..n-2).map{|i|
  A=a[i-1]
  C=c[n-1]-c[i]
  QA=q[i-1]
  QC=q[n-1]-q[i]
  if s[i]==?B||s[i]==??
    r += (A * t[QA] + (QA==0?0:t[QA - 1]*QA)) * (C * t[QC] + (QC==0?0:t[QC-1]*QC))
    r %= m
  end
}
p r

Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
const int maxn=85;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    
    long long ans=1000;
    for(int i=2;i<=n;i++)
    {
        if(a[i]>a[i-1])
        {
            long long tmp=ans/a[i-1];
            ans+=(a[i]-a[i-1])*tmp;
        }
    }
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
 
vector<pair<string,int> > v;

int main(){
	
	int n;cin>>n;
	rep(i,n)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,1));
	}
	int m;cin>>m;
	rep(i,m)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,-1));
	}
	int ans = 0;
	rep(i,n+m)
	{
		string name = v[i].first;
		int cost = v[i].second;
		rep(j,n+m)
		{
			if(i==j) continue;
			if(name == v[j].first)cost += v[j].second;
		}
		ans = max(ans,cost);
	}
	
	cout << ans << endl;
}

//cout << ans << endl;

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<map>
using namespace std;
#define N 500005
#define INF 0x3f3f3f3f
#define LL long long
int rd()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48); c=getchar();}
	return f*x;
}
priority_queue<int,vector<int>,greater<int> > Q;//小根堆 保证字典序最小 
int n,k,m;
int ind[N];
vector<int>G[N];
int q[N],ans[N];
int tree[N<<2];
//权值线段树 维护区间最小值(因为是从右到左 就是离他最近 
void PushUp(int i)
{
	tree[i]=min(tree[i<<1],tree[i<<1|1]);
}
void Update(int i,int l,int r,int pos,int val)
{
	if(l==r)
	{
		tree[i]=val;
		return ;
	}
	int mid=(l+r)>>1;
	if(pos<=mid) Update(i<<1,l,mid,pos,val);
	else Update(i<<1|1,mid+1,r,pos,val);
	PushUp(i);
}
int Query(int i,int l,int r,int ql,int qr)
{
	if(r<ql||qr<l) return INF;
	if(ql<=l&&qr>=r) return tree[i];
	int mid=(l+r)>>1;
	return min(Query(i<<1,l,mid,ql,qr),Query(i<<1|1,mid+1,r,ql,qr));
} 
void Topo()
{
	for(int i=1;i<=n;i++)
		if(!ind[i]) Q.push(i);
	while(!Q.empty())
	{
		int u=Q.top(); Q.pop();
		q[++m]=u;
		for(int i=0;i<G[u].size();i++)
		{
			int v=G[u][i];
			ind[v]--;
			if(!ind[v]) Q.push(v);
		}
	}
}
int main()
{
	memset(tree,INF,sizeof(tree));
	n=rd(),k=rd();
	for(int i=1;i<=n;i++)
		q[rd()]=i;
	for(int i=n;i>=1;i--)
	{
		int j=Query(1,1,n,q[i]+1,q[i]+k-1);//q[j]-q[i]<k
		if(j!=INF) ind[q[j]]++,G[q[i]].push_back(q[j]);
		j=Query(1,1,n,q[i]-k+1,q[i]-1);//q[i]-q[j]<k
		if(j!=INF) ind[q[j]]++,G[q[i]].push_back(q[j]);
		Update(1,1,n,q[i],i);
	}
	Topo();
	for(int i=1;i<=n;i++)
		ans[q[i]]=i;
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 44976