akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

//#define TEST

void show_b(vector<vector<int>> b) {
#ifdef TEST
	for (int i = 0; i < b.size(); ++i) {
		for (int j = 0; j < 5; ++j) cout << b[i][j] << " ";
		cout << endl;
	}
#endif
}

bool solve() {
	int H; cin >> H;
	if (H == 0) return false;
	vector<vector<int>> b(H, vector<int>(5));
	for (int i = 0; i < H; ++i)
		for (int j = 0; j < 5; ++j)
			cin >> b[i][j];
	bool deleted; int res = 0;
	do {
		vector<vector<int>> newb(H, vector<int>(5, 0));
		deleted = false;
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < 5; ++j) {
				if (j >= 2 && b[i][j] == b[i][j - 1] && b[i][j - 1] == b[i][j - 2]) {
					if (b[i][j]) deleted = true;
					newb[i][j] = b[i][j];
					for (int jj = j; jj >= j - 2; --jj) {
						res += newb[i][jj];
						newb[i][jj] = 0;
					}
				}
				else newb[i][j] = b[i][j];
			}
		}
		for (int i = H - 1; i > 0; --i) {
			for (int j = 0; j < 5; ++j) {
				if (newb[i][j] == 0) {
					int ptr = i - 1;
					while (ptr >= 0 && newb[ptr][j] == 0) --ptr;
					if (ptr >= 0) {
						newb[i][j] = newb[ptr][j];
						newb[ptr][j] = 0;
					}
				}
			}
		}
		b = newb;
		show_b(b);
	} while (deleted);
	cout << res << endl;
	return true;
}

int main() {
	while (solve());
	return 0;
}


Measured memory_bytes: 3180
import sys
for l in sys.stdin:
	s=0
	d=[[0,0,5,1,10,0,50,1000,0,0,0,100,500,0][n%14]for n in map(ord,l)]
	for i,j in zip(d,d[1:]+[0]):s+=-i if i<j else i
	print s

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

int main(void){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    int arr[N+3];
    for(int i = 1; i <= N; i++){
        cin >> arr[i];
    }
    int mn = arr[1];
    int cnt = 1;
    for(int i = 2; i <= N; i++){
        if(arr[i] < mn) cnt++;
        mn = min(arr[i], mn);
    }
    cout << cnt;
}


Measured memory_bytes: 1024
num = gets.chomp!.to_i
arr = []
max = 0

num.times do|i| 
    arr[i] = gets.chomp!.to_i
    if arr[max] < arr[i]
        max = i
        arr[max] = arr[i]
    end
end
#puts "maxは#{max}だよ"
arr[max] = arr[max]/2
sum = 0
arr.each do|s|
    sum += s
end
puts sum



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

int main() {
	int h,w;cin>>h>>w;
  	string s;
  	for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
        	cin>>s;
          	if(s=="snuke"){
            	cout<<(char)(j+'A')<<i+1<<endl;
              	return 0;
            }
        }
    }
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    for(int i = a; i < a*b; i+=a){
        if(i%b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
n=input()
N=int(n[0]+n[1])
M=int(n[2]+n[3])
if 0<N<13 and 0<M<13:
    print("AMBIGUOUS")
elif 0<N<13:
    print("MMYY")
elif 0<M<13:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll n;
    ll a,b;
    ll k,t;
    cin>>n;
    while(1){
        if(is_prime(n)){
            cout<<n<<endl;
            return 0;
        }
        n++;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
	int r0, w0, c, r;
	while (1){
		cin >> r0 >> w0 >> c >> r;
		if (r0 == 0 && w0 == 0 && c == 0 && r == 0) break;
		int ans = 0;
		for (int i = 0;; i++){
			double NowCurry = (r0 + r * i) / (w0);
			if (NowCurry >= c){
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,a[100][100];
    ll dp[1<<17];
    ll use[1<<17];
    cin>>n;
    rep(i,n){
        rep(j,n){
            cin>>a[i][j];
        }
    }
    rep(bit,(1<<n)){
        rep(i,n){
            rep2(j,i,n){
                if((bit&(1<<i))&&(bit&(1<<j)))use[bit]+=a[i][j];
            }
        }
    }
    /*
    rep(bit,(1<<n)){
        for(ll mask=bit;mask>0;mask=(mask-1)&bit){
            dp[bit]=max(dp[bit],dp[bit-mask]+use[mask]);
        }
    }
    */
   rep(bit,(1<<n)){
       ll unused=bit^((1<<n)-1);
       for(ll mask=unused;mask>0;mask=(mask-1)&unused){
           dp[bit|mask]=max(dp[bit|mask],dp[bit]+use[mask]);
       }
   }
    cout<<dp[(1<<n)-1]<<endl;
    return 0;
}


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

struct UnionFind {
    vector<int> par;
    UnionFind(int n) : par(n) {
        init(n);
    }
    
    void init(int n) {
        for(int i = 0; i < n; ++i) par[i] = i;
    }
    
    int root(int x) {
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    void merge(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) return;
        
        par[x] = y;
    }
};

int main() {
    int N, M; cin >> N >> M;
    
    vector<int> a(M), b(M);
    for(int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i];
        --a[i], --b[i];
    }
    
    UnionFind uf(N);
    int res = 0;
    for(int i = 0; i < M; ++i) {
        uf.init(N);
        for(int j = 0; j < M; ++j) {
            if(i == j) continue;
            uf.merge(a[j], b[j]);
        }
        if(!uf.issame(a[i], b[i])) ++res;
    }
    
    cout << res << endl;
}


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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, a, b; cin >> n >> a >> b;
    cout << min(a * n, b) << endl;
    return 0;
}

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

void solve(){
    char x;
    cin >> x;
    //cout << (x - 'a') << endl;
    if(x - 'A' < 26) cout << 'A' <<endl;
    else cout << 'a' << endl;
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
  int N;
  cin >> N;

  vector<int> A(N);
  A.at(0) = 0;

  vector<int> B(N, 0);
  
  for(int i=1; i<N; i++){
    cin >> A.at(i);
    int j=A.at(i)-1;
    B.at(j) ++;
  }

  for(int i=0; i<N; i++){
    cout << B.at(i) << endl;
  }

  
}

Measured memory_bytes: 4844
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Map<Integer, Integer> bri = new HashMap<>();
		for(int i = 0; i < m; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(bri.containsKey(a)) {
				int val = bri.get(a);
				bri.put(a, Math.min(val, b));
			} else {
				bri.put(a, b);
			}
		}
		int ans = 0;
		while(!bri.isEmpty()) {
			int b = (int) Math.pow(10, 5);
			for(Map.Entry<Integer, Integer> e : bri.entrySet()) {
				if(e.getValue() < b) {
					b = e.getValue();
				}
			}
			ans++;
			for(int i = 1; i < b; i++) {
				if(bri.containsKey(i)) {
					bri.remove(i);
				}
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 158828
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define F          first 
#define S          second
#define mod        998244353
#define all(x) 	   x.begin(),x.end()	
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
void comp() {
	ll i,j,k,n,m,p,ind;
	cin>>n;
	double constant=6.28;
	cout<<double(n)*constant<<endl;
}

int main() {
    speedup;
    ll i=0,t;
    //cin>>t;
    t=1;
    while(t--) {
        comp();
    }
    return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> w(n);

    int sum=0;
    for(int i=0; i<n; i++) {
        cin >> w[i];
        sum += w[i];
    }

    int min=sum;
    int former=0;
    for(int i=0; i<n; i++) {
        former += w[i];
        min = (min<abs(sum-former-former)) ? min :abs(sum-former-former);
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;
using vvb=vector<vector<bool>>;
using vb= vector<bool>;
ll modpow(ll a,ll b,ll p){
	if(b==0) return 1;
	if(b%2==0){
		ll t=modpow(a,b/2,p);
		return t*t%p;
	}
	return a*(modpow(a,b-1,p))%p;
} 
//cout << fixed << setprecision(桁数);
//__builtin_popcount()
signed main(){
	ll n,m; cin>>n>>m;
	string s,t; cin>>s>>t;
	ll L=(n*m)/__gcd(n,m);
	map<ll,ll> mp;
	rep(i,0,n){
		mp[i*(L/n)]++;
	}
	rep(i,0,m){
		mp[i*(L/m)]++;
	}
	bool ok=true;
	for(auto c:mp){
		if(c.second<2)continue;
		char a=s[c.first/(L/n)];
		char b=t[c.first/(L/m)];
		if(a!=b)ok=0;
	}
	cout<<(ok ? L:-1)<<endl;


	return 0;
}


Measured memory_bytes: 14112
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;

template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
void yesno(bool c) { OUT(c ? "yes" : "no"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int H, W;
	cin >> H >> W;
	vs C(H);
	REP(i, H) {
		cin >> C[i];
	}
	REP(i, H) {
		REP(j, W) {
			cout << C[i][j];
		}
		cout << endl;
		REP(j, W) {
			cout << C[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int mn=2e5+10;
pll p[mn];
int main(){
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%lld%lld",&p[i].second,&p[i].first);
    sort(p,p+n);
    bool gud=1;
    ll cum=0;
    for(i=0;i<n;i++){
        cum+=p[i].second;
        if(cum>p[i].first)gud=0;
    }
    if(gud)printf("Yes");
    else printf("No");
}

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

using namespace std;

const int maxn = 1e5 + 30;
set<int> adj[maxn];

int main(){
  int n; cin >> n;
  for(int i=0;i<n-1;i++){
    int a,b; cin >> a >> b;
    adj[a].insert(b);
    adj[b].insert(a);
  }
  vector<int> Q;
  for(int i=1;i<=n;i++){
    if(adj[i].size() == 1){
      Q.push_back(i);
    }
  }
  while(!Q.empty()){
    int v = Q.back(); Q.pop_back();
    //cout << v << "!\n";
    int u = *adj[v].begin();
    for(int w : adj[u]){
      if(w == v) continue;
      adj[w].erase(adj[w].find(u));
      if(adj[w].size() == 0){
	cout << "First\n";
	return 0;
      }
      if(adj[w].size() == 1){
	Q.push_back(w);
      }
    }
  }
  cout << "Second\n"; 
}


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

using namespace std;

int main(){
  int price[]={100,100,100};
  int res = 700;
  string s;
  cin >> s;

  for (int i=0;i<=s.size();i++){
    if (s[i] == 'o'){
      res += price[i];
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
result = []
for i in range(0, 26):
    result.append(0)

sentinel = "\r\n" # 遇到这个就结束

while 1:
    try:
        str_in = input()
        for i in str_in:
            i = ord(i)
            if (i >= 65 and i <= 90):
                result[i - 65] += 1
            if (i >= 97 and i <= 122):
                result[i - 97] += 1
    except :
        break

for i in range(0, 26):
    print(chr(i + 97) + ' : ' + str(result[i]))


Measured memory_bytes: 5564
#include <cstdio>

const int mod = 1e9 + 7;
const int MAXN = 5005;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

struct edge
{
	int to, nxt;
}Graph[MAXN << 1];

int tmp[MAXN];
int f[MAXN][MAXN], g[MAXN];
int head[MAXN], siz[MAXN];
int N, cnt;

void sub( int &x, const int v ) { x = ( x < v ? x + mod - v : x - v ); }
void add( int &x, const int v ) { x = ( x + v >= mod ? x + v - mod : x + v ); }

void addEdge( const int from, const int to )
{
	Graph[++ cnt].to = to, Graph[cnt].nxt = head[from];
	head[from] = cnt;
}

void DFS( const int u, const int fa )
{
	f[u][1] = 1, siz[u] = 1;
	for( int i = head[u], v ; i ; i = Graph[i].nxt )
		if( ( v = Graph[i].to ) ^ fa )
		{
			DFS( v, u );
			for( int i = 0 ; i <= siz[u] + siz[v] ; i ++ ) tmp[i] = 0; 
			for( int j = siz[u] ; j ; j -- )
				for( int k = siz[v] ; ~ k ; k -- )
					add( tmp[j + k], 1ll * f[u][j] * f[v][k] % mod );
			siz[u] += siz[v];
			for( int i = 0 ; i <= siz[u] ; i ++ ) f[u][i] = tmp[i];
		}
	for( int i = 1 ; i <= siz[u] ; i ++ )
		sub( f[u][0], 1ll * f[u][i] * g[i] % mod );
}

int main()
{
	read( N );
	for( int i = 1, a, b ; i < N ; i ++ )
		read( a ), read( b ), addEdge( a, b ), addEdge( b, a );
	g[2] = 1;
	for( int i = 4 ; i <= N ; i += 2 )
		g[i] = 1ll * g[i - 2] * ( i - 1 ) % mod;
	DFS( 1, 0 );
	write( ( mod - f[1][0] ) % mod ), putchar( '\n' );
	return 0;
}

Measured memory_bytes: 56160
#include <bits/stdc++.h>
using namespace std;
int n;
int x[101];
int main()
{
    cin>>n;
    int i;
    for(i=1 ; i<=n ; i++)cin>>x[i];
    int ans=2e9;
    for(i=1 ; i<=100 ; i++){
        int t=0;
        for(int j=1 ; j<=n ; j++){
            t+=(i-x[j])*(i-x[j]);
        }
        ans=min(t,ans);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;

int main(){
	int a,b; cin>>a>>b;
	int ans=a+b;
	if(ans>23) cout<<ans-24<<endl;
	else cout<<ans<<endl;
}

Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main()
{
	vector<int> v;
	int n,a,ans=1;
	cin >> n;

	for(int i=0;i<n;i++){
		cin >> a;
		v.push_back(a);
	}	

	a=v[0];

	for(int i=1;i<n;i++){
		if(v[i]>=a)ans++;
		if(v[i]>a)a=v[i];
	}

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 5000005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{

    string str;
    cin>>str;
    lli ans=0,ct=0;
    for(lli i=0;i<3;i++)
    {
        if(str[i]=='R')
            ct++;
        else
        {
            ans=max(ans,ct);
            ct=0;
        }
    }
    ans=max(ans,ct);
    cout<<ans;
}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif    
     
     // test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N,K;
int node [100001];
list<int> edge [100001];
const int INF = 1e9;

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

	cin >> N;
	FOR(i,0,N - 1){
		int A,B;
		cin >> A >> B;
		edge [A].push_back(B);
		edge [B].push_back(A);
	}
	cin >> K;
	fill_n(node,N + 1,INF);
	priority_queue< pair< pair<int,int>,bool > > pq;
	FOR(i,0,K){
		int V,P;
		cin >> V >> P;
		pq.push(make_pair(make_pair(P,V),false));
	}

	while(pq.empty() == false){
		int p = pq.top().first.first,v = pq.top().first.second;
		bool b = pq.top().second;
		pq.pop();

		if(node [v] != INF && node [v] != p && (b == false || node [v] != p + 2)){
			cout << "No" << endl;
			return 0;
		}
		if(node [v] != INF) continue;
		node [v] = p;
		for(auto&& it : edge [v]){
			pq.push(make_pair(make_pair(p - 1,it),true));
		}
	}

	cout << "Yes" << endl;
	for(int i = 1;i <= N;i++){
		cout << node [i] << endl;
	}

	return 0;
}


Measured memory_bytes: 11636
import java.util.*;

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

        int N = sc.nextInt();
        long[] persons = new long[3*N];

        for (int i=0; i<3*N; i++) {
            persons[i] = sc.nextLong();
        }
        Arrays.sort(persons);
        
        long sum = 0;

        for (int i=N; i<3*N; i+=2) {
            sum += persons[i];
        }

        System.out.println(sum);
    }
}



Measured memory_bytes: 95776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

ll a[100006];
pair <ll,ll> t[100006];

int main(){
  ll n,m;
  int i,j;

  scanf("%lld %lld\n", &n, &m);
  for(i = 0;i < n;i++) scanf("%lld", &a[i]);
  for(i = 0;i < m;i++) scanf("%lld %lld", &t[i].second, &t[i].first);

  sort(a,a + n);
  sort(t,t + m);

  i = 0;
  j = m - 1;
  for(i = 0;i < n;i++){
    if(t[j].second == 0) j--;
    if(a[i] >= t[j].first) break;

    if(j < 0) break;

    a[i] = t[j].first;
    (t[j].second)--;
  }

  ll ans = 0;
  for(i = 0;i < n;i++){
    ans += a[i];
  }

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 2560
//IOI 2021

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

ll n, p, ans = 1;
map<ll, ll> mp;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> p;
	for (ll i = 2; i * i <= p; i++)
		while (p % i == 0)
			p /= i, mp[i]++;
	if (p > 1)
		mp[p]++;
	for (auto i : mp)
		if (i.ss >= n)
			for (int j = 0; j < i.ss / n; j++)
				ans *= i.ff;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    int h , w;
    cin >> h >> w;
    char A[h+1][w+1];
    for(int i =1 ;i <= h ; i++){
        for(int j = 1 ;j <= w; j++)
            cin >> A[i][j];
    }
    ll dp[h+1][w+1];
    memset(dp , 0 , sizeof(dp));
    dp[0][1] = 1;
    
    for(int i = 1 ;i <= h ; i++){
        for(int j = 1 ;j <= w ;j++){
            
            if(A[i][j] == '.'){
                dp[i][j] = dp[i-1][j] + dp[i][j-1];
                
                if(dp[i][j] >= Mod)
                    dp[i][j] -= Mod;
            }
        }
    }
    cout << dp[h][w] << endl;
    return 0;
}

Measured memory_bytes: 9088
PROGRAM ATCODER

implicit none
integer :: n, k, cost, i, j, check
integer,allocatable :: d(:)

read(*,*) n, k
allocate (d(k))
read(*,*) (d(i), i=1,k)


cost = n - 1
do
	check = 0
    cost = cost + 1
	do j = 1, k
        if(mod(cost,10) == d(j) .and. cost >= 1)then
	        check = 1
		end if
        if(mod(cost,100)/10 == d(j) .and. cost >= 10)then
	        check = 1
		end if
		if(mod(cost,1000)/100 == d(j) .and. cost >= 100)then
            check = 1
		end if
		if(mod(cost,10000)/1000 == d(j) .and. cost >= 1000)then
            check = 1
		end if
        if(cost/10000 == d(j) .and. cost >= 10000)then
            check = 1
		end if
	end do
    if (check == 0) then
		write(*,'(i0)') cost
		stop
	end if
end do

END PROGRAM ATCODER

Measured memory_bytes: 256
n,p=map(int,input().split())

#xの約数を列挙する
def divisor(x):
    ans=set([])
    i=1
    while(i*i<=x):
        if(x%i==0):
            ans.add(i)
            ans.add(x//i)
        i+=1
    ans=sorted(list(ans))
    return ans


#xの素因数分解
def prime_factorization(x):
    ans={}
    divisors=divisor(x)
    xi=x
    for di in divisors:
        if(xi==1):
            break
        elif(di<=1):
            continue
        else:
            dj=0
            while(xi%di==0 and xi!=1):
                xi//=di
                dj+=1
            if(dj>0):
                ans[di]=dj
    return ans

pf=prime_factorization(p)
#print(pf)
ans=1
for k,v in pf.items():
    if(v>=n):
        ans*=(k**(v//n))
print(ans)


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

int main() {
    int n;
    std::cin >> n;
    std::vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        int a;
        std::cin >> a;
        ans[a - 1] = i + 1;
    }

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            std::cout << " ";
        }
        std::cout << ans[i];
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N;cin>>N;
  set <ll> s;
  rep(i,N){
    ll st;cin>>st;
    s.insert(st);
  }

  ll ans = 0;
  for(auto it = s.begin(); it != s.end(); it++){
    ans++;
  }

  cout<<ans<<endl;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(void) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << ((a * b > c * d) ? a * b : c * d) << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
p = [int(i) for i in input().split()]

p.insert(0, 0)

wrong_list = []
for i in range(1,N+1):
  if p[i] != i:
    wrong_list.append([i,p[i]])

if len(wrong_list) == 0:
  print("YES")
elif len(wrong_list) != 2:
  print("NO")
else:
  print("YES")

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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	bool ans=0;
	if(c<=(a+b)) ans=1;
	if(c<a) ans=0;
	if(ans) cout<<"YES";
	else cout<<"NO";
	cout<<"\n";
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    int n, a, b;
    cin >> n >> a >> b;
    bool swp = false;
    if (a > b) {
        swp = true;
        swap(a, b);
    }
    /*if (a >= 2 && b <= n - 1) {
        cout << "Draw";
        return 0;
    }
    if (abs(a - b) >= 2) {
        cout << "Draw";
        return 0;
    }
    if (abs(a - b) == 1) {
        cout << "Borys";
        return 0;
    }*/
    if (abs(a - b) % 2 == 0){
        cout << "Alice";
    } else
        cout << "Borys";

    return 0;
}

Measured memory_bytes: 256
import sys
from heapq import heappop, heappush


T = int(input())
for t in range(T):
    N = int(input())
    left, right = [], []
    ans = 0
    for i in range(N):
        K, L, R = map(int, sys.stdin.readline().split())
        if L > R:
            ans += L
            left.append((K, L - R))
        elif L < R:
            ans += R
            right.append((K, R - L))
        else:
            ans += L
    # left
    pool = []
    pos = 1
    left.sort()
    cur = 0
    while cur < len(left):
        while cur < len(left) and left[cur][0] == pos:
            k, d = left[cur]
            heappush(pool, d)
            cur += 1
        while len(pool) > pos:
            d = heappop(pool)
            ans -= d
        pos += 1
            
    # right
    pool = []
    pos = N
    right.sort(reverse=True)
    cur = 0
    while cur < len(right):
        while cur < len(right) and right[cur][0] == pos:
            k, d = right[cur]
            heappush(pool, d)
            cur += 1
        while len(pool) > N - pos:
            d = heappop(pool)
            ans -= d
        pos -= 1

    print(ans)


Measured memory_bytes: 94628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	bool is_all_even = true;
	rep(i, n){
		cin >> a[i];
		if(a[i]%2 != 0) is_all_even = false;
	}
	int ans = 0;
	while(is_all_even){
		rep(i, n){
			a[i] /= 2;
			if(a[i]%2 != 0) is_all_even = false;
		}
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;

int tt[110];
double vt[50000];

int main() {
	int n, totalt = 0;
	cin >> n;
	for (int i = 0; i < 50000; i++)vt[i] = INF;

	for (int i = 0; i < n; i++) cin >> tt[i];
	for (int i = 0; i < n; i++) {
		double v; cin >> v;
		for (int j = totalt; j <= totalt + 2 * tt[i]; j++) {
			vt[j] = min(vt[j], v);
		}
		totalt += 2 * tt[i];
	}

	vt[0] = 0;
	for (int i = 1; i <= totalt; i++) {//加速分
		vt[i] = min(vt[i - 1] + 0.5, vt[i]);
	}

	vt[totalt] = 0;
	for (int i = totalt - 1; i >= 0; i--) {//減速分
		vt[i] = min(vt[i + 1] + 0.5, vt[i]);
	}
	double ans = 0;
	for (int i = 1; i <= totalt; i++) {
		ans += (vt[i] + vt[i - 1]) *0.25;
	}
	printf("%.10f\n", ans);

	return 0;
}

Measured memory_bytes: 640
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0511?year=2007

#include <bits/stdc++.h>

using namespace std;

int main() {
    bool submit[31] = {};
    
    for (int i = 0; i < 28; ++i) {
        int t;
        cin >> t;
        submit[t] = true;
    }

    for (int i = 1; i <= 30; ++i) {
        if (!submit[i]) cout << i << endl;
    }
    return 0;
}

/*
 *
 */


Measured memory_bytes: 3092
K=int(input())
A=list(map(int,input().split()))
MAX=2
MIN=2
A=A[::-1]
ans=0
for a in A:
    MIN=(MIN-1)//a*a+a
    if MIN>MAX:
        ans=-1
        break
    MAX=MAX//a*a+a-1
if ans==-1:
    print(-1)
else:
    print(str(MIN)+" "+str(MAX))

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

int main() {
  int N, k;
  cin >> N >> k;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  int Asum = 0;
  priority_queue<int> q;
  priority_queue<int> s;
  for (int i = 0; i < k + 1; i++) {
    if (i != 0 && i < N + 1) {
    Asum += v.at(i - 1);
    if (v.at(i - 1) < 0) {
      int t = 0 - v.at(i - 1);
      q.push(t);
    }
    }
    int Bsum = 0;
    priority_queue<int> r = q;
    for (int j = 0; j < k - i + 1; j++) {
      if (j != 0 && j < N + 1 - i) {
      if (v.at(N - j) < 0) {
        int s = 0 - v.at(N - j);
        r.push(s);
      }
      Bsum += v.at(N - j);
      }
      int sum = i + j;
      int sute = k - sum;
      int ABsum = Asum + Bsum;
      priority_queue<int> t = r;
      if (sute > 0 && t.size() > 0) {
      while (sute > 0 && t.size() > 0) {
        ABsum += t.top();
        t.pop();
        sute--;
      }
      }
      if (ABsum < 0) {
        ABsum = 0;
      }
      s.push(ABsum);
    }
  }
  cout << s.top() <<endl;
}

Measured memory_bytes: 256
N = int(input())

a_str = input()
a_list = [int(j) for j in a_str.split(' ')]

average = sum(a_list)/len(a_list)

fark_min = abs(a_list[0] - average)
save_list = []
for i in range(len(a_list)):
    fark = abs(a_list[i]-average)
    if fark <= fark_min:
        fark_min = fark

for i in range(len(a_list)):
    fark = abs(a_list[i] - average)
    if fark == fark_min:
        save_list.append(i)

print(min(save_list))



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t,i,j;
	cin>>t;
	string s;
	map<string,int>m;
	while(t--)
	{
		cin>>s;
		m[s]++;
	}
	cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<endl;
	cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<endl;
	cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<endl;
	cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

string TMP = "-*-TeMporARY-*-";
string str1 = "apple";
string str2 = "peach";

int main() {
  string str;
  getline(cin, str);
  string::size_type pos;
  while ((pos = str.find(str1, 0)) != string::npos) {
    str.replace(pos, str1.length(), TMP);
  }
  while ((pos = str.find(str2, 0)) != string::npos) {
    str.replace(pos, str2.length(), str1);
  }
  while ((pos = str.find(TMP, 0)) != string::npos) {
    str.replace(pos, TMP.length(), str2);
  }
  cout << str << endl;
  return 0;
}

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

int main() {
    int X; cin >> X;
    if(X >= 30){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 205
using namespace std;

typedef long long ll;
ll n, m, r, s, mn = 1e18, a[15], d[N][N], num[N], b[15];
bool v[15];
//void f(int p) {
//	int i;
//	if (p == r) {
//		s = 0;
//		for (i = 1; i < r; i++) {
//			s += d[num[i - 1]][num[i]];
//		}
//		mn = min(mn, s);
//		return;
//	}
//	for (i = 0; i < r; i++) {
//		if (v[i]) continue;
//		num[p] = a[i];
//		v[i] = true;
//		f(p + 1);
//		v[i] = false;
//	}
//}
//
int main()
{
	ll i, j, k, t1, t2, t3;
	cin >> n >> m >> r;
	for (i = 0; i <= n; i++) for (j = 0; j <= n; j++) d[i][j] = 1e9;
	for (i = 0; i <= n; i++) d[i][i] = 0;
	for (i = 0; i < r; i++) scanf("%lld", &a[i]);
	for (i = 0; i < m; i++) scanf("%lld %lld %lld", &t1, &t2, &t3), d[t1][t2] = d[t2][t1] = t3;
	for (k = 1; k <= n; k++) {
		for (i = 1; i <= n; i++) {
			for (j = 1; j <= n; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	//f(0);
	for (i = 0; i < r; i++) b[i] = i + 2;
	do {
		s = 0;
		for (i = 1; i < r; i++) {
			s += d[a[b[i - 1] - 2]][a[b[i] - 2]];
		}
		mn = min(mn, s);
	} while (next_permutation(b, b + r));
    cout << mn << endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <map>
#include <vector>
using namespace std;
char s[200010];
map<int, int> dp;
map<int, int> f;
void upd(int v, int t) {
	if (!dp.count(v) || dp[v] > t) {
		dp[v] = t;
	}
}
int main() {
	int l;
	scanf("%s", s);
	for (l = 0; s[l]; l++) ;
	int b = 0;
	for (int i = 0; i < l; i++) {
		int x = s[i] - 'a';
		f[b]++;
		b ^= 1 << x;
	}
	f[b]++;
	b = 0;
	for (int i = 0; i < l; i++) {
		int r = i == 0 ? 0 : dp[b];
		f[b]--;
		if (f[b]) {
			upd(b, r + 1);
		}
		for (int j = 0; j < 26; j++) {
			int y = b ^ (1 << j);
			if (f[y]) {
				upd(y, r + 1);
			}
		}
		int x = s[i] - 'a';
		b ^= 1 << x;
	}
	printf("%d\n", dp[b]);
	return 0;
}


Measured memory_bytes: 213120
from itertools import cycle as c

n=int(input())
for _ in range(n):
  t=input()
  l=[]
  bf=""
  for nn in map(int,t):
    if not nn:
      l.extend([bf])
      bf=""
      continue
    if not bf:
      if nn:
        kl=[
          c(".,!? "),
          c("abc"),
          c("def"),
          c("ghi"),
          c("jkl"),
          c("mno"),
          c("pqrs"),
          c("tuv"),
          c("wxyz")
        ]
        bf=next(kl[nn-1])
    else:
      bf=next(kl[nn-1])
  print("".join(l))


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

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef vector<int> vi;

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

    vi p(n);
    REP(i, n) {
        cin >> p[i];
    }

    int result = 0;
    for (int i=0; i<n-2; ++i) {
        if ((p[i] < p[i+1]) && (p[i+1] < p[i+2])) {
            ++result;
            continue;
        }
        if ((p[i+2] < p[i+1]) && (p[i+1] < p[i])) {
            ++result;
            continue;
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long m,n;
    cin>>n>>m;
    vector<long long> v(n+1);
    v[0]=0;
    for(int i=0;i<n;i++){
        cin>>v[i+1];
    }
    for(int i=0;i<n;i++){
        v[i+1]+=v[i];
    }
    for(int i=0;i<=n;i++){
        v[i]=v[i]%m;
    }
    sort(v.begin(),v.end());
    long long s=0;
    long long t=1;
    v.push_back(-1);
    for(int i=0;i<=n;i++){
        if (v[i+1]==v[i]) t++;
        else{
            s+=(t-1)*t/2;
            t=1;
        }
    }
    cout<<s;
}

Measured memory_bytes: 4788
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


enum Type{
	SMALL,
	BIG,
};

ll N;
ll max_digit;
ll POW[63],ruisekiwa[63];
map<ll,ll> MAP;

//桁を求める
ll calc_digit(){

	for(ll digit = 2;digit <= max_digit ;digit++){

		if(ruisekiwa[digit] >= N){
			return digit;
		}
	}
	return -1; //Error
}

//数字のペアを求める
ll calc_head(ll digit){

	ll tmp = N-ruisekiwa[digit-1]; //この桁の何番目か
	ll rank = 0;

	for(ll a = 1; a <= 9; a++){
		rank += 9*(POW[digit-1]-1);
		if(rank >= tmp){
			return a;
		}
	}
	return -1; //Error;
}

void func(){

	//何桁か計算
	ll digit = calc_digit();
	ll head = calc_head(digit);

	//digit桁、先頭headの何番目か
	ll diff = (N-ruisekiwa[digit-1])-(head-1)*9*(POW[digit-1]-1);

	//headが何桁連続するかを調べる
	int seq_len = 1;
	ll another;
	ll calc_digit = digit-2;
	ll work_diff = diff,rank,pre_rank;

	while(true){

		rank = 0;

		for(int i = 0; i <= 9; i++){

			pre_rank = rank;

			if(i != head){
				rank += POW[calc_digit];
			}else{ //i == head
				rank += 9*(POW[calc_digit]-1);
			}

			if(rank >= work_diff){
				another = i;
				break;
			}
		}

		if(another != head){
			diff = work_diff-pre_rank;
			break;
		}

		seq_len++;

		for(int i = 0; i < head; i++){
			work_diff -= POW[calc_digit];
		}
		calc_digit--;
	}

	diff--;

	ll table[2];

	table[BIG] = max(head,another);
	table[SMALL] = min(head,another);

	vector<Type> ANS;

	int num_big = 0,num_small = 0;

	if(head > another){
		num_big = seq_len;
		num_small = 1;

		for(int i = 0; i < seq_len; i++){
			ANS.push_back(BIG);
		}
		ANS.push_back(SMALL);

	}else{
		num_small = seq_len;
		num_big = 1;
		for(int i = 0; i < seq_len; i++){
			ANS.push_back(SMALL);
		}
		ANS.push_back(BIG);
	}

	//桁の重みの相和がdiffとなるように、BIG,SMALLを配置していく
	for(ll i = seq_len+1; i <= digit-1; i++){

		//ゾロ目は不可
		if(i == digit-1 && num_big == digit-1){
			ANS.push_back(SMALL);
			break;
		}else if(i == digit-1 && num_small == digit-1){
			ANS.push_back(BIG);
			break;
		}


		if(diff >= POW[(digit-1)-i]){
			diff -= POW[(digit-1)-i];
			ANS.push_back(BIG);
		}else{
			ANS.push_back(SMALL);
		}
	}

	for(int i = 0; i < digit; i++){
		printf("%lld",table[ANS[i]]);
	}

	printf("\n");
}

int main(){

	int count  = 1;
	for(ll i = 1; i <= 9; i++){
		for(ll k = 0; k <= 9; k++){
			if(k == i)continue;
			MAP[10*i+k] = count++;
		}
	}

	POW[0] = 1;
	for(int i = 1; i < 63; i++)POW[i] = 2*POW[i-1];

	ruisekiwa[1] = 0;
	for(ll digit = 2; ; digit++){

		ruisekiwa[digit] = 81*(POW[digit-1]-1);
		ruisekiwa[digit] += ruisekiwa[digit-1];

		if(double(ruisekiwa[digit]+81*POW[digit]) > (double)POW[62]){
			max_digit = digit;
			break;
		}
	}

	while(true){
		scanf("%lld",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3296
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include <map>
#include <set>

using namespace std;

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 100000000

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

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

bool dp[6050][6050];

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

    int res_s, res_w;
    double res_c = 0, concentration;
    REP(i, 6050){
        REP(j, 6050){
            dp[i][j] = false;
        }
    }   
    dp[100 * a][0] = true;

    for(int w = 100*a; w <= f; w++){
        for(int s = 0; s <= f-w && s <= (e*w)/100; s++){
            if(dp[w][s]){
                concentration = (double) s / (s + w);
                dp[w + 100*a][s] = dp[w + 100 * b][s] = dp[w][s + c] = dp[w][s + d] = true;
                if(res_c <= concentration){
                    res_c = concentration;
                    res_s = s;
                    res_w = w;
                }
            }
            
        }
    }

    cout << res_w + res_s << ' ' << res_s << endl;
    return 0;
}


Measured memory_bytes: 35968
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main ()
{
    int q1c = 0,q2c = 0,q3c = 0,a,b,n;
    cin >> n >> a >> b;
    for (int i = 0; i < n; ++i) {
        int p;
        scanf("%i",&p);
        if (p > b) {
            ++q3c;
        }
        else if (p > a) {
            ++q2c;
        }
        else {
            ++q1c;
        }
    }
    cout << min(q3c, min(q2c,q1c));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch WaterBottle | diff WaterBottle.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address WaterBottle.cpp && ./a.out

/*
 
 10/27/2019
 
 5:09-
 
 */

int A,B,X;

double deg2rad(double deg) { return deg*M_PI/180.0; }
void solve() {
  double res;
  double cri=0.5*A*A*B;
  if(X<=cri) res=90.0-atan(2.0*X/A/B/B)*180/M_PI;
  else res=atan(2.0/A*(1.0*B-1.0*X/A/A))*180/M_PI;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>A>>B>>X;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	#define rep(i,n) for(ll i=0;i<(n);i++)
	#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
	#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
	#define mem(u, vis) memset(u, vis, sizeof(u))
	#define ll long long
	#define ull unsigned long long
	#define MOD  1000000007
	#define MAX  1e9
	#define pb   push_back
	#define F    first
	#define S    second


	signed main() {
		ll t=1;
		//cin>>t;
		while(t--){
			ll n,m;
			cin>>n>>m;
			ll h[n+1];
			FOR(i,1,n+1) cin>>h[i];
			ll mx[n+1]={0};
			rep(i,m){
				ll a,b;
				cin>>a>>b;
				mx[a] = max(mx[a],h[b]);
				mx[b] = max(mx[b], h[a]);

			}
			ll c = 0;
			FOR(i,1,n+1){
				if(h[i]>mx[i]) c++;
			}
			cout<<c;
			
		}
		
	}

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

#define int long long

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

int mod = 1e9 + 7;
int n;
int a[100001];
int appear[100001] = {};
int fact[100002], fact_inv[100002];

int extgcd(int a, int b, int& x, int& y) {
    int d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

int mod_inverse(int a, int m) {
    int x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

int comb(int n, int r, int m) {
    if (n < 0 || r < 0 || n < r) {
        return 0;
    }
    return fact[n] * fact_inv[n - r] % mod * fact_inv[r] % mod;
}

signed main() {
    cin >> n;
    for (int i = 0; i < n + 1; i++) {
        cin >> a[i];
        appear[a[i]]++;
    }
    int l = -1, r;
    for (int i = 0; i < n + 1; i++) {
        if (appear[a[i]] == 2) {
            if (l == -1) {
                l = i;
            } else {
                r = i;
            }
        }
    }
    fact[0] = 1;
    for (int i = 1; i <= n + 1; i++) {
        fact[i] = fact[i - 1] * i % mod;
    }
    for (int i = 0; i <= n + 1; i++) {
        fact_inv[i] = mod_inverse(fact[i], mod);
    }
    for (int k = 1; k <= n + 1; k++) {
        cout << (comb(n + 1, k, mod) + mod - comb(n - r + l, k - 1, mod)) % mod << endl;
    }
    return 0;
}


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

int main(){
	int rowCount;
	int minValue;


	int currentValue = 0;
	int currentDif   = 0;
	int maxDif       = INT_MIN;

	cin >> rowCount;

	if(rowCount < 1){
		return 0;
	}

	cin >> currentValue;
	minValue = currentValue;

	for(int i = 1; i < rowCount; i++){
		cin >> currentValue;
		currentDif = currentValue - minValue;

		if(currentDif > maxDif){
			maxDif = currentDif;
		}
		if(currentValue < minValue){
			minValue = currentValue;
		}
	}
	cout << maxDif << endl;
	return 0;
}

Measured memory_bytes: 1160