akhauriyash/Code-Regression huggingface dataset:
#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "random"
#include        "chrono"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          pb push_back
#define          N (int)2e5+5
#define          PI acos(-1.0)
#define          int long long 
#define          vi vector<int>
#define          mod 1000000007
#define          ld long double
#define          eb emplace_back
#define          mii map<int,int>
#define          vpii vector<pii>
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) x.rbegin(),x.rend()
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > 
OS ;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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 inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k,q;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
    cin >> n >> s;

    int i = 0 ,  j = n - 1;

    while( i < n and s[i] == 'R' ) i++;
    while( ~j and s[j] == 'W' ) j--;

    int ans = 0;

    if( j <= i ) ans = 0;
    else
    {
        while( i < j )
        {
            if( s[i] == 'W' and s[j] == 'R' )
            {
                // bug( i , j );
                // swap( s[i] , s[j] );
                ans += 1;
                i += 1;
                j -= 1;
                continue;
            }
            if( s[i] == 'R' and ( s[j] == 'R' or s[j] == 'W' ) ) i++;
            if( s[i] == 'W' and  s[j] == 'W' ) j--;
        }
    }

    cout << ans << endl;
}

int32_t main()
{
    FAST;     
    int t=1; 
    // cin>>t;
    test(t) go();
}

 

Measured memory_bytes: 8404
import numpy as np
n = int(input())
ans = 0
field = [map(int,input().split()) for _ in range(n)]
x,y,z = 0,0,0
# 1つ前の値のみわかればよいので
# aにはa,a,aがbには
for a,b,c in field:
  #x,y,zは毎回入れ替わるので活動は連続しない
  x,y,z = max(y,z) + a,max(x,z) + b,max(x,y) + c

print(max(x,y,z))

Measured memory_bytes: 63344
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;

static const int MAX_HW = 510;

int main(void){
  //入力
  int H, W;
  int a[MAX_HW][MAX_HW], a_2[MAX_HW][MAX_HW];
  int answer[MAX_HW*MAX_HW][4];
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> a[i][j];
    }
  }
  //mod2の配列を持っておく。
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      a_2[i][j] = a[i][j] % 2;
    }
  }
  //ジグザグの経路を作って，奇数なら1個箱を移動させていくことを行う。
  int cnt = 0;
  for(int i = 0; i < H*W - 1; i++){
    int x = i / W;
    int y;
    if(x % 2 == 0) y = i % W;
    else y = W - i % W - 1;
    if(a_2[x][y] == 1){
      if(x % 2 == 0){
        //端の処理
        if(y == W - 1){
          answer[cnt][0] = x + 1;
          answer[cnt][1] = y + 1;
          answer[cnt][2] = x + 2;
          answer[cnt][3] = y + 1;
          //cout << x + 1 << " " << y + 1 << " " << x + 2 << " " << y + 1 << endl;
          a_2[x + 1][y] += 1;
          a_2[x + 1][y] %= 2;
          cnt++;
        }
        else{
          answer[cnt][0] = x + 1;
          answer[cnt][1] = y + 1;
          answer[cnt][2] = x + 1;
          answer[cnt][3] = y + 2;
          //cout << x + 1 << " " << y + 1 << " " << x + 1 << " " << y + 2 << endl;
          a_2[x][y + 1] += 1;
          a_2[x][y + 1] %= 2;
          cnt++;
        }
      }
      else{
        if(y == 0){
          answer[cnt][0] = x + 1;
          answer[cnt][1] = y + 1;
          answer[cnt][2] = x + 2;
          answer[cnt][3] = y + 1;
          //cout << x + 1 << " " << y + 1 << " " << x + 2 << " " << y + 1 << endl;
          a_2[x + 1][y] += 1;
          a_2[x + 1][y] %= 2;
          cnt++;
        }
        else{
          answer[cnt][0] = x + 1;
          answer[cnt][1] = y + 1;
          answer[cnt][2] = x + 1;
          answer[cnt][3] = y;
          //cout << x + 1 << " " << y + 1 << " " << x + 1 << " " << y << endl;
          a_2[x][y - 1] += 1;
          a_2[x][y - 1] %= 2;
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  for(int i = 0; i < cnt; i++){
    cout << answer[i][0] << " " << answer[i][1] << " ";
    cout << answer[i][2] << " " << answer[i][3] << endl;
  }

  return 0;
}


Measured memory_bytes: 8064
# encoding: utf-8
import math, sys

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

ans = "No"
x = y = 0
t_prev = 0
for ti, xi, yi in txy:
    dist = math.fabs(x - xi) + math.fabs(y - yi)
    if ti - t_prev < dist: break
    elif (ti - t_prev) % 2 != dist % 2: break
    else:
        x = xi
        y = yi
        t_prev = ti
else:
    ans = "Yes"

print(ans)

Measured memory_bytes: 27300
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a<c&&c<b)
  cout<<"Yes"<<endl;
  else if(b<c&&c<a)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
} 


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=19;
const int MAXPATH=20;
const int MOD=1000000007;

int n,npath,nfixes;
int fix[MAXPATH][MAXN];

int dp[1<<MAXN];

int calcnmask(int mask,int j) {
	int suf=mask&((1<<j)-1),prf=mask^suf;
	if(prf==0) return suf^(1<<j);
	int lsb=prf&-prf;
	return mask^lsb^(1<<j);
}

void run() {
	scanf("%d%d%d",&n,&npath,&nfixes); --n;
	REP(i,npath) REP(j,n) fix[i][j]=-1;
	REP(i,nfixes) { int a,b,c; scanf("%d%d%d",&a,&b,&c); --a,--b; fix[a][b]=c; }
	memset(dp,0,sizeof(dp)); dp[0]=1;
	REP(i,npath) {
		REP(j,n) for(int mask=(1<<n)-1;mask>=0;--mask) {
			if(dp[mask]==0||((mask>>j)&1)==1) continue;
			int nmask=calcnmask(mask,j);
			if((dp[nmask]+=dp[mask])>=MOD) dp[nmask]-=MOD;
		}
		REP(j,n) if(fix[i][j]!=-1) REP(mask,1<<n) if(((mask>>j)&1)!=fix[i][j]) dp[mask]=0;
		//printf("%d:",i); REP(mask,1<<n) if(dp[mask]!=0) printf(" %x=%d",mask,dp[mask]); puts("");
	}
	int ret=0; REP(mask,1<<n) if((ret+=dp[mask])>=MOD) ret-=MOD; printf("%d\n",ret);
}

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


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(),(x).end()

int main () {
  vector<string> vec;
  int h, w;
  cin >> h >> w;

  REP(i, h) {
    string input;
    cin >> input;
    vec.push_back(input);
  }

  REP(i, h) {
    REP(j, w) {
      if(vec[i][j] == '#') {
        cout << "#";
        continue;
      }
      int count = 0;

      for(int ii = -1; ii < 2; ii++){
        if((i + ii) < 0) continue;
        if((i + ii) >= h) continue;
        for(int jj = -1; jj < 2; jj++){
          if((j + jj) < 0) continue;
          if((j + jj) >= w) continue;

          if(vec[i + ii][j + jj] == '#') count++;
        }
      }
      cout << count;
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

result = 0
for i in range(n):
  result += min(a[i]+a[i+1], b[i])
  a[i+1] = min(a[i+1], max(a[i]+a[i+1]-b[i],0))

print(result)

Measured memory_bytes: 24112
n=gets.to_i


puts 50
g=[]
if n/50 == 0
  g=[50]*(n%50)+[0]*(50-n%50)
else
  g=[49+n/50+51-n%50]*(n%50)+[49+n/50-n%50]*(50-n%50)
end
puts g*(" ")



Measured memory_bytes: 1788
N, M, *HAB = map(int, open(0).read().split())
H, AB = [0] + HAB[:N], HAB[N:]
good = [False] + [True] * N
for a, b in zip(*[iter(AB)] * 2):
  if H[a] >= H[b]:
    good[b] = False
  if H[b] >= H[a]:
    good[a] = False
print(sum(good))

Measured memory_bytes: 44044
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int ans = 1;
  int max = 0;
  
  for(int i = 1; i <= N; i++){
    int now = i;
    int j = 0;
    while(1){
        if(now % 2 == 0){
            j++;
            now /= 2;
        }
        else{
            if(j > max){
                ans = i;
                max = j;
            }
            break;
        }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iomanip>    // setw 控制输出间隔函数
#include <iostream>   // cin, cout, abs
#include <algorithm>  // max, min, swap, sort
#include <cmath>      // pow
#include <cstring>    // strlen, memset
#include <set>        // set 集合
#include <stack>      // stack 栈
#include <queue>      // queue 队列
#include <string>     // string 字(yang)符(rou)串, substr
#include <map>
#include <fstream>
using namespace std;
int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if( abs( a - b) < abs( a - c)) printf("A\n");
    else printf("B\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100005];
ll ans,h,n,i;

int main(){
	cin>>h>>n;
	
	for(i=1;i<=n;i++){
		cin>>a[i];
		ans+=a[i];
	}
	
	if(ans>=h){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	
	return 0;
} 

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;




int main(){
	double a;
	while(cin>>a){
		double sum=0.0;
		REP(i,10){
			sum+=a;
			if(i%2==1)a/=3.0;
			else a*=2.0;
		}
		cout<<fixed<<setprecision(7)<<sum<<endl;
	}
	return 0;
}
/*

*/

Measured memory_bytes: 1276
#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(){
    string s; cin>>s;
    s[3]='8';
    cout<<s<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

template <class T> inline T square(T x) {
  T result;
  result = x * x;
  return result;
};

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  auto start = chrono::steady_clock::now();
#endif

  int n;
  cin >> n;

  vector<int> a(n + 1);

  for (auto i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }

  sort(a.begin() + 1, a.end());

  auto ans = a[(n / 2) + 1];

  ll sum = 0;

  for (auto i = 1; i <= n; ++i) {
    sum += abs(a[i] - ans);
  }
  print(sum);
#ifdef LOCAL
  auto end = chrono::steady_clock::now();
  auto diff = end - start;

  cout << "Duration: " << chrono::duration<double, milli>(diff).count() << " ms"
       << '\n';
#endif

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define F first
//#define S second
//#define T second.first
//#define C second.second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int,pair<int,int>> piii;

const int N= 1e5+5, L = 14, OO = 0x3f3f3f3f;
const ll M=10 ;
const double ESP = 1e-8;


int main(){
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    int A[n],B[n],C[n];
    for(int i=0; i<n; i++){
        A[i] = i+1;
        cin>>B[i];
    }
    for(int i=0; i<n; i++){
        cin>>C[i];
    }
    set<vector<int>>st;
    int cnt = 0;
    int ans1=0, ans2=0;
    do{
        cnt++;
        bool f1=1,f2=1;
        for(int i=0;i<n;i++){
            if(A[i]!=B[i])
                f1 = 0;
            if(A[i]!=C[i])
                f2=0;
        }
        if(f1 && !ans1)
            ans1 = cnt;
        if(f2 && !ans2)
            ans2=cnt;

    }while(next_permutation(A,A+n));

    cout<<abs(ans1-ans2)<<endl;
}
/*
*/


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  long long int s,c,ans=0;

  scanf("%lld %lld",&s,&c);

  if (2*s <= c) {
    ans+=s;
    c-=2*s;
    ans+=c/4;
  } else {
    ans+=c/2;
  }

  printf("%lld\n",ans);
    
  return 0;
}


Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int[] a = new int[n];

    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    int b = 0;
    for (int i = 1; i < n; i++) {
      b = 2 * (a[i - 1] - b / 2);
    }

    b = (a[n - 1] - b / 2);
    for (int i = 1; i < n; i++) {
      os.print(b + " ");
      b = 2 * (a[i - 1] - b / 2);
    }
    os.println(b);

  }
}

Measured memory_bytes: 63556
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];

int main(){
	int N,M,K;
	//stack<int> s;   
    queue<int> que;
    //std::cin >> N;
    //std::cin >> N >> M;
    //std::cin >> N >> M >> K;
  string s;
  cin>>s;
    
    std::vector<long long> v(N);
 
    // 入力
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];	
	}
    */
    if(s[0]=='A'){
    printf("T");
    }
    else if(s[0]=='T'){
	printf("A");
    }
    else if(s[0]=='C'){
	printf("G");
    }
    else if(s[0]=='G'){
	printf("C");
    }
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  map<string, int> m;
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    m[s]++;
    maxi = max(maxi, m[s]);
  }
  for (const auto& p : m) {
    if (p.second == maxi) {
      cout << p.first << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 25216
#include<iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <queue>
#include <math.h>
#include <algorithm>
#include <functional>
#include <set> 

using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)



signed main()
{
	int a,b,x;
	cin >> x >> a>> b;
	if (b - a <= 0) cout << "delicious" << endl;
	else if (b - a <= x ) cout << "safe" << endl;
	else cout << "dangerous" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		
		if(A==B) {
			System.out.println(1);
		} else {
			int abi = 62;
			for(; abi>=0; abi--)
				if(((A^B)&(1l<<abi))!=0)
					break;
			long mask = (1l<<abi)-1;
			long ans = mask - (A&mask) + 1;
			
			int bi = abi-1;
			for(; bi>=0; bi--)
				if(((1l<<bi)&B)!=0)
					break;
			long temp = 1l<<(bi+1);
			ans += temp + (1l<<abi) - Math.max(temp, A&mask);
			
			System.out.println(ans);
		}
		
		sc.close();
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 mod = 1e9 + 7;
i64 n, a[22][22], dp[22][1 << 21];

i64 dfs(i64 i, i64 s) {
  if (i >= n) return 1;
  if (dp[i][s] >= 0) return dp[i][s];
  i64 y = 0;
  for (i64 j = 0; j < n; ++j) {
    i64 bit = i64(1) << j;
    if (!(s & bit) && a[i][j]) y += dfs(i + 1, s | bit);
  }
  return dp[i][s] = y % mod;
}

int main() {
  fill(&dp[0][0], &dp[21][(1 << 21) - 1] + 1, -1);
  cin >> n;
  for (i64 i = 0; i < n; ++i) {
    for (i64 j = 0; j < n; ++j) cin >> a[i][j];
  }
  cout << dfs(0, 0) << '\n';
  return 0;
}


Measured memory_bytes: 360832
#include <iostream>
using namespace std;
int p[110000], n, m, par[110000], res;

int root(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = root(par[x]);
    }
}

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    par[x] = y;
}

bool same (int x, int y) {
    return root(x) == root(y);
}

int main(void){
    // Your code here!
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        par[i] = i;
        cin >> p[i];
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        unite(a, b);
    }
    for (int i = 1; i <= n; i++) {
        if(same(i, p[i])) res++;
    }
    cout << res << endl;
}


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

int main(){
    int i;
    cin >> i;

    int v = i%10;
    if (v == 3) {
        cout << "bon" << endl;
    } else if (v==0 || v==1 || v==6 || v==8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
} 

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
const double pi = acos(-1);
int main()
{
    Hello
    int n;
    cin >> n;
    vector< vector<int> > v;
    v.resize(n + 5);
    for(int i = 2; i <= n; i++){
        int boss;
        cin >> boss;
        v[boss].push_back(i);
    }
    for(int i = 1; i <= n; i++){
        cout << v[i].size() << endl;
    }
    return 0;
}

Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N = 2e5 + 10;
int a[N];
int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
	}
	for(int i = k + 1; i <= n; i++){
		if(a[i] > a[i - k]) printf("Yes\n");
		else printf("No\n");
	}


}

Measured memory_bytes: 4436
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <bitset>
#include <fstream>
#include <iomanip>

#define ll long long
#define scani(x) scanf("%i", &x)
#define scanll(x) scanf("%I64d", &x)
#define scanfl(x) scanf("%f", &x)
#define scanch(x) scanf("%c", &x)
#define scans(x) scanf("%s", x);
#define printi(x) printf("%i", x);
#define printll(x) printf("%I64d", x);
#define printfl(x) printf("%f", x);
#define printch(x) printf("%c", x);
#define prints(x) printf("%s", x);
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define INFI (1 << 29)
#define INFL (1LL << 62)
#define sz(x) int(x.size())
#define fi first
#define se second
#define forn(i, n) for(ll i = 0; i < n; i++)
#define for1(i, n) for(ll i = 1; i <= n; i++)
#define ford(i, n) for(ll i = (n - 1); i >= 0; i--)
#define fori(i, n) for(ll i = n; i >= 1; i--)
#define fore(i, l, r) for(ll i = l; i <= r; i++)
#define get_bit(mask, x) (bool)(mask & (1LL << x))
#define set_bit(mask, x) (mask |= (1LL << x))
#define reset_bit(mask, x) (mask &= ~(1LL << x))
#define toggle_bit(mask, x) (mask ^= (1LL << x))

using namespace std;

ll nodos, q, desde, hasta, node, value;

vector < vector < ll > > adj;
vector < ll > d;

void DFS(ll nodo, ll costo)
{
    d[nodo] = costo;

    for(auto i:adj[nodo])
        DFS(i, (costo + d[i]));
}

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

    cin >> nodos >> q;

    adj.resize(nodos + 1);
    d = vector < ll >((nodos + 1), 0);

    forn(i, (nodos - 1))
    {
        cin >> desde >> hasta;

        adj[desde].push_back(hasta);
    }

    while(q--)
    {
        cin >> node >> value;

        d[node] += value;
    }

    DFS(1, d[1]);

    for1(i, nodos)
        cout << d[i] << " ";
    cout << "\n";

    return 0;
}


Measured memory_bytes: 21120
e1, e2, e3, e4 =map(int, input().split())

if  e1==e2 and e3==e4:
    print('yes')
elif e1==e3 and e2==e4:
    print('yes')
elif e1==e4 and e2==e3:
    print('yes')
else:
    print('no')


Measured memory_bytes: 5596
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define int long long
using namespace std;

string s[2];
int cnt[2][4001][26];
vector<vector<int>> dict;

//[l, r)
vector<int> getArray(int type, int l, int r) {
	vector<int> ret(26);
	for (int i = 0; i < 26; i++) {
		ret[i] = cnt[type][r][i] - cnt[type][l][i];
	}
	return ret;
}

signed main() {
	int l, r;
	
	cin >> s[0] >> s[1];
	for (int i = 0; i < s[0].length(); i++) cnt[0][i + 1][s[0][i] - 'a']++;
	for (int i = 0; i < s[1].length(); i++) cnt[1][i + 1][s[1][i] - 'a']++;
	for (int i = 1; i <= s[0].length(); i++) for (int j = 0; j < 26; j++) cnt[0][i][j] += cnt[0][i - 1][j];
	for (int i = 1; i <= s[1].length(); i++) for (int j = 0; j < 26; j++) cnt[1][i][j] += cnt[1][i - 1][j];
	
	for (int length = min(s[0].length(), s[1].length()); length > 0; length--) {
		dict.clear();
		for (l = 0; l < s[1].length(); l++) {
			r = l + length;
			if (r > s[1].length()) break;
			dict.push_back(getArray(1, l, r));
		}
		sort(dict.begin(), dict.end());
		
		for (l = 0; l < s[0].length(); l++) {
			r = l + length;
			if (r > s[0].length()) break;
			
			vector<int> a = getArray(0, l, r);
			if (*lower_bound(dict.begin(), dict.end(), a) == a) {
				cout << length << endl;
				return 0;
			}
		}
	}
	
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 5668
n, k = [int(v) for v in input().split()]
x = [int(v) for v in input().split()]

ans = 10 ** 9
for i in range(n - k + 1):
    left = i
    right = i + k - 1
    if x[right] <= 0:
        ans = min(ans, abs(x[left]))
    elif 0 <= x[left]:
        ans = min(ans, abs(x[right]))
    else:
        diff = abs(x[right] - x[left])
        ans = min(ans, diff + abs(x[right]), diff + abs(x[left])) 

print(ans)

Measured memory_bytes: 14384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n,k;
  cin >> n >> k;
  set<int> banned;
  rep(i,k) {
    int s; cin >> s;
    banned.insert(s);
  } 
  for (int i = n; i <= 10*n; i++)
  {
    int now = i;
    bool ok = true;
    while (now > 0)
    {
      if (banned.count(now%10) == 1) {
        ok = false;
        break;
      }
      now /= 10;
    }
    if (ok) {
      cout << i << endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<map>
#include<iomanip>
#include<limits>
#include<queue>
#include<set>
#include<cstdio>
#include<climits>
#include<cstring>

using namespace std;


int main(){

    int N,x;

    cin >> N >> x;

    vector<long long>a(N);

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

    long long cnt = 0;
    for(int i = 0;i < N-1;i++){
    	if(a[i] + a[i+1] > x){
    		int c = a[i] + a[i+1]  - x;
    		a[i+1] -= c;
    		cnt += c;
    		if(a[i+1] < 0){
    			a[i+1] = 0;
    		}
    	}
    }


    cout << cnt << endl;

    return 0;

}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int solve(string& s) {
  int ans = 1 << 29;
  for (int i = 0; i <= (int)s.size() - 3; ++i) {
    string ss;
    for (int k = i, cnt = 0; k < s.size() && cnt != 3; ++k, cnt++) {
      ss += s[k];
    }
    ans = min(abs(stoi(ss) - 753), ans);
    // cout << ss << endl;
  }
  return ans;
}

int main() {
  string s;
  cin >> s;
  cout << solve(s) << endl;
}


Measured memory_bytes: 256
N=int(input())
ans=0
def dfs(cur,use):
    global ans
    if cur>N: return
    if use==0b111:ans+=1
    dfs(cur*10+7,use | 0b001)
    dfs(cur*10+5,use | 0b010)
    dfs(cur*10+3,use | 0b100)

dfs(0,0)
print(ans)
        

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int r;
    cin >> r;
    if (r < 1200) {
        println("ABC");
    }
    else if (r < 2800) {
        println("ARC");
    }
    else {
        println("AGC")
    }
    return 0;
}

Measured memory_bytes: 3548
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		/*
		Order[] orders = new Order[n];
		
		
		for (int i = 0; i < n; i++) {
			String op = sc.next();
			String val = sc.next();
			orders[i] = new Order(op, val);
		}
		sc.close();
		
		Set<String> sv = new HashSet<>();
		for (Order o : orders) {
			if (o.op.equals("insert")) {
				sv.add(o.val);
			}
			if (o.op.equals("find")) {
				System.out.println(sv.contains(o.val) ? "yes" : "no");
			}
		}
		*/
		
		Set<String> sv = new HashSet<>();
		for (int i = 0; i < n; i++) {
			String op = sc.next();
			String val = sc.next();
			if (op.equals("insert")) {
				sv.add(val);
			}
			if (op.equals("find")) {
				System.out.println(sv.contains(val) ? "yes" : "no");
			}
		}
	
	}
}

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: 163056
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    long long ans = 0;
    int x = min(c, b);
    ans += x * 2;
    c -= x;
    b -= x;
    int y = min(c, a);
    ans += y;
    c -= y;
    a -= y;
    ans += b;
    if (c > 0) ans++;
    cout << ans << endl;
}



Measured memory_bytes: 256
n = int(input())
st = {}

maxi = 0

for _ in range(n):
    s = input()

    if s in st:
        st[s] += 1
    else:
        st[s] = 1

    if st[s] > maxi:
        maxi = st[s]

ans = []
for k, v in st.items():
    if v==maxi:
        ans.append(k)

ans = sorted(ans)
for a in ans:
    print(a)

Measured memory_bytes: 32988
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size()-8;i++){
    cout<<s[i];
  }
  cout<<endl;


}


Measured memory_bytes: 256
#include<stdio.h>

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

  char A[N+1], B[N+1], C[N+1];
  scanf("%s", A);
  scanf("%s", B);
  scanf("%s", C);


  int i, c;
  c = 0;

  for(i = 0; i < N; i++){
    if(A[i] == B[i] && A[i] == C[i]) c = c;
    else if(A[i] == B[i]) c++;
    else if(B[i] == C[i]) c++;
    else if(C[i] == A[i]) c++;
    else c += 2;
  }

  printf("%d\n", c);

  return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    abc152c()
}

fun abc152c() {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map { it.toLong() }

    var currMin = Long.MAX_VALUE / 10
    var answer = 0L

    for (p in pList) {
        if (p <= currMin) answer++

        currMin = Math.min(currMin, p)
    }

    println(answer)
}


Measured memory_bytes: 82872
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;

int main(){
  int w,h;
  cin>>w>>h;
  int x[10][10];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++)cin>>x[i][j];
  }

  int ans =0;
  rep(k,10)rep(j,10)rep(i,10){
    x[i][j]=min(x[i][j],x[i][k]+x[k][j]);
  }

  rep(i,w)rep(j,h){
    int v;cin>>v;
    if(v==-1)continue;
    ans+=x[v][1];
  }


  cout<<ans<<endl;

}

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

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

  int d[3];
  cin >> d[0] >> d[1] >> d[2];
  sort(d, d+3);

  cout << d[0] + d[1] << '\n';

  return (0);
}


Measured memory_bytes: 3588
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,j,n) for(int i = (int)(j); i < (int)(n); i++)
#define mrep(i,n) for (int i = (int)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll MAX=1e18;

int main() {
	int n; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	int count = 0;
	rep(i,n) {
		while(a[i]%2==0) {
			count++;
			a[i]/=2;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 3688
s=list(input())
n=int(input())
from collections import deque
d=deque(s)
cnt=0
for i in range(n):
    a=list(input().split())
    if len(a)==1:
        cnt+=1
    else:
        if cnt%2==0:
            if a[1]=="1":
                d.appendleft(a[2])
            else:
                d.append(a[2])
        else:
            if a[1]=="2":
                d.appendleft(a[2])
            else:
                d.append(a[2])
if cnt%2==1:
    d=list(d)
    d=d[::-1]
    print("".join(d))
else:
    print("".join(d))

Measured memory_bytes: 10996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int kansu(int n){
    if(n % 2 == 0) return n / 2;
    else return 3 * n + 1;
}
int main()
{
    INIT;
    int s;
    cin >> s;
    vector<int> v(10e7, 0);
    int ans = 1;
    while(true){
        if(v.at(s) == 0){
            v.at(s)++;
        }else{
            cout << ans << endl;
            break;
        }
        s = kansu(s);
        ans++;
    }

    return 0;
}

Measured memory_bytes: 390912
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]
ld = [0]*26
score = 0
def dec(day):
    ans = 0
    for i in range(26):
        ans += c[i]*(day-ld[i])
    return ans


for i in range(d):
    t = int(input())
    score+=s[i][t-1]
    ld[t-1]=i+1
    score-=dec(i+1)
    print(score)


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

int main() {
  int n, k;
  cin>>n>>k;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  vector<int> b;
  for (int i=0; i<n; i++) {
    if (a[i] < k) {
      b.push_back(a[i]);
    }
  }
  int size = b.size();
  bool dp_left[size+1][k], dp_right[size+1][k];
  for (int i=0; i<=size; i++) {
    for (int j=0; j<k; j++) {
      dp_left[i][j] = false;
      dp_right[i][j] = false;
    }
  }
  dp_left[0][0] = true;
  for (int i=1; i<=size; i++) {
    for (int j=0; j<k; j++) {
      dp_left[i][j] = dp_left[i][j] || dp_left[i-1][j];
      if (j + b[i-1] < k && dp_left[i-1][j]) {
        dp_left[i][j+b[i-1]] = true;
      }
    }
  }
  dp_right[size][0] = true;
  for (int i=size-1; i>=0; i--) {
    for (int j=0; j<k; j++) {
      dp_right[i][j] = dp_right[i][j] || dp_right[i+1][j];
      if (j + b[i] < k && dp_right[i+1][j]) {
        dp_right[i][j+b[i]] = true;
      }
    }
  }
  int ans = 0;
  for (int i=0; i<size; i++) {
    vector<int> left;
    for (int j=0; j<k; j++) {
      if (dp_left[i][j]) {
        left.push_back(j);
      }
    }
    vector<int> right;
    for (int j=0; j<k; j++) {
      if (dp_right[i+1][j]) {
        right.push_back(j);
      }
    }
    bool found = false;
    for (int x: left) {
      auto it = lower_bound(right.begin(), right.end(), k - x - b[i]);
      if (it == right.end()) {
        continue;
      }
      int v = *it;
      if (x + v < k && x + v + b[i] >= k) {
        found = true;
        break;
      }
    }
    if (!found) {
      ++ans;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 49152
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;

int main()
{
	int n,a,b,c;
	cin>>n>>a>>b>>c;
	int *d;
	d=new int[n];
	
	for(int i=0;i<n;i++){cin>>d[i];}
	
	int cal=c/a;
	
	sort(d,d+n,greater<int>());
	
	for(int i=0;i<n;i++){
		a+=b;
		c+=d[i];
		if(cal<c/a){cal=c/a;}
	}
	
	cout<<cal<<endl;
	delete [] d;
	return 0;
}

Measured memory_bytes: 1212
#include<stdio.h>

int main(void){
	long int N,span,rest,A,B;
	scanf("%ld%ld%ld",&N,&A,&B);
	span=N/(A+B);
	rest=N%(A+B);
	if(rest>A){
		rest=A;
	}
	printf("%ld\n",span*A+rest);
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <stack>
#include <string>
#include <vector>
#include <utility>

using namespace std;

int main() {
    char buf[1<<15];
    scanf("%s", buf);
    string s(buf);

    stack<size_t> q;
    vector<pair<size_t, int>> L;
    int A=0;
    for (size_t i=0; i<s.length(); ++i) {
        if (s[i] == '\\') {
            q.push(i);
        } else if (s[i] == '/') {
            if (q.empty()) continue;

            int l=i-q.top();
            A += l;
            while (!L.empty()) {
                if (L.back().first < q.top()) break;

                l += L.back().second;
                L.pop_back();
            }
            L.push_back(make_pair(q.top(), l));
            q.pop();
        }
    }

    printf("%d\n", A);

    size_t k=L.size();
    printf("%zu%c", k, k? ' ':'\n');
    for (size_t i=0; i<k; ++i)
        printf("%d%c", L[i].second, i<k-1? ' ':'\n');

    return 0;
}

Measured memory_bytes: 2912
#pragma GCC optimize(2)

#include "bits/stdc++.h"

using namespace std;

#define all(a) begin(a), end(a)
#define MOD 1000000007
#define PII pair<int, int>
#define REP(x, l, u) for (ll x = l; x < u; x++)
#define RED(x, l, u) for (ll x = l; x >= u; x--)
#define complete_unique(a) a.erase(unique(begin(a), end(a)), end(a))
#define mst(x, a) memset(x, a, sizeof(x))
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b) {
    long long res = 1;
    while (b) {
        if (b & 1) {
            res = a * res;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll gcd(ll a, ll b) {
    a = abs(a), b = abs(b);
    while (b != 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

bool is_prime(int n) {
    if (n == 0)return false;
    if (n == 1)return false;
    if (n == 2)return true;
    if (n % 2 == 0)
        return false;
    int j = sqrt(n);
    for (int i = 2; i <= j; ++i) {
        if (n % i == 0)
            return false;
    }
    return true;
}

ll reverse_num(ll n) {
    ll x = 0, t = n;
    while (t != 0) {
        x = x * 10 + t % 10;
        t /= 10;
    }
    return x;
}

void solve() {
    //    freopen("C:\\Users\\26019\\Downloads\\P1195_4.in", "r", stdin);
    //    fclose(stdin);
    int t = 1;
//    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        if (x >=30) cout << "Yes";
        else cout <<"No";
    }
}

int main() {
    // 加速输入和输出
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}



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

flag = {}
ans = {}
for i in range(10):
    for j in range(10):
        ans[(i, j)] = set()
        flag[(i, j)] = False

happend = [False] * 10
for s in S:
    for i in range(10):
        for j in range(10):
            if flag[(i, j)]:
                ans[(i, j)].add(s)

    for j in range(10):
        if happend[j]:
            flag[j, int(s)] = True  # すでに登場しているものとの組み合わせは以後追加できる
    happend[int(s)] = True  # 初出場ならTrueになる

# for k, v in flag.items():
#     print(k, v)
#
# for k, v in ans.items():
#     print(k, v)
count = 0
for v in ans.values():
    count += len(v)
print(count)


Measured memory_bytes: 3064
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<typename T>
vector<T> zaatsu(vector<T> &c1,vector<T> &c2){
  vector<T> vals;
  int n=(int)c1.size();
  for(int i=0;i<n;i++){
    for(T d=0;d<=0;d++){
      vals.push_back(c1[i]+d);
      vals.push_back(c2[i]+d);
    }
  }
  sort(vals.begin(),vals.end());
  vals.erase(unique(vals.begin(),vals.end()),vals.end());
  for(int i=0;i<n;i++){
    c1[i]=lower_bound(vals.begin(),vals.end(),c1[i])-vals.begin();
    c2[i]=lower_bound(vals.begin(),vals.end(),c2[i])-vals.begin();
  }
  return vals;
}
int main(){
  int n,i,j;
  scanf("%d\n",&n);
  vector<ll> x1(n),x2(n),y1(n),y2(n);
  for(i=0;i<n;i++){
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
  }
  vector<ll> x=zaatsu(x1,x2);
  vector<ll> y=zaatsu(y1,y2);
  int g[4010][4010];
  for(i=0;i<=x.size();i++){
    for(j=0;j<=y.size();j++){
      g[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    g[x1[i]][y1[i]]++;
    g[x1[i]][y2[i]]--;
    g[x2[i]][y1[i]]--;
    g[x2[i]][y2[i]]++;
  }
  for(i=0;i<x.size();i++){
    for(j=1;j<y.size();j++){
      g[i][j]+=g[i][j-1];
    }
  }
  for(i=0;i<y.size();i++){
    for(j=1;j<x.size();j++){
      g[j][i]+=g[j-1][i];
    }
  }
  ll ans=0;
  for(i=0;i<x.size();i++){
    for(j=0;j<y.size();j++){
      if(g[i][j]>=1){
        ans+=(x[i+1]-x[i])*(y[j+1]-y[j]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 66020
n = int(input())

s = set(range(1,n+1))
s3 = {i for i in range(1,n+1) if i % 3 == 0}
s5 = {i for i in range(1,n+1) if i % 5 == 0}

diff = s.difference(s3,s5)
print(sum(diff))

Measured memory_bytes: 178752
#include<iostream>
#include<string>
using namespace std;
int main(){
	int cnt = 0 , match = 0;
	string w,t[300];
	cin >> w;
	string tt;
	int a=0;
	while (cin >> tt, tt != "END_OF_TEXT"){
		t[a] = tt;
		a++;
	}
	for (int j = 0; j < a; j++){
		for (int i = 0; i < t[j].size(); i++){
			if (w.size() != t[j].size()){ break; }
			if (32+w[match] == t[j][i] || w[match] == t[j][i] || w[match] == t[j][i]+32){ match++; }
			else{ match = 0; }
			if (match == w.size()){ cnt++; match = 0;}
		}
		match = 0;
	}
	cout << cnt<<endl;
	return 0;
}


Measured memory_bytes: 3224
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

ll g(ll x) {
  ll ans = 0;
  for (ll i = 2; i <= 45; i++) {
    ll tmp = x % (1LL << i);
    bool cond = tmp >= (1LL << (i - 1));
    ll vv = ((tmp - ((1LL << (i - 1)) - 1)) % 2);
    if (cond) ans |= vv << (i - 1);
  }
  ans |= ((x%4 == 1) || (x%4 == 2));
  return ans;
}

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

  ll ans;
  if (a == 0) {
    ans = b;
  } else {
    //cout << g(a - 1) << endl;
    //cout << g(b) << endl;
    ans = g(a - 1) ^ g(b);
  }

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


Measured memory_bytes: 256
I = [int(_) for _ in open(0).read().split()]
H, W = I[:2]
A = I[2:2 + H * W]
B = I[2 + H * W:]
D = [abs(a - b) for a, b in zip(A, B)]
dp = [0] + [1] + [0] * (W - 1)
for h in range(H):
    dpo = dp
    dp = [0] * (W + 1)
    for w, d in enumerate(D[W * h:W * (h + 1)]):
        s = dp[w] | dpo[w + 1]
        dp[w + 1] = (s << d) | (s >> d)
        t = bin(s)[2:][::-1][:d + 1]
        t += '0' * (d + 1 - len(t))
        dp[w + 1] |= int(t, 2)
for i in range(160 * 80):
    if dp[-1] & 2**i:
        print(i)
        exit()


Measured memory_bytes: 78748
program test
implicit none
integer(8) :: i,j,k,n,ans(300000)=0,a(300000)=0

read(*,*) n

read(*,*) (a(i),i=2,n)

do i = 2,n
  ans(a(i)) = ans(a(i)) + 1
enddo

do i = 1,n
  write(*,*) ans(i)
enddo

end program

Measured memory_bytes: 8440
#include <stdio.h>
int main()
{
	int n,i;              //1,2,4,8,16,32,64,128
	while(scanf("%d",&n)!=EOF){
		if(n>=64)
		  printf("64");
		else if(n>=32)
		  printf("32");
		else if(n>=16)
		  printf("16");
		else if(n>=8)
		  printf("8");
		else if(n>=4)
		  printf("4");
		else if(n>=2)
		  printf("2");
		else
		  printf("1");
		
		
	}
 } 

Measured memory_bytes: 128
def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    if n % 2 == 1:
        min_a = sorted([a for a, b in ab])[n//2]
        max_a = sorted([b for a, b in ab])[n//2]
        print(max_a-min_a+1)
    else:
        min_a = sum(sorted([a for a, b in ab])[n//2-1:n//2+1])*2
        max_a = sum(sorted([b for a, b in ab])[n//2-1:n//2+1])*2
        print((max_a-min_a+2)//2)


main()

Measured memory_bytes: 49224