akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
    int x,y,z = 0;
  	string ans = "No";
  
  	cin >> x >> y;
    
  	while(x >= 0){
      if(y == 2*x + 4*z){
        ans = "Yes";
        break;
      }
      x--;
      z++;
    }
  	cout << ans << endl;
  
}

Measured memory_bytes: 3636
import java.util.*

val sc = Scanner(System.`in`)

fun main(args : Array<String>) {
    val (n, k) = listOfInt(2)
    val hh = listOfInt(n).sorted()

    var min = Int.MAX_VALUE

    for (i in 0..n-k) {
        val diff = hh[i+k-1] - hh[i]
        if (diff < min) min = diff
    }

    println(min)
}

fun listOfInt(n: Int) = (1..n).map { sc.nextInt() }.toList()

Measured memory_bytes: 54592
N=int(input())
R=sorted([list(map(int,input().split())) for i in range(N)])
B=sorted([list(map(int,input().split())) for i in range(N)])
U=[0]*N

for c,d in B:
  i,mv,mi=0,-1,0
  for i,(a,b) in enumerate(R):
    if a<c:
      if b<d and U[i]==0 and mv<b:
        mv,mi=b,i
    else:
      break
  if mv!=-1:
    U[mi]=1

print(sum(U))


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

void solve(){

    ll n, x, t;
    cin>>n>>x>>t;
    ll an=(n+x-1)/x;
    an=(an*t);
    cout<<an<<endl;

}

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


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_
void debug_out() {cerr << endl;}
template<typename Head,typename... Tail> void debug_out(Head H,Tail... T){cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:",debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl;
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct UnionFind {
    int N;
    vector<int> parents;

    UnionFind(int _N) : N(_N){
        parents.assign(N,-1);
    }

    int find(int x) { //xの親を返す
        if (parents[x] < 0) return x;
        return parents[x] = find(parents[x]);
    }
    
    void unite(int x, int y) {  //xとyの含むグループを併合
        int px = find(x);
        int py = find(y);
        if (parents[px] > parents[py]) swap(px,py); 
        if (px != py) {
            parents[px] += parents[py];
            parents[py] = px;
        }     
    }

    bool same(int x, int y) { //x,yが同じグループにいるか判定
        return find(x) == find(y);
    }

    int size(int x) { //xと同じグループのメンバーの個数
        return -parents[find(x)];
    }
    
    vector<int> root() {//ufの根を列挙
        vector<int> res;
        for (int i = 0; i < N; i ++) {
            if (parents[i] < 0) res.push_back(i);
        }
        return res;
    }

    int group_count() { //ufのグループの数を数える
        int cnt = 0;
        for (int i = 0; i < N; i ++) {
            if (parents[i] < 0) cnt ++;
        }
        return cnt;
    }
};

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

    int N,M; cin >> N >> M;
    UnionFind uf(N);
    rep(i,M) {
        int a,b; cin >> a >> b;
        --a; --b;
        uf.unite(a,b);
    }
    cout << uf.group_count()-1 << '\n';
    return 0;
}

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

int main( int argc, char *argv[] )
{
int N;
int A;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> A;
	cout << N * N - A << endl;

	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <regex>

bool check(const std::string& buff) {
	return std::regex_match(buff, std::regex("(hi)+"));
}

void process() {
	auto buff = std::string{};
	std::getline(std::cin, buff);

	std::cout << (check(buff) ? "Yes" : "No") << std::endl;
}

int main() {
	process();
}

Measured memory_bytes: 256
N = int(input())
A = [int(_) for _ in input().split()]
increasing = False
decreasing = False
count = 1
for i in range(N - 1):
    if A[i] < A[i + 1]:
        if decreasing:
            count += 1
            increasing = False
            decreasing = False
        else:
            increasing = True
    elif A[i] > A[i + 1]:
        if increasing:
            count += 1
            increasing = False
            decreasing = False
        else:
            decreasing = True
print(count)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define For(i,a,b) for(ll i=a;i<b;i++)
#define rFor(i,a,b) for(ll i=a;i>b;i--)
#define wFor(i,a,b) for(ll i=a;i<b;i+=2)
#define wrFor(i,a,b) for(ll i=a;i>b;i-=2)
#define sort(a,b) sort(a.begin(),b.end())
#define reverse(a,b) reverse(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//(char-'0') 数字に変換
//vector<vector<int>> data(a,vector<int>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数
//ceil(log10(a)) aの10進法での桁数

int main() {
  string a;
  ci(a);
  ll b=(a[5] -'0')*10+(a[6]-'0');
  if(b<=4)
    co("Heisei");
  else
    co("TBD");
}

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

using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
struct edge{int nxt,to;}e[MAXN*8];
struct data{int x,y,id;}dat[MAXN];
int n,d,a,b,x,y,head[MAXN],vis[MAXN],cnt[MAXN],tot=0;
ll res=0;

void add_edge(int from,int to)
{
	e[++tot].nxt=head[from];e[tot].to=to;head[from]=tot;
	e[++tot].nxt=head[to];e[tot].to=from;head[to]=tot;
}

bool operator < (data a,data b)
{
	if(a.x!=b.x) return a.x<b.x;
	return a.y<b.y;
}

void solve(int k)
{
	sort(dat+1,dat+n+1);
	int cur,lst,l,r;
	for(cur=lst=l=r=1;cur<=n;cur++)
	{
		while((dat[l].x<dat[cur].x+d||dat[l].x==dat[cur].x+d&&dat[l].y<dat[cur].y-k)&&l<=n) l++;
		while((dat[r].x<dat[cur].x+d||dat[r].x==dat[cur].x+d&&dat[r].y<=dat[cur].y+k)&&r<=n) r++;
		if(l>n) break;
		cnt[dat[cur].id]+=r-l;lst=max(lst,l);
		if(lst>=r) continue;
		
		add_edge(dat[cur].id,dat[lst].id);
		for(;lst<r-1;lst++) add_edge(dat[lst].id,dat[lst+1].id);
	}
}

void dfs(int x)
{
	vis[x]=true;res+=cnt[x];
	for(int i=head[x];i;i=e[i].nxt)
		if(!vis[e[i].to]) dfs(e[i].to);
}

int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&x,&y),dat[i]={x+y,x-y,i};
	
	d=max(abs(dat[a].x-dat[b].x),abs(dat[a].y-dat[b].y));
	solve(d);
	for(int i=1;i<=n;i++) swap(dat[i].x,dat[i].y);
	solve(d-1);
	
	dfs(a);printf("%lld",res);
	return 0;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

const int N = 51;
int v[N], dp[51][51],n,k,ks;

int solve(int aa, int bb, vi &hand, int sum) {
	if(aa + bb == ks) {
		int left = k - aa - bb; vi negs;
		FOR(i, 0, hand.size()) {
			if(hand[i] < 0) negs.push_back(hand[i]);
		}
		sort(negs.begin(), negs.end());
		int sm2 = 0;
		FOR(i, 0, min(left, (int)negs.size())) {
			sm2 += negs[i];
		}
		return max(sum, sum - sm2);
	}
	int &ret = dp[aa][bb];
	if(ret >= 0) return ret;
	
	hand.push_back(v[aa]); sum += v[aa];
	ret = max(ret, solve(aa+1, bb, hand, sum));
	hand.pop_back(); sum -= v[aa];

	hand.push_back(v[n-1-bb]); sum += v[n-1-bb];
	ret = max(ret, solve(aa, bb+1, hand, sum));
	hand.pop_back(); sum -= v[n-1-bb];
	
	int left = k - aa - bb; vi negs;
	FOR(i, 0, hand.size()) {
		if(hand[i] < 0) negs.push_back(hand[i]);
	}
	sort(negs.begin(), negs.end());
	int sm2 = 0;
	FOR(i, 0, min(left, (int)negs.size())) {
		sm2 += negs[i];
	}
	ret = max(ret, sum - sm2);
	return ret;
}

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin>>n>>k; ks = min(k, n);
    FOR(i, 0, n) cin>>v[i];
    memset(dp, -1, sizeof(dp));
    vi hand;
   	cout<<solve(0,0,hand,0);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(){
    int h,w,n;
    
    scanf("%d",&h);
    scanf("%d",&w);
    scanf("%d",&n);
    
    int ans;
    if(h<=w){
        if(n%w != 0){
            ans = (n+w)/w;
        }else{
            ans = n/w;
        }
    }else{
        if(n%h != 0){
            ans = (n+h)/h;
        }else{
            ans = n/h;
        }
    }
    
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
N = int(input())
p = [int(i) for i in input().split()]
count = 0
candidates =[]
for i in range(N):
    if p[i] == i+1:
        continue
    else:
        candidates.append([i+1,p[i]])
if len(candidates) == 0:
    print("YES")
elif len(candidates) ==1:
    print("NO")
elif len(candidates) ==2:
    if candidates[0][0] == candidates[1][1] and candidates[0][1] == candidates[1][0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

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

int main(){
  int N;
  cin >> N;
  vector <int> A(N);
  int result, count;
  for(int i=0; i<N; i++){
    cin >>A[i];
  }
  for(int i=0; i<N; i++){
    while(A[i]%2 ==0){
      A[i] /=2;
      count ++;
    }
    if(i==0){
      result = count;
    }
    else if(count < result){
      result = count;
    }
    count=0;
  }
  cout << result << endl;
    
  }
  
    

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int k=Integer.parseInt(scan.next());
		long sum=0;
		for (int i=1;i<=k;++i) {
			for (int j=1;j<=k;++j) {
				for (int p=1;p<=k;++p) {
					sum+=gcd(gcd(i,j),p);
				}
			}
		}
		System.out.print(sum);
	
}
}
//end


Measured memory_bytes: 35764
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,M; cin>>N>>M;
    vector<string> a(N),b(M);
    REP(i,N) cin>>a[i];
    REP(i,M) cin>>b[i];

    for(int i=0;i+M<=N;i++){
        for(int j=0;j+M<=N;j++){
            bool ok=true;
            REP(y,M) REP(x,M){
                if(b[y][x]!=a[i+y][j+x]) ok=false;
            }
            if(ok){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
//　90min
int main(void)
{
    int n;
    int h[101] = {0};
    int a[101] = {0};
    int sum;
    int l = 0, r = 0;

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d", &h[i]);
    }

    while (1) {
        //    printf("a sum = %d \n", sum);
        //もう足さなくていいところを確認
        for (int i = 0; i < n; i++) {
            //      printf("h[%d] = %d, a[%d] = %d, l = %d\n", i, h[i],
            //      i, a[i], l);
            if (h[i] == a[i]) {
                l = i + 1;
                if (i == n - 1) {
                    printf("%d\n", sum);
                    return 0;
                }
            }
            else {
                //            printf("break h[%d] = %d, a[%d] = %d, l =
                //            %d\n", i, h[i], i, a[i], l);
                break;
            }
        }

        r = l;
        sum++;
        //どこまで足すか決める
        for (int i = l; i < n; i++) {
            if (h[i] - a[i] > 0) {
                r++;
            }
            else {
                break;
            }
            //      printf("h[%d] = %d, a[%d] = %d, r = %d\n", i, h[i],
            //      i, a[i], r);
        }

        //足す
        for (int i = l; i < r; i++) {
            a[i]++;
        }
    }

    //  printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
signed main(){
    string n;
    int ans=0;
    cin>>n;
    int d=n.size();
    int c=1;
    rep(i,d-1){
        if(i%2==0)ans+=c*9;
        c*=10;
    }
    int e=1;
    if(d%2){
        ans++;
        rep(i,d-1){
            ans+=(n[d-i-1]-'0')*e;
            e*=10;
        }
        ans+=(n[0]-'0'-1)*e;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    long long K;
    cin >> K;

    map<int, long long> count;
    int a;
    long long b;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        count[a] += b;
    }
    map<int, long long>::iterator itr = count.begin();
    while (K > 0)
    {
        K -= itr->second;
        if (K > 0)
        {
            itr++;
        }
    }
    cout << itr->first << endl;
}


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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;
const long long INF = 1LL << 60;

signed main()
{

    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n)
    {
        cin >> s[i];
    }
    map<string, int> ans;
    rep(i, n)
    {
        ans[s[i]]++;
    }

    cout << "AC x " << ans["AC"] << endl;
    cout << "WA x " << ans["WA"] << endl;
    cout << "TLE x " << ans["TLE"] << endl;
    cout << "RE x " << ans["RE"] << endl;
    return 0;
}


Measured memory_bytes: 6356
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,z,two,f,c,h,o,k,m,maxi,d,x;
	string s,w;
	cin>>n>>s;
	w=s;
	c=0;d=0;
	o=0;
	for(j=s.length()-1;j>=0;j--)
	{
		if(s[j]=='1')
		{
			o++;
		}
	}
	// cout<<o<<endl;
	two=1;
	ll a[n],b[n];
	f=0;
	for(j=s.length()-1;j>=0;j--)
	{
		if(s[j]=='1')
		{
			c=(c+two)%(o+1);			
		}
		a[d]=two;
		two=(two*2)%(o+1);
		d++;
	}
	d=0;two=1;
	f=0;
	if(o!=1)
	for(j=s.length()-1;j>=0;j--)
	{
		if(s[j]=='1')
		{
			f=(f+two)%(o-1);			
		}
		b[d]=two;
		two=(two*2)%(o-1);
		d++;
	}
	k=c;r=o;z=f;

	for(i=1;i<=n;i++)
	{
		c=k;o=r;
		f=z;
		if(s[i-1]=='0')
		{
			o++;
			c=(c+a[n-i])%o;
		}
		else
		{
			o--;
			if(o!=0)
			f=((f-b[n-i])%o+o)%o;
			c=f;			
		}
		ll ans=0;
		if(o==0)
		{
			cout<<ans<<endl;
			continue;
		}
		while(c%o!=0)
		{
			c=c%o;
			o=0;
			h=c;
			while(h!=0)
			{
				x=h%2;
				if(x==1)
					o++;
				h=h/2;
			}
			ans++; 
 
		}		
		
		cout<<ans+1<<endl;
	

	}
}



	

		

Measured memory_bytes: 6852
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < (n);++i)
#define reps(i,n) for(int i = 1;i <= (n);++i)
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin >> a >>b >> c;
	cout << ((a - b - c < 0) ? c - (a - b) : 0) << '\n';
	return 0;
}

Measured memory_bytes: 256
const long long MOD = 1e9 + 7;
const int N = 203010;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int n, a[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> b(n);
    int x = 0, y = n - 1, t = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        if (t == 0)
        {
            b[x] = a[i];
            x++;
            t ^= 1;
        }
        else
        {
            b[y] = a[i];
            y--;
            t ^= 1;
        }
    }
    forn(i, n) cout << b[i] << " ";
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 5376
s = input()
if s[0] == s[1] == s[2] == 'R':
  print(3)
elif s[0] == s[1] == 'R' or s[1] == s[2] == 'R':
  print(2)
elif s[0] == 'R' or s[1] == 'R' or s[2] == 'R':
  print(1)
else:
  print(0)

Measured memory_bytes: 8824
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int N;
int a[100010];
int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i=0; i<N; i++) {
    if (a[a[i]-1]-1 == i) ans++;
  }
  cout << ans / 2 << "\n";
  return 0;
}



Measured memory_bytes: 640
def Judge(score,a,b):
    x,y=score+a,score+b
    if x<=21 and y<=21:
        return max(x,y)
    else:
        return min(x,y)

while True:
    L=sorted(map(int,raw_input().split()))[::-1]
    if L[0]==0:break
    score=0
    t=L.count(1)
    for i in L:
        if i>10:
            score+=10
        elif i>=2:
            score+=i
        elif t==1:
            score=Judge(score,1,11)
            break
        else:
            score=Judge(score,10+t,t)
            break
    if score>21:
        print 0
    else:
        print score

Measured memory_bytes: 4248
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    ll k;
    cin >> k;
    int n = 50;
    ll x[n];
    rep(i, n) x[i] = i;

    rep(i, n){
        x[i] += (k / 50);
    }
    rep(i, k % 50){
        rep(j, 50){
            if (i == j) x[j] += 50;
            else x[j]--;
        }
    }
    cout << 50 << endl;
    rep(i, n) cout << x[i] << " ";
    cout << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n,n){
		vector<pair<pii,pii> > v;
		vint tt(2000,0);
		rep(i,n){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			v.PB(mkp(mkp(100-c,d),mkp(a,b)));
		}
		sort(ALL(v));
		// rep(i,n){
			// cout<<v[i].S.F<<" "<<v[i].S.S<<endl;
		// }
		int cnt=0;
		rep(i,n){
			bool f=false;
			if(cnt<10&&tt[v[i].S.S]<3){
				f=true;
			}
			else if(cnt<20&&tt[v[i].S.S]<2){
				f=true;
			}
			else if(cnt<26&&tt[v[i].S.S]<1){
				f=true;
			}
			if(f){
				cnt++;
				tt[v[i].S.S]++;
				cout<<v[i].S.F<<endl;
			}
		}
	}
}

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

int n;
int A[100000], B[100000];
vector<int> G[100000];

pair<int, int> rec(int from, int prev) {
  pair<int, int> ret(0, from);
  
  for (int to : G[from]) {
    if (to == prev) continue;
    auto res = rec(to, from);
    ++res.first;
    ret = max(ret, res);
  }
  return ret;
}

int far(int st) {
  return rec(st, -1).second;
}

bool dog(int from, int prev, int en, vector<int>& path) {
  if (from == en) return true;
  for (int to : G[from]) {
    if (to == prev) continue;
    path.push_back(to);
    if (dog(to, from, en, path)) return true;
    path.pop_back();
  }
  return false; 
}

vector<int> get_path() {
  int st = far(0);
  int en = far(st);
  
  vector<int> path = { st };
  dog(st, -1, en, path);
  return path;
}

bool is_cat(const vector<int>& v) {
  vector<bool> used(n, false);
  for (int i : v) {
    used[i] = true;
    for (int to : G[i]) {
      used[to] = true;
    }
  }
  
  for (int i = 0; i < n; ++i) {
    if (!used[i]) return false;
  }
  return true;
}

vector<int> sub(const vector<int> v) {
  vector<int> ret;
  ret.push_back(1);
  
  int cnt = 2;
  for (int k = 0; k < v.size(); ++k) {
    int i = v[k];
    int leaves = (int)G[i].size() - 2;
    for (int p = cnt + 1; p <= cnt + leaves; ++p) {
      ret.push_back(p);
    }
    ret.push_back(cnt);
    cnt += leaves + 1;
  }
  ret.push_back(n);
  return ret;
}

int main() {
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    A[i] = a;
    B[i] = b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<int> v = get_path();
  if (!is_cat(v)) {
    cout << -1 << endl;
    return 0;
  }
  
  v.erase(v.begin());
  v.pop_back();
  vector<int> ans;
  if (n == 2) {
    ans = { 1, 2 };
  } else if (v.size() == 0) {
    ans.push_back(1);
    for (int i = 3; i <= n - 1; ++i) {
      ans.push_back(i);
    }
    ans.push_back(2);
    ans.push_back(n);
  } else {
    ans = sub(v);
    reverse(v.begin(), v.end());
    ans = min(ans, sub(v));
  }
  
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << (i == n - 1 ? '\n' : ' ');
  }
  return 0;
}

Measured memory_bytes: 16616
void main() {
	auto X = readAs!long;

	foreach(long A; -120..121) foreach(long B; -120..121) {
		if(A^^5 - B^^5 == X) {
			writefln("%d %d", A, B);
			return;
		}
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 2892
#include<iostream>
#define max 1000000
using namespace std;
int main(){
	int i=1,k,a[max];

	cin>>k;

	a[i]=7;

	if(a[i]%k==0){
		cout<<i<<endl;
		return 0;
	}

	for(i=2;i<=k;i++){
		a[i]=(a[i-1]*10+7)%k;

		if(a[i]==0){
			break;
		}
	}

	if(i==k+1){
		cout<<-1<<endl;
	}
	else{
		cout<<i<<endl;
	}

	return 0;
}

Measured memory_bytes: 7524
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;


public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String inner = "aa";
        char mySuffix = 'a';
        char aiSuffix = 'a';
        int iteration = 50;
        Set<String> aiAnswers = new HashSet<String>();
        while(iteration-- > 0) {
            System.out.println("?" + aiSuffix + inner + mySuffix);
            String aiAnswer = sc.next();
            if(aiAnswer.charAt(0) != mySuffix || !aiAnswers.add(aiAnswer)) {
                System.out.println("!OUT");
                return;
            }
            aiSuffix = aiAnswer.charAt(aiAnswer.length() - 1);
            inner = new StringBuilder().append(inner.charAt(0)).append((char)(inner.charAt(1) + 1)).toString();
            if (inner.charAt(1) == 'z' + 1) inner = "ba";
        }
        throw new IllegalStateException();
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if (x==y)
        cout<<"Draw";
    else if (x==1)
        cout<<"Alice";
    else if (y==1)
        cout<<"Bob";
    else if (x>y)
        cout<<"Alice";
    else if (y>x)
        cout<<"Bob";

return 0;
}




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

import collections
A_tuple = collections.Counter(A).most_common()[::-1]

if len(A_tuple) < K:
    print(0)
else:
    ans = 0
    for i in range(len(A_tuple)-K):
        ans += A_tuple[i][1]
    print(ans)

Measured memory_bytes: 39348
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    int cnt=0;
    int maxcnt=0;
    cin >> S;
    for (int i=0;i<S.length();i++){
        if (S[i]!='A' && S[i]!='T' && S[i]!='C' && S[i]!='G'){
            maxcnt = max(cnt,maxcnt);
            cnt=0;
        } else{
            cnt++;
        }
    }
    maxcnt=max(cnt,maxcnt);
    cout << maxcnt;
} 

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

namespace ConsoleApplication59
{
    class Program
    {
        static void Main()
        {
            Console.ReadLine();
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.ReadLine();
            int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int S = 0;
            for(int C = 0; C < B.Length; C++)
            {
                if (B[C] > A[A.Length / 2])
                {
                    for (int D = A.Length-1; D>-1; D--)
                    {
                        if (B[C] == A[D]) { S++; break; }
                    }
                }
                else
                {
                    for (int D = 0; D < A.Length; D++)
                    {
                        if (B[C] == A[D]) { S++; break; }
                    }
                }
            }
            Console.WriteLine(S);
        }
    }
}

Measured memory_bytes: 21420
X, K, D = map(int, input().split())

N = abs(X)//D

if X == 0:
    if K%2 == 1:
        print(D)
    else:
        print(0)
else:
    if N <= K:
        rest = K - N
        if X > 0:
            X -= D * N
            if rest == 0:
                print(abs(X))
            else:
                if rest%2 == 1:
                    print(abs(X-D))
                else:
                    print(abs(X))
        elif X < 0:
            X += D * N
            if rest == 0:
                print(abs(X))
            else:
                if rest%2 == 1:
                    print(abs(X+D))
                else:
                    print(abs(X))
    else:
        if X > 0:
            print(abs(X-D*K))
        elif X < 0:
            print(abs(X+D*K))

Measured memory_bytes: 9228
#include<stdio.h>
int main()
{
    long long int i,j=1000000007,l,k;
    while(scanf("%lld",&l)!=EOF)
    {
        k=1;
        for(i=1;i<=l;i++)
            k=k*i%j;
        printf("%lld\n",k);
    }
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

void ignore() {
    while (getchar() != '\n');
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    ll N;

    scanf("%lld", &N);

    vector<ll> A(N);
    vector<ll> sizes(N);
    ll ans = 0;
    ll size;

    ll i, j;

    for (i = 0; i < N; i++) scanf("%lld", &A[i]);

    sort(A.begin(), A.end());

    size = A[0];
    sizes[0] = size;

    if (A[1] <= size * 2) ans++;

    for (i = 1; i < N; i++) {
        size = A[i];
        sizes[i] = size;
        sizes[i] += sizes[i - 1];

        if (i + 1 < N) {
            if (A[i + 1] <= sizes[i] * 2) ans++;
            else ans = 0;
        } else {
            ans++;
        }
    }


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

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p = 1000000007;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    double p[n];
    for(ll i = 0;i < n;i++){
    	cin >> p[i];
    }
    double dp[n][n+1];
    memset(dp,0,(n*(n+1))*sizeof(double));
    dp[0][0] = 1-p[0];
    for(ll i = 1;i < n;i++){
    	dp[i][0] = dp[i-1][0]*(1-p[i]);
    }
    dp[0][1] = p[0];
    for(ll i = 1;i < n;i++){
    	for(ll j = 1;j <= i+1;j++){
    		dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
    	}
    }
    double ans = 0;
    for(ll i = ceil((double)n/2);i <= n;i++){
    	ans += dp[n-1][i];
    }
    cout << setprecision(18) << fixed << ans << endl;
}


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

using ll = long long; 
using P = pair<int,int>;

int main() {

  string s;
  cin >> s;

  int count = 0;
  int ans = 0;
  int N = s.size();
  rep(i,N){
    count = 0;
    if (s.at(i)== 'A' || s.at(i)== 'T' || s.at(i)== 'C' ||s.at(i)== 'G'){
      count++;
      rep(j,N-i-1){
        if (s.at(i+j+1)== 'A' || s.at(i+j+1)== 'T' || s.at(i+j+1)== 'C' ||s.at(i+1+j)== 'G'){
          count++;
        }
        else {
          break;
        }
      }
      ans = max(ans, count);
    }
  }

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



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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

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

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n;
    cin >> n;
    map<int, int> a;
    int x;
    ll sum = 0;
    rep(i, n) {
        cin >> x;
        if(a.count(x))
            a[x]++;
        else
            a[x] = 1;
        sum += x;
    }

    int q, b, c;
    cin >> q;
    rep(i, q) {
        cin >> b >> c;
        if(a.count(b)) {
            if(a.count(c)) {
                a.at(c) += a[b];
            } else {
                a[c] = a[b];
            }
            sum += a[b] * (c - b);
            a.erase(b);
        }
        cout << sum << endl;
    }
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

template <class T>
inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


Measured memory_bytes: 6480
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include<queue>
#include <sstream>
#include <set>
typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
using namespace std;
int main(){
    int N; cin >> N;
    int ans=0;
    vector<string> vec(3);

    REP(i,3){
        cin >> vec[i];
    }
    
    REP(i,N){
        map<char,int> mp;
        mp[vec[0][i]]++;
        mp[vec[1][i]]++;
        mp[vec[2][i]]++;
        bool fl = true;
        for(auto x:mp){
            if(x.second==3){
                fl = false;
                break;
            }else if(x.second==2){
                ans++;
                fl = false;
                break;
            }
        }
        if(fl){
            ans += 2;
        }

    }

    cout <<ans<<endl;
}

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

using namespace std;
#define int long long
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim>
struct rge {
    c b, e;
};

sim> rge<c> range(c i, c j) { return rge<c>{i, j}; }

sim> auto dud(c *x) -> decltype(cerr << *x, 0);

sim> char dud(...);

struct debug {
#ifndef LOCAL

    ~debug() {
        cerr << endl;
    }

    eni(!=) cerr << boolalpha << i;
        ris;
    }

    eni(==) ris << range(begin(i), end(i));
    }

    sim, class b dor(pair<b, c> d) {
        ris << "(" << d.first << ", " << d.second << ")";
    }

    sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
            *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
    }

#else
    sim dor(const c &)
    {
        ris;
    }
#endif
};

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve();

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
//    test
    solve();
    return 0;
}

void solve() {
    double d, t, s;
    cin >> d >> t >> s;
    d / s <= t ? cout << "Yes\n" : cout << "No\n";
}

Measured memory_bytes: 3676
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({a*c, a*d, b*c, b*d});
}



















Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int ans = 0;
  ans = max(ans, A*10+B+C);
  ans = max(ans, A+B*10+C);
  ans = max(ans, A+B+C*10);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int N=1e9+7;

int main()
{
    int n,i;
    long long int s=1;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        s=s*i%N;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int homeworks = sc.nextInt();
        int days = 0;
        for (int i = 0; i < homeworks; i++) days += sc.nextInt();
        System.out.println(Math.max(-1, n - days));
    }
}

Measured memory_bytes: 46372
import java.util.*;
public class Main{

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        
        while(true){
            int h = Integer.parseInt(sc.next());
            int w = Integer.parseInt(sc.next());
            
            if(h==0 && w==0)break;
            
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    //1行目と最終行の場合は全部#
                    if(i==0 || i==h-1) System.out.print("#");
                    //上記以外の行の場合
                    else{
                        //1列目と最終列の場合は#
                        if(j==0 || j==w-1) System.out.print("#");
                        //上記以外の列は.
                        else System.out.print(".");
                    }
                    
                }
                System.out.println("");
            }
            System.out.println("");
        }


        


    }

}



Measured memory_bytes: 34944
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)     for(lint i=n-1;i>=0;--i)
#define REPR1(i,n)    for(lint i=n;i>0;--i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in();
	vector<int>a(n);
	REPC(&i, a)i = in();
	int m = in();
	vector<int>b(m);
	REPC(&i, b)i = in();
	cout << (includes(a.begin(), a.end(), b.begin(), b.end()) ? 1 : 0) << endl;
}


Measured memory_bytes: 4300
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int K;
int A[100010];

void solve(int p, int q) {
    if (A[p] <= q) return;
    A[p] = q;
    //cout << "A[" << p << "] = " << A[p];
    solve((p * 10) % K, q);
    solve((p + 1) % K, q + 1);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K;
    rep(i, K+1) A[i] = 99;
    solve(1, 1);
    cout << A[0] << endl;

    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy){
		x=xx;
		y=yy;
	}
	Point operator +(Point p){
		return Point(x+p.x,y+p.y);
	}
	Point operator -(Point p){
		return Point(x-p.x,y-p.y);
	}
	Point operator *(double a){
		return Point(a*x,a*y);
	}

	Point operator/(double a){
		return Point(x/a,y/a);
	}
	double abs(){
		return sqrt(norm());
	}
	double norm(){
		return x*x+y*y;
	}
	bool operator ==(const Point &p)const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};

typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(){}
	Segment(Point pp1,Point pp2){
		p1=pp1;
		p2=pp2;
	}
};

typedef Segment Line;

double norm(Vector v){
	return v.x*v.x+v.y*v.y;
}

double dot(Vector a,Vector b){
	return a.x*b.x+a.y*b.y;
}

double cross(Vector a,Vector b){
	return a.x*b.y-a.y*b.x;
}

Point project(Segment s,Point p){
	Vector base=s.p2-s.p1;
	double r=dot(p-s.p1,base)/norm(base);
	return s.p1+base*r;
}

Point reflect(Segment s,Point p){
	return p+(project(s,p)-p)*2.0;
}

Point getLineCrossPoint(Line l1,Line l2){
	Vector base=l1.p2-l1.p1;
	double a=cross(l2.p2-l2.p1,base);
	double b=cross(l1.p1-l2.p1,base);
	return l2.p1+(l2.p2-l2.p1)*b/a;
}

struct data{
	Line l;
	Point p;
	int type;
	data(){}
	data(Point p1){
		p=p1;
		type=0;
	}
	data(int i){
		type=i;
	}
	data(data d1,data d2){
		if(d1.type==-1){
			p=d2.p;
			l=d2.l;
			type=d2.type;
		}else if(d2.type==-1){
			p=d1.p;
			l=d1.l;
			type=d1.type;
		}
		if(d1.type==0 && d2.type==0){
			l=Line(d1.p,d2.p);
			type=1;
		}
		if(d1.type==1 && d2.type==0){
			p=reflect(d1.l,d2.p);
			type=0;
		}
		if(d1.type==0 && d2.type==1){
			p=reflect(d2.l,d1.p);
			type=0;
		}
		if(d1.type==1 && d2.type==1){
			p=getLineCrossPoint(d1.l,d2.l);
			type=0;
		}
	}
};


typedef string::const_iterator State;
data expression(State &begin);

double number(State &begin){
	double ret=0;
	int flag=0;
	if(*begin=='-'){
		flag=1;
		begin++;
	}
	while(isdigit(*begin)){
		ret*=10.0;
		ret+=(double)(*begin-'0');
		begin++;
	}
	if(flag==1)ret=-ret;
	return ret;
}

bool isnumber(State &begin){
	if(*begin=='-' || isdigit(*begin))return true;
	return false;
}

data factor(State &begin){
	if(*begin=='('){
		begin++;
		data d=expression(begin);
		begin++;
		return d;
	}else if(isnumber(begin)){
		double d1=number(begin);
		begin++;
		double d2=number(begin);
		return data(Point(d1,d2));
	}else{
		return data(-1);
	}
}

data expression(State &begin){
	data d=factor(begin);
	while(1){
		if(*begin=='@'){
			begin++;
			d=data(d,factor(begin));
		}else{
			break;
		}
	}
	return d;
}


int main(void){
	while(1){
		string str;
		cin >> str;
		if(str=="#")break;
		State s=str.begin();
		Point ans=expression(s).p;
		printf("%.10f %.10f\n",ans.x,ans.y);
	}
	return 0;
}


Measured memory_bytes: 3148
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def s_inpl(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
INF = float("inf")

S = input()

a = S.count("BW")
b = S.count("WB")

print(a+b)

Measured memory_bytes: 39280