akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public class Main{

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int R=in.nextInt();
		in.close();
		double result=2*R*Math.PI;
		System.out.println(result);
	}

}


Measured memory_bytes: 36048
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

stocks = 0
money = 1000

for i in range(N - 1):
    if A[i] <= A[i + 1]:
        stocks += money // A[i]
        money %= A[i]
    else:
        money += A[i] * stocks
        stocks = 0


money += A[-1] * stocks
print(money)

Measured memory_bytes: 61748
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, P: "List[int]"):
    ans = 0
    l = INF
    for pi in P:
        l = min(l, pi)
        if pi <= l:
            ans += 1
    return ans


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, P)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 97432
#include <stdio.h>
#include <math.h>
int isprime(int);

int main()
{
  int n,x[10000],judge,num=0,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&x[i]);
  }
  for(i=1;i<=n;i++){
    judge=isprime(x[i]);
    if(judge==0) num++;
  }
  printf("%d\n",num);
  return 0;
}

int isprime(int x){
  int i=0;
  if(x==2) return 0;
  if(x<2||x%2==0) return 1;

  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return 1;
    i=i+2;
  }

  return 0;
}

Measured memory_bytes: 628
#include<bits/stdc++.h>
#define mtp make_tuple
#define mpr make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
string s, t;
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	cin >> s >> t;
	for(int i = 0;i < s.size();i++){
		if(s[i] != t[i]){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<long long>H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  vector<long long>A;
  vector<long long>B;
  int count=0;
  if(N==1){
    cout<<0<<endl;
  }
  else{
    for(int i=0;i<N-1;i++){
      if(H.at(i+1)<=H.at(i)){
        count=count+1;
        if(i==N-2){
          A.push_back(count);
        }
      }
      else{
        A.push_back(count);
        count=0;
      }
    }
    if(A==B){
      cout<<0<<endl;
    }
    else{
      sort(A.begin(),A.end());
      cout<<A.at(A.size()-1)<<endl;
    }
  }
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define N 100010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define form(l, r, i)	for(int i = l; i <= r; ++i)
#define forv(r, l, i)	for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
 
const ll inf = 1e15 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;
 
using namespace std;

int a[110];
int dp[N];

int main()
{
	barnarnar
	int n, k;
	cin >> n >> k;
	forn(i, n)	cin >> a[i];
	int mn = a[0];
	//reverse(a, a + n);
	forn(i, N)	dp[i] = -1;
	forn(i, mn)	dp[i] = 0;
	for(int i = mn; i <= k; i++)
	{
		bool fl = 0;
		forn(j, n)
		{
			if(i - a[j] >= 0)
			{
				if(dp[i - a[j]] == 0)	fl = 1;
			}
		}
		if(fl)	dp[i] = 1;
		else	dp[i] = 0;
	}
	if(dp[k])	cout << "First";
	else	cout << "Second";
	return 0;
}
/*
5
11000
11100
01100
00000
00000
*/

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

using namespace std;

long long n;
long long int cnt[1005];
long long int answer = 1;

bool isPrime(int m){
  bool judge = 1;
  for(int i = 2; i < m; ++i){
    if(m % i == 0){
      judge = 0;
      break;
    }
  }
  return judge;
}

long long int solver(){
  for(int i = 1; i <= n; ++i){
    cnt[i] = 1;
  }
  for(int i = 2; i <= n; ++i){
    for(int j = 2; j <= i; ++j){
      if(i % j == 0 && isPrime(j) == 1){
        cnt[j]++;
        long long int tmp = j * j;
        while(i % tmp == 0){
          cnt[j]++;
          tmp *= j;
        }
      }
    }
  }
  for(int i = 1; i <= n; ++i){
    answer *= cnt[i];
    answer = answer % (1000000000 + 7);
    //cout << cnt[i] << endl;
    //cout << answer << endl;
  }
  return answer % (1000000000 + 7);
}

int main(){
  cin >> n;
  cout << solver() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() { 
    string s;
    cin >> s;
    int n = s.size();
    if (s == string(n, 'W') || s == string(n, 'B')) {
        cout << 0 << endl;
        return 0;
    }
    int index = 0;
    int res = 0;
    int flag = 0;
    while (index < n && s[index] == 'B') {
        s[index] = 'W';
        index++;
        flag = 1;
    }
    if (index == n) {
        cout << 2 << endl;
        return 0;
    }
    res += flag;
    flag = 0;
    index = n -1;
    while (index >= 0 && s[index] == 'B') {
        s[index] = 'W';
        index--;
        flag = 1;
    }
    res += flag;
    
    for (int i = 1; i < n; i++) {
        if (s[i] == 'B' && s[i - 1] == 'W') {
            res += 2;
        }
    }
    cout << res << endl;
}




Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define mp make_pair
#define pb push_back
#define mod 1000000007

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;cin>>n;
	int a[n],in;
	ll max = 0,max2 =0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(max<a[i])
		{
			max2 = max;
			max = a[i];
			in = i;
		}
		else if(max2<a[i])
		{
			max2 = a[i];
		}
	}
		for(int j=0;j<n;j++)
		{
			if(j!=in)
			    cout<<max;
			else{
				cout<<max2;
			} 
			cout<<endl;
		}
	
	
return 0;
}




Measured memory_bytes: 2432
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

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

		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (v[i] > c[i]) {
				ans += v[i] - c[i];
			}
		}

		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll N, X, T;
    cin >> N >> X >> T;
    ll ans = 0;
    ll tako = 0;
    while (tako < N)
    {
        tako += X;
        ans += T;
    }
    putout(ans);
    return 0;
}


Measured memory_bytes: 3552
#include <stdio.h>
int main(){
  int i,j[4],k,temp;
  scanf("%d %d %d %d",&j[0],&j[1],&j[2],&j[3]);
  for(i=0;i<4;i++){
    for(k=0;k<3-i;k++){
      if(j[k]>j[k+1]){
      temp=j[k];
      j[k]=j[k+1];
      j[k+1]=temp;
    }
    }
  }
  if(j[0]==1 && j[1]==4){
  if(j[2]==7 && j[3]==9){
    printf("YES\n");
    return 0;
  }
}
printf("NO\n");
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
#define ll long long int
using namespace std;
string make_id(int p) {
  string s = "000000";
  string t=to_string(p);
  string r;
  for(auto i=t.begin(); i!=t.end(); i++)
    s.push_back((*i));
  return s.substr(s.size()-6, s.size());
}

int main(void) {
  int n, m;
  vector<pair<pair<int, int>, int>> v;
  cin>>n>>m;
  for(int i=0; i<m; i++) {
    int p, y;
    cin>>p>>y;
    v.push_back(make_pair(make_pair(p, y), i));
  }
  sort(v.begin(), v.end());
  int y_index=1;
  int p_index=v[0].first.first;
  vector<pair<int, string>> vv;
  for(int i=0; i<m; i++) {
    string s;
    if(p_index==v[i].first.first) {
      s=make_id(v[i].first.first);
      s+=make_id(y_index);
      vv.push_back(make_pair(v[i].second, s));
    } else {
      p_index=v[i].first.first;
      y_index=1;
      s=make_id(v[i].first.first);
      s+=make_id(y_index);
      vv.push_back(make_pair(v[i].second, s));
    }
    y_index++;
  }
  sort(vv.begin(), vv.end());
  for(auto i=vv.begin(); i!=vv.end(); i++) {
    cout<<(*i).second<<endl;
  }
  return 0;
}


Measured memory_bytes: 8944
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
int N;
vector<int> vec;

//解法
void solve() {

	int ans = 0;

	rep(i, N) {
		for (int j = i + 1; j < N; j++) {
			ans = max(ans, abs(vec[i] - vec[j]));
		}
	}

	cout << ans;

	return;
}

int main() {
	//入力
	cin >> N;
	vec.resize(N);
	rep(i, N) cin >> vec[i];
	solve();
	cout << endl;
	return 0;
}


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

using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  char m[h][w];
  char result[h][w];
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    int index = 0;
    for (int j = 0; j < w; j++) {
      m[i][j] = s[index];
      index++;
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (m[i][j] == '#') {
        result[i][j] = '#';
        continue;
      }
      int cnt = 0;

      if (i - 1 >= 0) {
        if (j - 1 >= 0 && m[i - 1][j - 1] == '#') cnt++;
        if (m[i - 1][j] == '#') cnt++;
        if (j + 1 < w && m[i - 1][j + 1] == '#') cnt++;
      }
      if (j - 1 >= 0 && m[i][j - 1] == '#') cnt++;
      if (m[i][j] == '#') cnt++;
      if (j + 1 < w && m[i][j + 1] == '#') cnt++;

      if (i + 1 < h) {
        if (j - 1 >= 0 && m[i + 1][j - 1] == '#') cnt++;
        if (m[i + 1][j] == '#') cnt++;
        if (j + 1 < w && m[i + 1][j + 1] == '#') cnt++;
      }
      result[i][j] = to_string(cnt)[0];
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << result[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
a,b,c,d,e,f = gets.split.map(&:to_i)
s=[]; w=[];
50.times do |i|
  50.times do |j|
    k = c*i + d*j
    s << k if k < f
    k = (a*i + b*j)*100
    w << k if k <= f && k > 0
  end
end
 
maxNord = 0
sumA = 0
sumS = 0
 
w.each do |i|
  s.each do |j|
    if i + j <= f
      nord = j.to_f / (i+j)
      if nord > maxNord && j*100 <= e*i
        maxNord = nord
        sumA = i + j
        sumS = j
      end
    end
  end
end
sumA = a * 100 if sumA == 0
print "#{sumA} #{sumS}"

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

#define debug(args...) \
cout << "#" << __LINE__ << ": "; \
__dbg(split(#args, ',').begin(), args);
vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}
template<typename T, typename... Args>
inline string to_str(T x) {
	stringstream ss; ss << "[";
	for (auto it = x.begin(); it != x.end(); it++) {
		if (it != x.begin()) ss << " ";
		ss << (*it);
	}
	ss << "]";
	return ss.str();
}
template<typename T, typename... Args>
inline string to_str(stack<T> x) {
	stringstream ss; ss << "[";
	bool first = 1;
	while (!x.empty()) {
		if (!first)
			ss << " ";
		ss << x.top();
		x.pop();
		first = 0;
	}
	ss << "]";
	return ss.str();
}
template<typename T> inline void __dbg_var(vector<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(list<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(set<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(unordered_set<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(stack<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(T val) { cout << val; }
inline void __dbg(vector<string>::iterator it) { cout << endl; }
template<typename T, typename... Args>
inline void __dbg(vector<string>::iterator it, T a, Args... args) {
	cout << it->substr((*it)[0] == ' ', it->length()) << "=";
	__dbg_var(a);
	cout << " ";
	__dbg(++it, args...);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
			
	int a, b, k;
	cin >> k >> a >> b;
	if (a % k == 0)
		cout << "OK\n";
	else if ((a/k+1)*k <= b)
		cout << "OK\n";
	else cout << "NG\n";
	return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void){
    double md[50]={0},lm=0,hm=0,sa=0; 
    int i,j;

    for(j=0;j<50;j++){
      if(scanf("%lf\n", &md[j])==EOF){break;}
      if(j==0){
         lm=md[0];
         hm=md[0];
       }
      if(md[j]<lm){lm=md[j];}
      else if(md[j]>hm){hm=md[j];} 

    }

   sa=hm-lm;
     printf("%.1f\n", sa);
    return 0;
}

Measured memory_bytes: 656
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c,d,ans = 0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	if(a < b)
		ans += a;
	else
		ans += b;
	if(c < d)
		ans += c;
		else
			ans += d;
			printf("%d\n",ans);
			return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
	int i,j,k,l,n,m,A[100][100],b[100],data[100]={0};
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		for(k=0;k<m;k++){
			scanf("%d",&A[i][k]);
		}
	}
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}
	l=0;
	for(i=0;i<n;i++){
		for(k=0;k<m;k++){
				data[i]+=A[i][k]*b[k];
		}
		printf("%d\n",data[i]);
	}
	return 0;
}
		


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

using i64 = long long int;

struct Icicle{
    i64 length, idx;
    bool operator<(const Icicle &obj)const{
        if(length == obj.length)return idx < obj.idx;
        return length < obj.length;
    }
};

bool can_grow(vector<i64> &v, i64 idx, i64 n){
    if(idx < 0 || idx >= n)return false;
    if(idx == 0 && v[idx] > v[idx+1])return true;
    if(idx == n-1 && v[idx] > v[idx-1])return true;
    if(v[idx] > v[idx-1] && v[idx] > v[idx+1])return true;
    return false;
}

int main(){
    i64 n, l;
    cin >> n >> l;
    vector<i64> v;
    for(i64 i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }

    priority_queue<Icicle> que;
    for(i64 i=0;i<n;++i){
        if(can_grow(v, i, n))que.push((Icicle){v[i], i});
    }

    i64 t = 0;
    while(!que.empty()){
        Icicle icicle = que.top(); que.pop();
        t = l - icicle.length;
        i64 idx = icicle.idx;
        v[idx] = 0;
        if(can_grow(v, idx-1, n))que.push((Icicle){v[idx-1] - t, idx-1});
        if(can_grow(v, idx+1, n))que.push((Icicle){v[idx+1] - t, idx+1});
    }

    cout << t << endl;

    return 0;
}



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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if ( H == 0 && W == 0 ) break;
        
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++){
                if ( (i +j) % 2 == 0 ){
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

ll sum(ll n){
  if (n <= 0){
    return 0LL;
  }
  return ((n * (n + 1LL)) / 2) % MOD;
}

ll sum(ll L, ll R){
  return (sum(R) - sum(L - 1LL) + MOD) % MOD;
}

int main(){
  FASTER;
  int n, k;
  cin >> n >> k;
  ll ans = 0;
  for (int i = k; i <= n + 1; i++){
    ll x = sum(n - i + 1, n) - sum(0, i - 1) + 1;
    if (x < 0){
      x += MOD;
    }
    x %= MOD;
    ans += x;
    ans %= MOD;    
  }
  cout << ans % MOD << "\n";
  return 0;
}


Measured memory_bytes: 3660
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        char[] d = S.toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < d.length; i++) {
            if (d[i] == 'S') {
                stack.push(d[i]);
                continue;
            }
            if (stack.empty()) {
                stack.push(d[i]);
                continue;
            }
            char x = stack.peek();
            if (x == 'S') {
                stack.pop();
                continue;
            }
            stack.push(d[i]);
        }
        System.out.println(stack.size());
    }
}


Measured memory_bytes: 29980
<?php
fscanf(STDIN, "%d %d", $n, $m);
for ($i = 0; $i < $m; $i++) {
	$s[$i] = explode(' ', trim(fgets(STDIN)));
	array_shift($s[$i]);
}
$p = explode(' ', trim(fgets(STDIN)));
$x = 0;
for ($b = 0; $b < 2 ** $n; $b++) {
	foreach ($s as $i => $a) {
		$on = 0;
		foreach ($a as $f) {
			if ($b >> ($f - 1) & 1) $on++;
		}
		if ($on % 2 != $p[$i]) continue 2;
	}
	$x++;
}
echo $x;

Measured memory_bytes: 4728
# -*- coding: utf-8 -*-

num = [int(i) for i in input()]
n = len(num)

total = 0
for s in range(2**(n-1)):
    dig = [0] * n
    dig[0] = num[0]
    for i in range(n-1):
        if (s >> i & 1):
            dig[i+1] = num[i+1]
        else:
            dig[i+1] = dig[i]*10 + num[i+1]
            dig[i] = 0
    for i in range(n):
        total += dig[i]

print(total)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;
int dp[20][20];

int saiki(vector< vector<int> > &m,int x,int y){
    if(dp[y][x] >= 0) return dp[y][x];
    if(y >= m.size()) return dp[y][x] = 1;
    if(m[y][x] == 1) return dp[y][x] = 0;
    int ret = 0;
    if(m[y][x] == 2) y++;
    else{
	if(x>0 && y+1<m.size() && m[y+1][x-1] == 0) ret += saiki(m , x-1,y+1);
	if(x+1<m[0].size() && y+1<m.size() && m[y+1][x+1] == 0) ret += saiki(m,x+1,y+1);
    }
    ret += saiki(m,x,y+1);
    return dp[y][x] = ret;
} 

int main(){
    while(true){
	int x,y;
	cin >> x >> y;
	if(x == 0 && y== 0) break;
	vector< vector<int> > m(y,vector<int>(x,0));
	memset(dp,-1,sizeof(dp));
	REP(i,y)REP(j,x)cin >> m[i][j];
	int ans = 0;
	REP(i,x){
	    ans += saiki(m,i,0);
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1220
# -*- coding: utf-8 -*-
n = int(input())
from decimal import Decimal
v = list(map(int,input().split()))
v = list(map(Decimal,v))

from heapq import heappush, heappop, heapify
heapify(v)
for _ in range(n-1):
    i1 = heappop(v)
    i2 = heappop(v)
    heappush(v,(i1+i2)/2)
print(sum(v))

Measured memory_bytes: 5588
#pragma region Template
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

#pragma endregion

int main()
{
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	ll N, A, B;
	cin >> N >> A >> B;
	vector < ll > X(N);
	REP(i, N) cin >> X[i];

	// 疲労度 徒歩：距離*A
	//           テレポート：B
	ll cost = 0;
	REP(i, N - 1)
	{
		cost += min((X[i + 1] - X[i])*A, B);
	}

	cout << cost << endl;

	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n;
	cin>>n;
	vi a(n);
	rep(i, n) cin>>a[i];
	map<int, int> m;
	rep(i, n) m[a[i]]++;
	ll ans =1LL;
	if(n & 1){
		if(m[0] != 1) ans = 0;
		for(int i = 2; i < n; i+=2){
			if(m[i] != 2) ans = 0;
			else (ans *= 2) %= MOD;
		}
	}
	else{
		for(int i = 1; i < n; i+= 2){
			if(m[i] != 2) ans = 0;
			else (ans *= 2) %= MOD;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

class union_find {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	union_find(int N) {
		parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (parent[A] < 0) return A;
		return parent[A] = root(parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		parent[A] += parent[B];
		//Bの親をAに変更する
		parent[B] = A;
 
		return true;
	}
};

int main(void)
{
    int N,M;
    cin >> N >> M;
    vector<int> X(M), Y(M), Z(M);
    union_find uf(N);
    REP(i, M){
        cin >> X[i] >> Y[i] >> Z[i];
        X[i]--;Y[i]--;
        uf.connect(X[i], Y[i]);
    }
    vector<int> ok(N, 0);
    int ans = 0;
    REP(i, N){
        if(uf.parent[i] < 0) ans++;
    }
    pr(ans);
}

Measured memory_bytes: 2176
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
}



Measured memory_bytes: 22996
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	if(s.size()&1){
		cout<<"No";RE 0;
	}
	for(int i=0;i<s.size();i+=2){
		if(s[i]!='h'||s[i+1]!='i'){
			cout<<"No";RE 0;
		}
	}
	cout<<"Yes";
	RE 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<set>
#define sqr(x) (x)*(x)
using namespace std;
string st;
int n,m,i,j,nxt[1000005],l[1000005],r[1000005],ans;
void getnxt(string st)
{
	int i,j=0;
	for (i=2;i<st.length();i++)
	{
		while (j&&st[i]!=st[j+1]) j=nxt[j];
		if (st[i]==st[j+1]) j++;
		nxt[i]=j;
	}
}
set<char> used;
int main()
{
	cin>>st;
	st=" "+st; 
	for (i=1;i<st.length();i++) used.insert(st[i]);
	if (used.size()==1)
	{
		cout<<st.length()-1<<endl<<1;
		return 0;
	}
	getnxt(st);
	for (i=1;i<st.length()-1;i++)
	{
		j=i-nxt[i];
		if (i!=j&&i%j==0)
		{
			l[i]=1;
		}
	}
	i=st.size()-1;
	j=i-nxt[i];
	if (i!=j&&i%j==0);
	else
	{
		cout<<1<<endl<<1;
		return 0;
	}
	reverse(st.begin()+1,st.end());
	getnxt(st);
	for (i=1;i<st.length();i++)
	{
		j=i-nxt[i];
		if (i!=j&&i%j==0)
		{
			r[i]=1;
		}
	}
	reverse(r+1,r+st.length());
	for (i=1;i<st.length()-1;i++)
	{
		if ((!(l[i]))&&(!(r[i+1]))) ans++;
	}
	cout<<2<<endl<<ans;
	return 0;
}

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

int main() {
  int n, k; cin>>n>>k;
  double ans=0;
  
  
  for(int i=1; i<=n; ++i){
    double p=1;
    int x=i;
    while(x<k){
      p*=0.5;
      x*=2;
    }
    ans += p/n;
  }
  
  printf("%.10f\n", ans);
}
    

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 100000

int minN(int n) {
  int six = 1;
  int nine = 1;
  while (1) {
    if (n >= six*6) {
      six *= 6;
    } else {
      break;
    }
  }
  while (1) {
    if (n >= nine*9) {
      nine *= 9;
    } else {
      break;
    }
  }
  if (six == 1) {
    return n;
  } else {
    return min(minN(n-six)+1,minN(n-nine)+1);
  }
}

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

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



  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vi D(N);
    cin >> D;
    sort(all(D));
    int a = D[N / 2 - 1];
    int b = D[N / 2];
    cout << b - a << endl;
    return (0^_^0);
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    ll x,y;
    cin >> x >> y;
    int cnt = 0;
    while(x <= y){
        x *= 2;
        cnt++;
    }
    PRINT(cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<int,int> P;

vector<int> num = {0,2,5,5,4,5,6,3,7,6};

int main(){
    int N, M; vector<int> A(9);

    cin >> N >> M;
    rep(i,M) cin >> A[i];
    sort(A.begin(), A.begin()+M, greater<int>());

    // dp[i]: マッチちょうどi本で作れる最大桁数
    vector<int> dp(10010, -1);
    dp[0] = 0;
    rep(i,N) rep(j,M){
        if(i+num[A[j]] <= N){
            dp[i+num[A[j]]] = max(dp[i+num[A[j]]], dp[i]+1);
        }
    }

    string ans;
    while(N > 0){
        rep(i,M){
            if(N-num[A[i]] >= 0 && dp[N-num[A[i]]] == dp[N]-1){
                ans.push_back(A[i] + '0');
                N -= num[A[i]];
                break;
            }
        }
        //cout << ans << " " << N << endl;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
h = np.array([int(i) for i in input().split()])

dh = np.diff(h)
ans = 0
ans_l = []
for i in range(len(dh)):
    if dh[i] <= 0:
        ans += 1 
    elif dh[i] > 0:
        ans_l.append(ans)
        ans = 0
ans_l.append(ans)

print(max(ans_l))

Measured memory_bytes: 23392
// abc062_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    vector<int> A = {1, 3, 5, 7, 8, 10, 12};
    vector<int> B = {4, 6, 9, 11};
    vector<int> C = {2};

    int x, y;
    cin >> x >> y;

    if ((find(ALL(A), x) != A.end() && find(ALL(A), y) != A.end()) ||
        (find(ALL(B), x) != B.end() && find(ALL(B), y) != B.end()) ||
        (find(ALL(C), x) != C.end() && find(ALL(C), y) != C.end())) {

        print("Yes");
    } else {
        print("No");
    }


    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#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()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;


int main(){
  string s;
  cin >> s;
  int num0 = 0, num1 = 0;
  rep(i, s.size()){
    if (s[i] == '1') num1++;
    else num0++;
  }
  cout << 2*min(num0, num1) << endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        if(X >= 400 && X <= 599) {
        	System.out.println("8");
        }else if(X >= 600 && X <= 799) {
        	System.out.println("7");
        }else if(X >= 800 && X <= 999) {
        	System.out.println("6");
        }else if(X >= 1000 && X <= 1199) {
        	System.out.println("5");
        }else if(X >= 1200 && X <= 1399) {
        	System.out.println("4");
        }else if(X >= 1400 && X <= 1599) {
        	System.out.println("3");
        }else if(X >= 1600 && X <= 1799) {
        	System.out.println("2");
        }else if(X >= 1800 && X <= 1999) {
        	System.out.println("1");
        }
	}
}

Measured memory_bytes: 35692
#include <iostream>

using namespace std;

string str[500];

int h,w,d;
void shape(int y,int x,char c){
    for(int i = 0;i < d;i++){
        int sx = x+i;
        int hb = min(i,d-i-1);
        for(int j = -hb;j <= hb;j++){
            int sy = y+j;
            if(0 <= sx && sx < w && 0 <= sy && sy < h){
                str[sy][sx] = c;
            }
        }
    }
}

int main(){
    cin >> h >> w >> d;
    for(int i = 0;i < h;i++){
        str[i] = string(w,' ');
    }
    if(d%2){
        for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                if(i%2 == 0 && j%2 == 0){
                    str[i][j] = 'R';
                }
                if(i%2 == 0 && j%2 == 1){
                    str[i][j] = 'Y';
                }
                if(i%2 == 1 && j%2 == 0){
                    str[i][j] = 'G';
                }
                if(i%2 == 1 && j%2 == 1){
                    str[i][j] = 'B';
                }
            }
        }
    }
    else{
        for(int i = 0;;i++){
            int sy = -d+i*d;
            if(sy > h+d) break;
            for(int j = 0;;j++){
                int sx = -d*2+j*d*2;
                if(i%2) sx -= d;
                if(sx > w) break;
                shape(sy,sx,'R');
                shape(sy,sx+d,'Y');
                shape(sy-d/2,sx+d/2,'G');
                shape(sy+d/2,sx+d/2,'B');
            }
        }
    }
    for(int i = 0;i < h;i++){
        cout << str[i] << endl;
    }
}

Measured memory_bytes: 768
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

void solve()
{
    IN(x);
    if (x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static int cnt = 0;
	public static int m = 0;
	public static int[] G = new int[100];

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		shellSort(array, num);

		// output
		System.out.println(m);
		//shellsortでm-1から入力しているのでm-1から出力していく
		System.out.print(G[m - 1]);
		for (int i = m - 2; i >= 0; i--) {
			System.out.print(" " + G[i]);
		}
		System.out.println();
		System.out.println(cnt);
		for (int i = 0; i < num; i++) {
			System.out.println(array[i]);
		}
		System.out.println();
		
		scan.close();

	}

	/**
	 * 挿入ソート
	 * 
	 * @param A：オリジンの配列
	 * @param N：要素の個数
	 */
	public static void insertionSort(int[] A, int N, int g) {

		for (int i = g; i < N; i++) {
			int v = A[i]; // 1枚取り出す
			int j = i - g;
			while (j >= 0 && A[j] > v) {// 取り出した一枚より前の方に持っていたカードと比較
				A[j + g] = A[j];
				j = j - g;
				cnt++;
			}
			A[j + g] = v;

		}

	}

	/**
	 * シェルソート
	 * @param A オリジンの配列
	 * @param N：要素の個数
	 */
	public static void shellSort(int[] A, int N) {
		for (int i = 1;; i = i * 3 + 1) {
			if (i > N) {
				break;
			}
			G[m] = i;		
			m++;
		}
		for (int i = m - 1; i >= 0; i--) {
			insertionSort(A, N, G[i]);
		}
	}

}



Measured memory_bytes: 299376
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let s: String = input();
    let s: Vec<char> = s.chars().collect();
    let mut goals = vec![0usize; s.len()];    

    let mut flag = false;
    let mut start = 0usize;
    for i in 0..s.len() {
        if s[i] == 'R' {
            if !flag {
                start = i;
                flag = true;
            }            
        } else {
            if flag {
                for j in start..i {               
                    goals[j] = i;
                }
            }
            flag = false;            
        }
    }
    // println!("{:?}", goals);
    flag = false;
    for i in (0..s.len()).rev() {
        if s[i] == 'L' {
            if !flag {
                start = i;
                flag = true;
            }            
        } else {
            if flag {
                for j in i+1..start+1 {               
                    goals[j] = i;
                }
            }
            flag = false;
        }
    }
    // println!("{:?}", goals);

    let mut counts = vec![0u64; s.len()];
    for i in 0..goals.len() { 
        if goals[i] < i {
            if (i - goals[i]) % 2 == 0 {
                counts[goals[i]] += 1;
            } else {
                counts[goals[i] + 1] += 1;
            }
        } else {
            if (goals[i] - i) % 2 == 0 {
                counts[goals[i]] += 1;
            } else {
                counts[goals[i] - 1] += 1;
            }
        }        
    }

    for count in counts {
        print!("{} ", count);
    }
    println!();
}


Measured memory_bytes: 6524
#include <stdio.h>
#include <math.h>

int minnum(int a, int b){
	if(a>b)	return b;
	else return a;
}

int main(void){
	int a,b;
	scanf("%d %d", &a, &b);
	
	int c[3]={1,1,1};
	c[a-1]=0;
	c[b-1]=0;
	
	if(c[0]==1)	printf("1");
	else if(c[1]==1)	printf("2");
	else if(c[2]==1)	printf("3");
	
	return 0;
	

}

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

int main()
{
  int N;
  cin >> N;
  int kosuu, oturi;
  if (N % 1000 == 0)
  {
    kosuu = N / 1000;
  }
  else
  {
    kosuu = N / 1000 + 1;
  }
  oturi = 1000 * kosuu - N;
  cout << oturi << endl;
}


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

const int Mod = 1e9+7;
int cnt[100005];

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

  ll ans = 1;
  cnt[0] = 3;
  rep(i, n) {
    ans *= cnt[a[i]] - cnt[a[i]+1];
    ans %= Mod;
    ++cnt[a[i]+1];
  }
  cout << ans << endl;
  return 0;
}

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

colors = [False for _ in range(8)]

# rate 3200+
allmite = 0
for i in range(N):
  if 1 <= A[i] <= 399:
    colors[0] = True
  elif 400 <= A[i] <= 799:
    colors[1] = True
  elif 800 <= A[i] <= 1199:
    colors[2] = True
  elif 1200 <= A[i] <= 1599:
    colors[3] = True
  elif 1600 <= A[i] <= 1999:
    colors[4] = True
  elif 2000 <= A[i] <= 2399:
    colors[5] = True
  elif 2400 <= A[i] <= 2799:
    colors[6] = True
  elif 2800 <= A[i] <= 3199:
    colors[7] = True  
  else:
    allmite += 1

colors_cnt = colors.count(True)
# if they are all allmite, the minimum number is 1, not 0.
ans_min = max(colors_cnt, 1)
ans_max = colors.count(True) + allmite

print(ans_min, ans_max)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
//#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
ll gcd(ll a,ll b){
	return (b==0?a:gcd(b,a%b));
}
int main(){
	string s;
	while(cin>>s,s!="#"){
		ll a=0,b=1;
		string q="";
		bool h=true;
		rep(i,s.size())if(s[i]=='w'){
			q="w"+q;
			i+=3;
		}else{
			q="n"+q;
			i+=4;
		}
		if(q[0]=='w')h=false;
		rep(i,q.size()){
			a*=2;
			if(!h&&q[i]=='n'||h&&q[i]=='w'){
				a+=90;
			}else{
				if(a)a-=90;
			}
			b*=2;
		}
		b/=2;
		if(!h)a=90*b-a;
		cout<<a/gcd(a,b);
		if(b/gcd(a,b)!=1)cout<<"/"<<b/gcd(a,b);
		cout<<endl;
	}
}

Measured memory_bytes: 3136
using System;

namespace ITP1_9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string W = Console.ReadLine();
            int counter = 0;

            while(true)
            {
                string sentence = Console.ReadLine();
                if (sentence == "END_OF_TEXT")
                    break;
                string sentence2 = sentence.ToLower();
                string[] word = sentence2.Split(' ');

                for (int i = 0; i < word.Length; i++)
                {
                    if (word[i] == W)
                        counter++;
                }
            }
            Console.WriteLine(counter);
        }
    }
}


Measured memory_bytes: 7644