akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	int [][] data;
	boolean [][] check;
	final int MAX = Integer.MAX_VALUE;
	int p,s;

	private void calc(int x, int y){
		boolean flg = false;
		int sum = 0;
		for(int i=0; i < s; i++){
			if(i != x){
				if(data[y][i] == MAX){
					break;
				}
				sum += data[y][i];
			}
			if(i == (s - 1)){
				data[y][x] = data[y][s] - sum;
				flg = true;
			}
		}
		if(flg) return;
		sum = 0;
		for(int i=0; i < p; i++){
			if(i != y){
				if(data[i][x] == MAX) break;
				sum += data[i][x];
			}
			if(i == (p - 1)){
				data[y][x] = data[p][x] - sum;
			}
		}
	}

	private void doit() {
		Scanner sc = new Scanner(System.in);
		p = sc.nextInt();
		while(p != 0){
			s = sc.nextInt();
			data = new int[p + 1][s + 1];
			check = new boolean[p + 1][s + 1];

			int count = 0;
			for(int i = 0; i <p + 1; i++){
				for(int j = 0; j < s + 1; j++){
					String temp = sc.next();
					if(temp.equals("?")){
						data[i][j] = MAX;
						count++;
						check[i][j] = false;
					}
					else{
						data[i][j] = Integer.parseInt(temp);
						check[i][j] = true;
					}
				}
			}
			boolean flg = false;
			int count2 = 0;
			while(count2 < count){
				boolean flg2 = false;
				for(int i = 0; i <p; i++){
					for(int j = 0; j < s; j++){
						if(data[i][j] == MAX){
							calc(j,i);
							if(data[i][j] != MAX){
								flg2 = true;
								count2++;
							}
						}
					}
				}
				if(! flg2){
					flg = true;
					break;
				}
			}
			if(! flg){
				for(int i=0; i < p;i++){
					for(int j=0; j < s; j++){
						if(check[i][j] == false){
							System.out.println(data[i][j]);
						}
					}
				}
			}
			else{
				System.out.println("NO");
			}
			p = sc.nextInt();
			if(p != 0){
				System.out.println();
			}

		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();

	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
   int n,m;
   cin >> n >> m;
   priority_queue<int,vi> que;
  
   rep(i,n){
       int x;
       cin >> x;
       que.push(x);
   }

   //maxのgetと更新を含むのでsegtree？tと思ったけど区間じゃなくていいのでpriorityQueueでいいかな
   ll ans=0;
   rep(i,m){
        int x = que.top();
        que.pop();
        x = x/2;
        que.push(x);
        
   }
   rep(i,n){
       ans += que.top();
       que.pop();
   }

   fin(ans);

   


}

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

using namespace std;

int main(){
	long long  n;
    cin >> n;
    long long mi = 1e18;
    for(int i = 0;i < 5; i++){
       long long t;
      cin >> t;
      mi = min(mi, t);
    }
  cout << (n-1)/mi + 5 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;

int main() {

    int n, m, k;
    cin >> n >> m >> k;

    vector<int> a(n);
    REP(i, n) cin >> a.at(i);
    vector<int> b(m);
    REP(i, m) cin >> b.at(i);

    vector<ll> a_(n+1);
    a_.at(0) = 0;
    REP(i, n) a_.at(i+1) = a_.at(i) + a.at(i);
    vector<ll> b_(m+1);
    b_.at(0) = 0;
    REP(i, m) b_.at(i+1) = b_.at(i) + b.at(i);

    int s=0, a_i=0, b_i=0;

    while (a_.at(a_i) <= k) {
        a_i++;
        if(a_i > n) {
            a_i = n;
            break;
        }
    }
    while (b_.at(b_i) <= k) {
        b_i++;
        if(b_i > m) {
            b_i = m;
            break;
        }
    }

    n = a_i + 1;
    m = b_i + 1;

    REP(i, n) {
        for(int j=max(s-i, 0); j<m; j++) {
            if(a_.at(i) + b_.at(j) <= k) {
                if(i+j > s) s = i+j;
            } else {
                break;
            }
        }
    }

    cout << s << endl;

}


Measured memory_bytes: 7928
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	vvll m(3,vll(3,-1)) ;
	ll a,b,c ;
	cin >> a >> b >> c ;
	m.at(0).at(0) = a ;
	m.at(0).at(1) = b ;
	m.at(0).at(2) = 3*c-a-b ;
	m.at(1).at(0) = 4*c-2*a-b ;
	m.at(1).at(1) = c ;
	m.at(1).at(2) = 2*a+b-2*c ;
	m.at(2).at(0) = a+b-c ;
	m.at(2).at(1) = 2*c-b ;
	m.at(2).at(2) = 2*c-a ;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++) cout << m.at(i).at(j) << (j==2?'\n':' ') ;
	}
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
bool f1[110],f2[110],f3[110];
int main(){
    int n;cin>>n;
    int x;cin>>x;
    for(int i=0;i<x;i++){
        int a;cin>>a;
        f1[a]=true;    
    }
    int y;cin>>y;
    for(int i=0;i<y;i++){
        int a;cin>>a;
        f2[a]=true;
    }
    int z;cin>>z;
    for(int i=0;i<z;i++){
        int a;cin>>a;
        f3[a]=true;
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(f3[i]){
            if(!f1[i]||f2[i])ans++;
        }
    }
    cout<<ans<<endl;
}   



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

int main() {
  int N, L;
  cin >> N >> L;
  int tmp = 301;
  int sum = 0;

  for ( int i = 0; i < N; i++ ) {
    sum += L + i;
    tmp = min(tmp, abs(L + i));
    // cout << tmp << L + i << endl;
  }

  if( L < 0 ) {
    if ( L + N - 1 >= 0 ) {
      cout << sum - tmp << endl;
    } else { // 負 の場合
      cout << sum + tmp << endl;
    }
  } else { // 正
    cout << sum - tmp << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
if N > 29:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 74600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = Long.parseLong(sc.next());
        long A = Long.parseLong(sc.next());
        long B = Long.parseLong(sc.next());
        sc.close();
        //青いボールの合計個数
        long sumA = N / (A + B) * A;
        long remain = N % (A + B);

        if (remain < A) {
            sumA += remain;
        } else {
            sumA += A;
        }
        System.out.println(sumA);
    }

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9;
const int maxN = 100 * 1000 + 9;

int n, k;
int color[maxN], f[maxN];
string s;

void read(){
  cin >> n >> k;
  cin >> s;
}

void solv(){
  int id = 0, last = -1;
  for(int i = 0; i < n; i++){
    if(last != s[i] - '0'){
      last = s[i] - '0';
      id++;
      color[id] = last;
    }

    f[id]++;
  }

  int L = id;
//  for(int i = 1; i <= L; i++)
//    cerr << f[i] << ' ';
//  cerr << '\n';
//
//  for(int i = 1; i <= L; i++)
//    cerr << color[i] << ' ';
//  cerr << '\n';

  for(int i = 1; i <= L; i++)
    f[i] += f[i - 1];

  int j = 0;
  int whiteCnt = 0;
  int ans = 0;
  for(int i = 1; i <= L; i++){
    while(j <= L && whiteCnt <= k){
      j++;
      whiteCnt += (color[j] == 0);
    }

    //cerr << i << ' ' << j - 1 << '\n';
    ans = max(ans, f[j - 1] - f[i - 1]);
    whiteCnt -= (color[i] == 0);
  }

  cout << ans << '\n';
}

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

  read();
  solv();

  return 0;
}


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

#define endl '\n' ;

using namespace std;

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

int main()
{
    quick();
    int n ; cin >> n ; string arr[n]; bool state = true ;
    for (int i = 0 ; i < n ; i++){
        cin >> arr[i];
    }
    for (int i = 0 ; i < n-1 ; i++){
        if (arr[i][arr[i].length()-1]!=arr[i+1][0])state=false;
    }
    set <string> st ;
    for (int i = 0 ; i < n ; i++){
        st.insert(arr[i]);
    }
    if (st.size()==n&&state){
        cout << "Yes" ;
    }else {
        cout << "No" ;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100
#define BIT (1 << 21)

int COST[101][101]; 
int BEST[101][101]; 
int R[102];

int matrix(int);

int main(int argc,char *argv[])
{
  int i, n;

  scanf("%d\n", &n);

  for(i = 1;i <= n;i++)
    {
      scanf("%d %d\n", &R[i], &R[i+1]);
    }
  
  printf("%d\n", matrix(n));
  return 0;
  
}

int matrix(n)
{
  int i,j,k,cost;
  int size = n;
  
  for (i = 1;i <= n;i++)
    {
      for(j = 1;j <= n;j++)
	{
	  COST[i][j] = BIT;
	}
      COST[i][i] = 0;
    }
  
  for(j = 1;j <= size-1;j++)
    {
      for(i = 1;i <=size-j;i++)
	{
	  for(k = i+1;k <= i+j;k++)
	    {
	      cost = COST[i][k-1] + COST[k][i+j] + R[i]*R[k]*R[i+j+1];
	      if(cost<COST[i][i+j])
		{
		  COST[i][i+j] = cost;
		  BEST[i][i+j] = k;
		}
	    }
	}
    }
  
  return COST[1][size];
}

Measured memory_bytes: 680
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> state;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }
int ceil(int a,int b){
  // a/bの切り上げを考える
  return (a+b-1)/b;
}


int main(){ 
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  rep(i,n)cin >> a[i] >> b[i] >> c[i];

  ll hapi[3][n];
  hapi[0][0] = a[0];
  hapi[1][0] = b[0];
  hapi[2][0] = c[0];

  for(int i = 1;i < n;i++){
    hapi[0][i] = max(hapi[1][i-1],hapi[2][i-1]) + a[i];
    hapi[1][i] = max(hapi[0][i-1],hapi[2][i-1]) + b[i];
    hapi[2][i] = max(hapi[1][i-1],hapi[0][i-1]) + c[i];
  }
  cout << max(max(hapi[0][n-1],hapi[1][n-1]),hapi[2][n-1]) << endl;
}

Measured memory_bytes: 7112
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;

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

}


Measured memory_bytes: 3596
n=int(input())
if n==2:
    print(0)
    exit()
ans=n-1
for i in range(int(n**0.5)+1,2,-1):
    # print(n//i+1)
    l,r=n//i+1,n//(i-1)+1
    while l+1<r:
        mid=(l+r)//2
        if n//mid<=n%mid:
            l=mid
        else:
            r=mid
    if n//l==n%l:
        ans+=l
print(ans)


Measured memory_bytes: 42732
public class Hello 
{     
    public static void Main()
    {         // 1 行に複数の入力値がある場合の例         
    string [] inputs = System.Console.ReadLine().Split(' ');         
    int a = int.Parse(inputs[0]);         
    int b = int.Parse(inputs[1]);         
    int c = (a * b);         
    int d = (a + b) * 2;        
    System.Console.WriteLine(c + " " + d);     
        
    } 
    
} 


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b, c;
  cin >> a >> b >> c;

  if (a % 2 == 0 && a == b && b == c) {
    cout << -1 << endl;
    return 0;
  }

  if (a & 1 || b & 1 || c & 1) {
    cout << 0 << endl;
    return 0;
  }

  int ans = 1;
  while (true) {
    int aa = a / 2, bb = b / 2, cc = c / 2;
    if ((aa & 1 && bb & 1 && cc & 1) ||
        (aa % 2 == 0 && bb % 2 == 0 && cc % 2 == 0)) {
      a = bb + cc;
      b = aa + cc;
      c = aa + bb;
      ans++;
    } else {
      cout << ans << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] array = new int[2000000];
		int number = in.nextInt();
		
		for( int i = 0; i < number; i ++) {
			
			array[i] = in.nextInt();
		}
		
		int ans = calcMaxDiff(array, number);
		System.out.println(ans);
		}
	
		
		public static int calcMaxDiff(int[] NumsInArray, int n) {
			int maximum = NumsInArray[1] - NumsInArray[0];
			int minimum = NumsInArray[0];
			
			for(int i = 1; i < n; i++) {
				maximum = (maximum > NumsInArray[i] - minimum ? maximum : NumsInArray[i] - minimum);
				minimum = (minimum < NumsInArray[i] ? minimum : NumsInArray[i]);
			}
			return maximum;
		}
	}




Measured memory_bytes: 107760
s = j = 0
a, b, d = [], [], []

for i, x in enumerate(input()):
    if x == '\\':
        a += [i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c]

print(s)
print(len(b), *(d))



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

int main() {
  int N;
  cin >> N;
  for(int i = 1; i < 10; i++){
    for(int j = 1; j < 10; j++){
      if(N == (i*j)){
        cout << "Yes";
        return false;
      }
    }
   }
   cout << "No" << endl;
 } 



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

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

  int N,K;
  cin>>N>>K;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i],A[i]--;
  vector<bool>b(N,false);
  vector<int>x;
  int now=0;
  int c=0;
  while(!b[now]){
    c++;
    if(c==K){
      cout<<A[now]+1<<endl;
      return 0;
    }
    b[now]=true;
    now=A[now];
  }
  int loop=now;
  x.push_back(now);
  now=A[now];
  while(!(now==loop)){
    x.push_back(now);
    now=A[now];
  }
  cout<<x[(K-c)%x.size()]+1<<endl;
  return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

string s ;
int n ;

vi v ;
vi p ;

void find_l ( )
{
    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'L' )
            v.pb ( i ) ;
    }
}

void f ( bool ver )
{
    int z = v.size() ;
    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'L' ) C ;

        int indx = v[z-1] ;
        for ( int low = 0 , hi = z-1 ; low <= hi ; )
        {
            int mid = low + hi >> 1 ;

            if ( v[mid] > i )
            {
                indx = v[mid] ;
                hi = mid - 1 ;
            }
            else low = mid + 1 ;
        }

        int d = indx - i ;
        d %= 2 ;

        indx -= d ;
        if ( ver == false )
            indx = n-1-indx ;

        p[indx] ++ ;
    }
}

void solve ( int test_case )
{
    cin >> s ;
    n = s.size() ;
    v.resize ( n ) ; p.resize ( n ) ;

    find_l ( ) ;
    f ( true ) ;

    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'R' ) s[i] = 'L' ;
        else s[i] = 'R' ;
    }

    reverse ( all ( s ) ) ;
    v.clear() ;
    find_l () ;
    f ( false ) ;

    for ( auto i : p ) cout << i << " " ;

}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 1864
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
double pi = 3.141592653589793;
using namespace std;
int z=0;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}//ここから始めよう
signed main(){
    int n;cin>>n;
    if(n==1)cout<<"Hello World"<<endl;
    else {
        int a,b;cin>>a>>b;
        cout<<a+b<<endl;
    }return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int,int>;
using P = pair<ll,ll>;
const ll inf = numeric_limits<ll>::max()/3;

int visit[110];
ll deg[110];
vector< vector<int> > T;
vector< Edge > E;

ll dfs(int n,int d){
  visit[n] = 1;
  ll res = 0;
  ll cnt = 0;
  for(int i : T[n]){
    if(!visit[i]){
      ++cnt;
      res = max(res,dfs(i,d+1));
    }
  }
  deg[d] = max(deg[d],cnt);
  return res + 1;
}

P calc(int n){
  fill(visit,visit+110,0);
  fill(deg,deg+110,0);
  visit[n] = 1;
  ll d = dfs(n,0);
  ll l = 1;
  for(int i = 0;i < d-1;++i){
    l *= deg[i];
  }
  return P(d,l);
}

P calc2(Edge e){
  fill(visit,visit+110,0);
  fill(deg,deg+110,0);
  visit[e.first] = 1;
  visit[e.second] = 1;
  ll d = max(dfs(e.first,0),dfs(e.second,0));
  ll l = 1;
  for(int i = 0;i < d-1;++i){
    l *= deg[i];
  }
  l *= 2;
  return P(d,l);
}


int main(void){
  ll n;
  cin >> n;
  T.clear();E.clear();
  T.resize(n);
  for(int i = 0;i < n-1;++i){
    int a,b;
    cin >> a >> b;
    --a;--b;
    T[a].push_back(b);
    T[b].push_back(a);
    E.push_back(Edge(a,b));
  }
  ll color = inf;
  ll leaf = inf;
  for(int i = 0;i < n;++i){
    ll newc,newl;
    tie(newc,newl) = calc(i);
    if(newc < color){
      color = newc;
      leaf = newl;
    }else if(newc == color){
      leaf = min(leaf,newl);
    }
  }
  for(Edge e : E){
    ll newc,newl;
    tie(newc,newl) = calc2(e);
    if(newc < color){
      color = newc;
      leaf = newl;
    }else if(newc == color){
      leaf = min(leaf,newl);
    }
  }
  cout << color << " " << leaf << endl;
  return 0;
}



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

int main()
{
	int ans = 0,N,D;

	cin >> N >> D >> ans;

	for (int i = 0; i < N; i++) {
		int k;
		cin >> k;
		ans += 1 + ((D - 1) / k);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

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

  int n;

  cin >> n;

  long long ans = 0;
  int max;

  cin >> max;

  int buf;
  for (int i = 1; i < n; i++) {
    cin >> buf;
    if (max > buf) {  //自分より高い人がいた
      ans += max - buf;
    } else {
      max = std::max(max, buf);
    }
  }

  cout << ans;

  return 0;
}

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

int main() {
	
	for (int i = 1; i < 10; ++i) {
		for (int j = 1; j < 10; ++j) {
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
			
	return 0;
}


Measured memory_bytes: 2924
N = int(input())
A = list(map(int,input().split()))

four_count,two_count = 0,0
for i in range(N):
  if(A[i]%4 == 0): four_count += 1
  elif(A[i]%2 == 0): two_count += 1

#(方針）4の倍数Nつで「(2N+1)つの数の数列」に関して目標達成可 
#2の倍数（4の倍数でない）Nつで「Nつの数の数列」に関して目標達成可
#この方針だと	1414122 で Yesになってしまう(正答はNo、[12]の部分があるので)
#ひとまとまりの2 = 1つの1としてカウント
#→例外 22 や 222

if(two_count <= 1): Need = N
else: Need = N - two_count + 1
  
count = 0
if(four_count>=1): count += 2*four_count + 1
if(count >= Need): judge = 1
else: judge = 0

if(judge == 0): 
 if(N == two_count): judge = 1

if(judge == 0): print('No')
else: print('Yes')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1,_2,_3,name,...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) for (ll i=(a); i<(n); ++i)
#define rep(...) _overload3(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<class T> inline void print(const T& x) {cout << x << "\n";}
template<class T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<class T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10);}} init;

int main() {
    ll n, m;
    cin >> n >> m;
    map<ll, ll, greater<ll>> d;
    rep(i, n) {ll a; cin >> a; ++d[a];}
    rep(i, m) {ll b, c; cin >> b >> c; d[c] += b;}
    ll ans = 0, cnt = 0;
    each(e, d) {
        ans += e.fi * min(e.se, n - cnt);
        cnt += min(e.se, n - cnt);
        if (cnt == n) break;
    }
    print(ans);
}

Measured memory_bytes: 16088
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M;
    cin>>N>>M;
    vi A(N,0);
    rep(i,M) {
        int a,b;
        cin>>a>>b;
        a--; b--;
        if(a==0) A[b]++;
        else if(b==N-1) A[a]++;
    }
    for(int i=1; i<N-1; i++) {
        if(A[i]>=2) {
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
}

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

#define endl '\n'

int const N = 1e6 + 1;
int dp[N][2], n;
string s;

int solve(int i, int cima){
    if (dp[i][cima] != -1) return dp[i][cima];
    if (i == n-1){
        if (cima) return dp[i][cima] = 10 - s[i];
        return dp[i][cima] = s[i];
    }
    if (cima) return dp[i][cima] = min(solve(i+1, 1) + 10 - (s[i] + 1), solve(i+1, 0) + 10 - s[i]);
    return dp[i][cima] = min(solve(i+1, 1) + s[i] + 1, solve(i+1, 0) + s[i]);
}

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

    cin >> s;
    n = s.size();
    for (int i=0; i<n; i++) s[i] -= '0';
    memset(dp, -1, sizeof dp);

    cout << min(solve(0, 0), 1 + solve(0, 1)) << endl;
    
}

Measured memory_bytes: 56092
x,k,d = map(int,input().split())
x = abs(x)
a = x // d
if a >= k:
    ans = x - (d*k)
else:
    if (k-a) % 2 == 0:
        ans = x - (a*d)
    else:
        ans = (d*(a+1)) - x
print(ans)

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

using namespace std;

typedef long long   ll;

int main(){
    ll a, b, c;

    cin >> a >> b >> c;

    if(a >= c){
        cout << c + b << endl;
    }else{
        ll tot = a;
        c -= a;

        if(c <= b){
            cout << tot + c + b << endl;
        }else{
            cout << tot + b + b + 1LL << endl;
        }
    }
}

Measured memory_bytes: 256
//Resting_Prince
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000009
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define all(v) v.begin(),v.end()
#define rep(i,a,b)    for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

int main()
{
    ll n,i,j,k,o,l,a[200055];
    ll dp[200055];
    cin>>n>>k;
    rep(i,1,n)cin>>a[i];dp[1]=0;
    rep(i,2,n)
    {
        l=inf;
        rep(j,1,k && i-j>0)
        {
            l=min(l,dp[i-j]+abs(a[i-j]-a[i]));
        }
        dp[i]=l;
    }cout<<dp[n];
    return 0;
}


Measured memory_bytes: 2944
use std::io::{ stdin, BufRead };

fn itp1_1_c<R>(input: &mut R) -> String
  where R: BufRead
{
  let mut f = my::AsciiReader::new(input, 8);
  let height = f.read_int_until_sp::<u32>();
  let width  = f.read_int_until_lf::<u32>();
  let area = height * width;
  let perimeter = (height * 2) + (width * 2);

  format!("{} {}\n", area, perimeter)
}

fn main() {
  let stdin = stdin();
  print!("{}", itp1_1_c(&mut stdin.lock()));
}

mod my {
  use std::io::BufRead;
  use std::fmt::Debug;
  use std::ops::{ Add, Sub, Mul };

  const SP: u8 = b' ';
  const LF: u8 = b'\n';

  #[derive(Debug)]
  pub struct AsciiReader<R> {
    input : R,
    buf   : Vec<u8>,
  }

  impl<R> AsciiReader<R>
    where R: BufRead
  {
    #[allow(dead_code)]
    pub fn new(input: R, capa: usize) -> Self {
      AsciiReader {
        input : input,
        buf   : Vec::with_capacity(capa),
      }
    }

    fn read_until(&mut self, delim: u8) -> usize {
      self.buf.clear();
      self.input.read_until(delim, &mut self.buf).unwrap()
    }

    // ignore sign(+-) uint only
    fn parse_int<T>(&self) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let len = self.buf.len();
      let mut i = 0;
      let mut n = T::default();

      while i < len && b'0' <= self.buf[i] && self.buf[i] <= b'9' {
        n = (n * T::from(10)) + T::from(self.buf[i] - b'0');
        i += 1;
      }
      n
    }

    #[allow(dead_code)]
    pub fn read_int_until_delim<T>(&mut self, delim: u8) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until(delim);
      self.parse_int()
    }

    // s -> n
    #[allow(dead_code)]
    pub fn read_int_until_lf<T>(&mut self) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_int_until_delim(LF)
    }

    // s -> n
    #[allow(dead_code)]
    pub fn read_int_until_sp<T>(&mut self) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_int_until_delim(SP)
    }
  }
}



Measured memory_bytes: 5012
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll, ll> pll;


ll n, m, s , t;
vector< pll > g[100005];
vector< pair<pll, ll> > M;
ll dist[2][100005];
ll ways[2][100005];
ll D;
const ll mod = 1e9 + 7;
void gos(ll src, ll id)
{
        for (int i=1;i<=n;i++)
                dist[id][i]=1e16;
        ways[id][src]=1;
        dist[id][src]=0;
        multiset<pll> sett; sett.clear();
        for (int i=1;i<=n;i++)
        {
         sett.insert(make_pair(dist[id][i],i));
        }

        for (int iter=1;iter<=n;iter++)
        {
         auto it=sett.begin();
         ll qv=(*it).second;
         ll qcost=(*it).first;
         sett.erase(it);
         for (int i=0;i<g[qv].size();i++)
         {
          ll tv=g[qv][i].first;
          ll tcost=g[qv][i].second+qcost;
          if (tcost>dist[id][tv])continue;
          if (tcost==dist[id][tv]){
                        ways[id][tv] = (ways[id][tv] + ways[id][qv])%mod;
                        continue;
          }
          sett.erase(make_pair(dist[id][tv],tv));
          dist[id][tv]=tcost;
          ways[id][tv]=ways[id][qv];
          sett.insert(make_pair(dist[id][tv],tv));
         }
        }
}
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        cin >> n >> m;
        cin >> s >> t;
        for(ll i=1;i<=m;i++) {
                ll u,v,d;
                cin >> u >> v >> d;
                g[u].pb(make_pair(v, d));
                g[v].pb(make_pair(u, d));
                M.pb(make_pair(make_pair(u,v) , d));
        }
        gos(s, 0);
        gos(t, 1);
        D = dist[0][t];
        //cout << D << endl; return 0;
        if(D >= 1e16) {
                cout << "0\n"; return 0;
        }
        ll sum = 0;
        ll yo = 0;

        for(ll i=1;i<=n;i++) {
                if(D%2 == 1) break;
                ll xx = D/2;
                if(dist[0][i] == xx && dist[1][i] == xx){
                        //cout << i << " ---- ";
                        ll ay = (ways[0][i]*ways[1][i])%mod;
                        //cout << ay << endl;
                        sum = (sum + (ways[0][i] * ways[1][i])%mod + mod)%mod;
                        yo = (yo + (ay*ay)%mod + mod)%mod;
                }
        }
        for(auto &i : M) {

                ll u = i.first.first;
                ll v = i.first.second;
                ll w = i.second;
                if(dist[0][u] > dist[0][v]) swap(u, v);
                if(dist[0][u] + w + dist[1][v] == D && dist[0][u] < (D+1)/2 && dist[1][v] < (D+1)/2 && dist[0][u]+w > (D+1)/2 && dist[1][v]+w > (D+1)/2) {
                        //cout << u << " **** " << v << endl;
                        ll ay = (ways[0][u]*ways[1][v])%mod;
                        sum = (sum + (ay%mod) + mod)%mod;
                        yo  = (yo + (ay*ay)%mod + mod)%mod;
                }
        }
        ll ans = (sum*sum)%mod;
        ans = (ans - (yo) + mod)%mod;
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 27948
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = {}
    for v in a:
        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1
    key = [v for v in dic.keys()]
    key.sort(reverse=True)
    ans = 0
    for v in key:
        num = dic[v]
        if num > 0:
            for i in reversed(range(1, 32)):
                target = 2**i
                if 2*v < target:
                    continue
                if target < v:
                    break
                u = target - v
                if v == u:
                    z = dic[v]//2
                    ans += z
                    dic[v] -= 2*z
                elif u in dic:
                    x, y = dic[v], dic[u]
                    z = 0
                    if x < y:
                        z = x
                    else:
                        z = y
                    dic[v] -= z
                    dic[u] -= z
                    ans += z
                if dic[v] == 0:
                    break
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 35196
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,i,j,c=0,d,b[4]={};
  char s[100010];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",s);
    for(j=d=0;s[j+1];j++){
      if(s[j]=='A'&&s[j+1]=='B')c++;
    }
    if(s[0]=='B')d+=1;
    if(s[j]=='A')d+=2;
    b[d]++;
  }
  if(b[3]&&b[1]+b[2]==0)b[3]--;
  printf("%d\n",c+MIN(b[1],b[2])+b[3]);
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import math
s = input()
def chang(st,string):
    cnt = 0    
    while True:
        if len(set(list(string))) == 1:
            
            return cnt
            break
        
        else:
            stn = ""
            for i in range(len(string)-1):
                if string[i]==st or string[i+1] ==st:
                    stn+=st
                else:
                    stn+=string[i]
            else:
                cnt+=1
                string = stn
                
d = set(list(s))
ans = 100
for i in d:
    ans = min(ans , chang(i,s))
print(ans)




Measured memory_bytes: 12476
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 10000000;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int,PP> PPP;
struct edge { int to; int to2; int cost; };
int a[114514];
int bit[65];
int n, k; 
int dp[65][2];



signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		rep(j, 59) {
			if (a[i] & (1ll << j))bit[j]++;
		}
	}

	int startk = 1, c = 1;
	while (c * 2 < k)c *= 2, startk++;
	
	for (int i = 59; i > 0; i--) {
		int x = k&(1ll << (i-1));
		//FREE
		if(dp[i][0])
		dp[i - 1][0] =max( dp[i][0] + max(n - bit[i-1], bit[i-1])*(1ll << i-1),dp[i-1][0]);
		//UNFREE
		if (x == 0) {
			dp[i - 1][1] = max(dp[i - 1][1], dp[i][1] + bit[i-1] * (1ll << i-1));
		}
		else {
			if(1ll<<i-1<=k)dp[i - 1][0] = max(dp[i - 1][0], dp[i][1] + bit[i-1] * (1ll << i-1));
			dp[i - 1][1] = max(dp[i - 1][1], dp[i][1] + (n - bit[i-1])*(1ll << i-1));
		}

	}
	if (k == 0) {
		int sum2 = 0;
		rep(i, n)sum2 += a[i];
		cout << sum2 << endl;
		return 0;
	}
	cout << max(dp[0][0], dp[0][1]) << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long n,k,ans=1e9,cnt=0,cnt1=0,cnt2=0,now=0,big,tmp;
int main(){
  cin >> n >> k;
  long long a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]>0){
      cnt1++;
      if(cnt1==1){
        big=i;
      }
    }else if(a[i]<0){
      cnt2++;
    }
  }

  // cout << big << endl;

  if(n==1){
    cout << abs(a[0]) << endl;
    return 0;
  }
  if(cnt1==0){
    cout << abs(a[n-k]) << endl;
    return 0;
  }
  if(cnt2==0){
    cout << abs(a[k-1]) << endl;
    return 0;
  }

  for(int i=big-1;i>=0;i--){
    cnt++;
    if(cnt==k){
      ans=abs(a[i]);
      // cout << ' '<< ans << endl;
      break;
    }
  }

  cnt=0;
  for(int i=big;i<n;i++){
    cnt++;
    if(cnt==k){
      ans=min(ans,abs(a[i]));
      // cout << ans << endl;
      break;
    }
  }

  for(int i=big;i<n;i++){
    if(i-(k-1)>=0){
      tmp=min(abs(a[i]),abs(a[i-(k-1)]))+abs(a[i])+abs(a[i-(k-1)]);
      // cout << a[i-(k-1)]<< "   " <<tmp << endl;
      ans=min(ans,tmp);
      // cout << ans << endl;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int form(int r, int D, int b) {
    return r*b - D;
}

int main() {
    int r, D, x;
    cin >> r >> D >> x;
    for (int i=1; i<=10; i++) {
        x = form(r, D, x);
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)
#define free(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%lld", &n)
#define sff(a,b) scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define pfn(n) printf("%lld\n", n)
#define pfs(n) printf("%lld ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define f find
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define in insert
#define bs binary_search
#define le length()
const ll max_i=1e16+7;
#define np(s) next_permutation(s.begin(),s.end())
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
//it gives the lexicographically smallest string//

void solve()
{
	int t=1;
	//cin>>t;
	while(t--)
    {
       int x;
       cin>>x;
       if(x>=30) cout<<"Yes";
       else cout<<"No";
	}
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	solve();
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

ll power(ll a, int b) {
  if(!b) return 1;
  ll c = power(a, b/2);
  if(b%2) return c*c%INF*a%INF;
  return c*c%INF;
}

int main() {
  int N,M;
  cin >> N >> M;
  
  vl fac(M+1);
  fac[0]=1;
  rep(i,M) fac[i+1]=fac[i]*(i+1)%INF;
  
  int sign=1;
  ll ans=0;
  rep(i,N+1) {
    ans+=fac[N]*power(fac[N-i]*fac[i]%INF*fac[M-N]%INF*fac[M-N]%INF,INF-2)%INF*fac[M]%INF*fac[M-i]%INF*sign;
    (ans+=INF)%=INF;
    sign*=-1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 7104
#define GLIBCXX_DEBUG
#include <iostream>
#include <cstdint>
using namespace std;
using i64 = int64_t;

int main(void){
    i64 a, b, x;
    cin >> a >> b >> x;
    if(x >= b) x = b-1;
    cout << a*x/b << '\n';
    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;


int H,W,hatake[110][110],memo[110][110],wakemae;
std::string field[110];

int search(int h,int w){
  if(memo[h][w]==1) return 0;
  if(memo[h][w]==0)memo[h][w]=1;
  int k[4]={1,0,-1,0},vi=0;
  for(int i=0;i<4;i++){
    if(memo[h+k[i]][w+k[3-i]]==0&&hatake[h][w]==hatake[h+k[i]][w+k[3-i]]){
	search(h+k[i],w+k[3-i]);
	vi++;
    } else {
      vi++;
    }
  }
  if(vi==4){return 1;}
}

int main(){
  while(1){
    for(int i=1;i<110;i++){
      for(int j=1;j<110;j++){
	hatake[i][j]=memo[i][j]=0;
      }
    }

    cin>>H;
    cin>>W;
    if(H==0&&W==0)break;
    for(int i=0;i<H;i++){
      cin>>field[i];
      for(int j=0;j<W;j++){
	if(field[i][j]=='@')hatake[i+1][j+1]=1;
	if(field[i][j]=='*')hatake[i+1][j+1]=2;
	if(field[i][j]=='#')hatake[i+1][j+1]=3;
      }
    }
    int count=0;
    for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
	int sssss=search(i,j);
	count=count+sssss;
      }
    }
    cout<<count<<endl;
  }
}

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

bool b[200000];

int main()
{
	string s;
	cin >> s;
	int result = 0;
	for (int i = 0; i < s.length(); i++)
	{
		b[i] = false;
		if (b[i - 1])
		{
			result++; continue;
		}
		if (i == 1 && s.at(i) == s.at(i - 1))
		{
			b[i] = true;
			continue;
		}
		if (i > 0 && s.at(i) == s.at(i - 1) && !b[i - 2])
		{
			b[i] = true;
			continue;
		}
		result++;
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 772
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define N 5010
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
priority_queue<pii> q;
vector<int> g[N];int vis[N],a[N];
int gcd(int a,int b) { return a?gcd(b%a,a):b; }
int dfs(int x,int n)
{
	for(int y=1;y<=n;y++)
		if(!vis[y]&&gcd(a[x],a[y])>1)
			vis[y]=1,dfs(y,n),g[x].push_back(y);
	return 0;
}
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);while(!q.empty()) q.pop();
	for(int i=1;i<=n;i++)
		if(!vis[i]) vis[i]=1,dfs(i,n),q.push(mp(a[i],i));
	while(!q.empty())
	{
		int x=q.top().second;
		q.pop(),printf("%d ",a[x]);
		for(int i=0;i<(int)g[x].size();i++)
			q.push(mp(a[g[x][i]],g[x][i]));
	}
	return !printf("\n");
}


Measured memory_bytes: 640
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])
YY = list(range(100))
MM = list(range(1,13))

if (S1 in YY and S1 not in MM) and S2 in MM:
  print("YYMM")
elif S1 in MM and (S2 in YY and S2 not in MM):
  print("MMYY")
elif S1 in MM and S2 in MM:
  print("AMBIGUOUS")
else:
  print("NA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

int main() {
    ll h,w;
    cin >> h >> w;
    if(h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }
    ll ans = 0;
    ans += w*(h/2);
    if(h%2 == 1) ans += (w+1)/2;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;

    public void go() throws IOException
    {
        ntok();
        long a = ipar();
        long b = ipar();
        int count = 0;
        long curr = 1;
        while (curr < b)
        {
            curr += a-1;
            count++;
        }
        out.println(count);

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

    public static void main(String[] args) throws IOException
    {
        new Main().go();
    }
}


Measured memory_bytes: 21716