akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

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

    int l, r;
    cin >> l >> r;
    int d = r - l + 1;
    int mn = 2019;
    l = l % 2019;
    r = r % 2019;
    int a, b, c;
    if (d < 2019) {
        rep(i,d) rep(j,i) {
            a = (l + j) % 2019;
            b = (l + i) % 2019;
            c = (a * b) % 2019;
            mn = min(mn,c);
        }
    }
    else mn = 0;
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    int r=0;
    int l = 0;
    int answer=0;
    while(r<n){
        while(r<n&&s[r]=='1')
            r++;
        answer = max(answer,r-l);
        while(r<n&&s[r]=='0')
            r++;
        k--;
        if(k<0){
            while(l<n&&s[l]=='1')
                l++;
            //answer = max(answer,r-l);
            while(l<n&&s[l]=='0')
                l++;
        }
        answer = max(answer,r-l);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
        boolean hyaku=false;
        boolean ju=false;
        boolean iti=false;
        int result=0;
        for(int i=0; i<10; i++){
            for(int k=0; k<10; k++){
                for(int l=0; l<10; l++){
                    for(int m=0; m<N; m++){
                        if(hyaku==false && Character.getNumericValue(S[m])==i){
                           hyaku=true;
                           continue;
                        }
                        if(hyaku==true && ju==false && Character.getNumericValue(S[m])==k){
                           ju=true;
                           continue;
                        }
                        if(hyaku==true && ju==true && iti==false && Character.getNumericValue(S[m])==l){
                           iti=true;
                           break;
                        }
                    }
                if(hyaku && ju && iti){
                result++;
                }
                  hyaku=false;
                  ju=false;
                  iti=false;
                }
            }
        }
		System.out.println(result);
	}
}


Measured memory_bytes: 37484
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  long a, b, x;
  rd(a, b, x);

  long mod = 1_000_000_000 + 7;
  auto k = (x - a + 1 + (a - b - 1)) / (a - b);
  if (k < 0) {
    k = 0;
  }
  auto ans = x % mod + (k % mod) * (b % mod);
  writeln(ans % mod);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}



Measured memory_bytes: 2448
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n,n){
        list<pair<int,pair<int, int>>> ls;
        ls.push_back(make_pair(-1,make_pair(-1,-1)));

        rep(i,n){
            char com;
            cin >> com;
            if(com == 'W'){
                int a, b;
                cin >> a >> b;
                auto cur = ls.begin();
                auto bef = ls.begin();
                cur++;
                while(b > 0){
                    int tmp = bef->second.second + 1;
                    if(cur == ls.end()){
                        ls.push_back(make_pair(a,make_pair(tmp, tmp + b - 1)));
                        b = 0;
                    }else if(bef->second.second + 1 != cur->second.first){
                        int dif = cur->second.first - bef->second.second - 1;
                        if(b <= dif){
                            ls.insert(cur,make_pair(a,make_pair(tmp,tmp + b - 1)));
                            b = 0;
                        }else{
                            ls.insert(cur,make_pair(a,make_pair(tmp,cur->second.first - 1)));
                            b -= dif;
                        }
                        cur--;
                        bef = cur;
                        bef--;
                    }
                    cur++;
                    bef++;
                }
            }else if(com == 'D'){
                int a;
                cin >> a;
                for(auto it = ls.begin(); it != ls.end();){
                    if(it->first == a){
                        it = ls.erase(it);
                    }else{
                        it++;
                    }
                }
            }else{
                int a;
                cin >> a;

                bool f = false;
                for(auto it:ls){
                    if(it.second.first <= a && a <= it.second.second){
                        cout << it.first << endl;
                        f = true;
                        break;
                    }
                }
                if(not f) cout << -1 << endl;
            }
            //for(auto it : ls){ cout << it.second.first << ' ' << it.second.second << endl; }
        }
        cout << endl;
    }
}

Measured memory_bytes: 3252
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let k = get!();
    let mut ans = 0;
    for i in 1..k+1 {
    	for j in 1..k+1 {
        	if i % 2 == 1 && j % 2 == 0 {
            	ans += 1;
            }
        }
    }
    
    println!("{}", ans);
}

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

using namespace std;

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

#define INF (1<<(4*4-1))
#define MOD 1000000007

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

   string s;
   cin>>s;

   bool ok = false;
   int first,second;
   for(int i=0;i<s.size()-1;i++){
      if(s[i]==s[i+1]){
         ok = true;
         first = i;
         second = i+1;
      }
      if(i<s.size()-2 && s[i]==s[i+2]){
         ok = true;
         first = i;
         second = i+2;
      }
   }

   if(ok)cout<<first+1<<" "<<second+1<<endl;
   else cout<<-1<<" "<<-1<<endl;
   return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

inline void solve(){

    string s;
    cin >> s;

    if(s.size()==2){
        if(s[0]==s[1]) cout << 1 __ 2 << endl;
        else cout << -1 __ -1 << endl;
        return ;
    }
    
    for(int i = 0; i < s.size()-2; i++) {
        if(s[i]==s[i+1] || s[i]==s[i+2] || s[i+1] == s[i+2]){
            cout << i+1 __ i+3 << endl;
            return ;
        }
        
    }

    cout << -1 __ -1 << endl;
    
}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 512
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 
#define hash puper123

const int N = 752;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int n, a[N], p;

ll dp[N][2];

void solve() {
  cin >> n >> p;
  for (int i = 1;i <= n;i++) {
    cin >> a[i];
    a[i] %= 2;
  }
  dp[0][0] = 1;
  for (int i = 1;i <= n;i++) {
    for (int j = 0;j < 2;j++) {
      dp[i][j] += dp[i - 1][j];
      dp[i][j ^ a[i]] += dp[i - 1][j];
    }
  }
  cout << dp[n][p] << endl;
}

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
  #endif 
  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException
    {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int sum = 0;
        do{
        String line = reader.readLine();
        for(int i = 0;i < line.length();i++){


        char c = line.charAt(i);
        int a = 0;
        a = c - '0';
        sum = sum + a;

            if(sum != 0 && i == line.length() - 1){
                System.out.println(sum);
            }
            if(sum == 0){
                break;
            }

        }
            if(sum == 0){
                break;
            }
            sum = 0;
        }while(true);

    }
}



Measured memory_bytes: 24316
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations
from random import random

import numpy as np

sys.setrecursionlimit(200000)


class Solver:
    def __init__(self):
        pass

    def input(self):
        """
            faster input function than builtin stdin.
        """
        return sys.stdin.readline()[:-1]

    def ii(self, t: type = int):
        """
            input single value.
        """
        return t(self.input())

    def il(self, t: type = int):
        """
            input single line.
        """
        return list(map(t, self.input().split()))

    def imi(self, N: int, t: type = int):
        return [self.ii(t) for _ in range(N)]

    def iml(self, N: int, t: type = int):
        return [self.il(t) for _ in range(N)]

    def solve(self):
        a, b = self.il()
        return a - 2 * b if a > 2 * b else 0


if __name__ == "__main__":
    solver = Solver()
    print(solver.solve())


Measured memory_bytes: 23572
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
using namespace std;

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;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int A,B,C,D; cin>>A>>B>>C>>D;
    cout << min(A,B)+min(C,D) << endl;
    
}



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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    string s; cin >> s;
    reverse(s.begin(),s.end());
    int i = 0;
    while(i < s.size()) {
        if(s.substr(i, 7)=="remaerd") {
            i += 7;
            continue;
        }
        if(s.substr(i, 6)=="resare") {
            i += 6;
            continue;
        }
        if(s.substr(i, 5)=="maerd" || s.substr(i, 5)=="esare") {
            i += 5;
            continue;
        }
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define ref goto refrain

class dice{
	public:
	int o,u,s,e,n,w;//over,under,south,east,north,west
	void change(char a);
};
void dice::change(char a){
	int tem=o;
	if(a=='S'){
		o=n;	n=u;	u=s;	s=tem;
	}
	else if(a=='E'){
		o=w;	w=u;	u=e;	e=tem;
	}
	else if(a=='N'){
		o=s;	s=u;	u=n;	n=tem;
	}
	else if(a=='W'){
		o=e;	e=u;	u=w;	w=tem;
	}
	else{
		cout<<"Error!"<<endl;
		exit(0);
	}
}
		

int main(){
	dice a;
	cin>>a.o>>a.s>>a.e>>a.w>>a.n>>a.u;
	char com[100];
	cin>>com;
	int m=strlen(com);
	for(int i=0;i<m;i++){
		a.change(com[i]);
	}
	cout<<a.o<<endl;
	return 0;
}

Measured memory_bytes: 1168
#include <cstdio>
int main()
{
    long long a, b, n;
    scanf("%lld%lld%lld", &a, &b, &n);
    if (n >= b - 1)
        printf("%lld\n", a * (b - 1) / b);
    else
        printf("%lld\n", a * n / b);
    return 0;
}

Measured memory_bytes: 1732
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  double x, h;
  while (cin >> x >> h, x) {
    cout << prec(8) << x * x + x * hypot(h, x / 2) * 2 << endl;
  }
}

Measured memory_bytes: 3228
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return "".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def nibu(a,b,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2
        if ll == mid:
            return ll
        co = mid * a
        mm = mid
        while mm != 0:
            co += b
            mm //= 10 
        if co >= r:
            rr = mid-1
        else:
            ll = mid


n = onem()

kkk = [[] for i in range(n)]

for i in range(n-1):
    a,b = m()
    kkk[a-1].append([b-1,i+1])
    kkk[b-1].append([a-1,i+1])
de = cl.deque([[0,0,0]])
kk= []
while de:
    j,k,p = de.popleft()
    co = 1
    for i in range(len(kkk[j])):
        if not kkk[j][i][0] == k:
            if co == p:
                co += 1
            de.append([kkk[j][i][0],j,co])
            kk.append([co,kkk[j][i][1]])
            co += 1

kk.sort(key = lambda x:x[1])

print(max(kk,key = lambda x:x[0])[0])

for i in range(n-1):
    print(kk[i][0])





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

const int N = 110;
const int mod = 998244353;

typedef long long LL;

map<string, int> f, g;

int solve(string s);

vector<int> divs[N];

int fold(string s) {
    if (s.size() == 1) return 1 + (s[0] == '1');
    if (f.count(s)) return f[s];
    int res = 0;
    for (auto l : divs[s.size()]) {
        string tmp;
        for (int i = 1; i <= l; i++) {
            bool flag = true;
            for (int j = i; flag && j <= s.size(); j += l)
                if (s[j - 1] != '1') flag = false;
            if (flag) tmp += '1';
            else tmp += '0';
        }
        res = (res + solve(tmp)) % mod;
    }
    return f[s] = res;
}

int solve(string s) {
    if (s.size() == 0) return 1;
    if (s.size() == 1) return 1 + (s[0] == '1');
    if (g.count(s)) return g[s];
    int res = 0; 
    for (int i = 1; i <= s.size(); i++) {
        string L, R;
        for (int j = 1; j <= s.size() - i; j++) L += s[j - 1];
        for (int j = s.size() - i + 1; j <= s.size(); j++) R += s[j - 1];
        res = (res + (LL)solve(L) * fold(R)) % mod;
    }
    return g[s] = res;
}

int main() {
    string s; cin >> s;
    for (int i = 1; i <= N - 10; i++)
        for (int j = i * 2; j <= N - 10; j += i) divs[j].push_back(i);
    printf("%d\n", solve(s));
    return 0;
}

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

int main()
{
	unsigned long long a[100] = { 0 }, t = 0;

	cin >> a[0] >> a[1];

	if (a[0] < a[1]) {
		t = a[0];
		a[0] = a[1];
		a[1] = t;
	}

	a[2] = a[0] % a[1];
	int i = 2;

	while (a[i] > 0) {
		a[i + 1] = a[i - 1] % a[i];
		i++;
	}

	cout << a[i - 1] << endl;
		
	return 0;
}

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

int main(void) {
    string s;
    cin >> s;
    int s_len = s.length();
    if (s[s_len-1] != 's') {
        s += 's';
    }
    else {
        s += "es";
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}


typedef vector<int> V;
typedef vector<V> Graph;
Graph g(112345);
bool res=false;

int dfs(int v,int p){
    int ans=0;
    for(auto &u:g[v])
        if(p!=u){
            int latte=dfs(u,v);
            if(latte==0){
                if(ans==1)res=true;
                else ans=1;
            }
        }
    return ans;
}
int main(){
    int N;
    cin>>N;
    V c(N+1,0);
    REP(i,N-1){
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    int latte=dfs(1,1);
    if(latte==0)res=true;
    if(res)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	
	int n;
	cin >> n;

	string c;
	cin >> c;

	int left = 0;
	int right = n-1;
	int ans = 0;
	while(left < right){
		while(c[left] == 'R'){
			if(left > n-2){
				break;
			}
			left++;
		}
		while(c[right] == 'W'){
			if(right < 1){
				break;
			}
			right--;
		}

		if(right < 1 || left > n-2) break;
		if(left >= right) break;
		
		c[left] = 'R';
		c[right] = 'W';
		left++;
		right--;
		ans++;
	}

	//cout << c << endl;

	cout << ans << endl;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

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

#define _ ios_base::sync_with_stdio(0);cin.tie(0);

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main(int argc, char *argv[]) { _
    ll n, a, b, passed = 0, over = 1;
    string s;
    bool passou;

    cin >> n >> a >> b;
    cin >> s;

    for (auto i : s) {
        passou = false;
        if (i == 'a') {
            if (passed < a + b) {
                passed++;
                passou = true;
            }
        }
        else if (i == 'b') {
            if (passed < a + b) {
                if (over <= b) {
                    passed++;
                    passou = true;
                }
            }
            over++;
        }
        else {
            passed = passed;
            passou = false;
        }
        if (passou) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 848
#include<bits/stdc++.h>
using namespace std;
#define ll float
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define OK cout<<"OK";
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n,m,i=0;
    ll sum=0.0;
    cin>>n>>m;
    ll a[n];
    while(i<n)
    {
        cin>>a[i];
        sum+=(a[i]*1.0);
        i++;
    }
    sum=sum*1.0/(4.0*m);
    sort(a, a+n, greater<ll>());
    if(a[m-1]>=sum)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
ll A[5000001],bin[5000001];

map<ll,ll>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/* Precode Start Here *\



     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
ll vis[300001];
vector<ll>v[300001];
vector<ll>edge[300001];
void dfs(ll start,ll parent)
{
    ll cnt=1;
    vis[start]=1;
    for(int i=0;i<v[start].size();i++)
    {
        ll u=v[start][i];
        if(vis[u]==0){
        if(cnt==parent)
            cnt++;
        ll edges=edge[start][i];
        myMap[edges]=cnt;
        cnt++;
        dfs(u,cnt-1);
        }
    }
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
  ll n,kotoboro=0,a,b;
  cin>>n;
  for(int i=0;i<n-1;i++)
  {
      cin>>a>>b;
      v[a].push_back(b);
      v[b].push_back(a);
      edge[a].push_back(i+1);
      edge[b].push_back(i+1);
      ll d=v[a].size();
      kotoboro=max(kotoboro,d);
      d=v[b].size();
      kotoboro=max(kotoboro,d);
  }
  dfs(1,0);
  cout<<kotoboro<<endl;
  for(int i=1;i<n;i++)
  {
      cout<<myMap[i]<<endl;
  }
return 0;
}



Measured memory_bytes: 32640
#include<bits/stdc++.h>
using namespace std;
#define MAX 10005
set<int> G[MAX];
int n,m,x,y,R;
int main(){
  while(1){
    scanf("%d %d %d",&n,&m,&R);
    if(n==0&&m==0)break;
    for(int i=0;i<MAX;i++)
      G[i].clear();
    
    for(int i=0;i<n;i++){
      scanf("%d %d",&x,&y);
      G[x].insert(y);
    }
    
    int ans=0;
    while(m--){
      scanf("%d %d",&x,&y);
      set<int> :: iterator it,it2;
      for(int px=x-R*4;px<=x+R*4;px++){
        if(px<0||MAX<=px)continue;
        
        int py=y-R*4;
        it=G[px].lower_bound(py);
        it2=G[px].end();
        while(it!=it2 && (*it)<= y+R*4){
          int X=px-x;
          int Y=(*it)-y;
          if( 16*R*R >= X*X+Y*Y ){
            ans++;
          }
          it++;
        }
        
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 6340
program time_gap
  implicit none
  integer :: n, d(50), t(0:12), x, y(11), u, m, s, i, j, k
  logical :: c(0:24), f(0:24)
  d = 0
  t = 0
  y = 0
  c = .false.
  t(0) = 1
  read(*,*) n
  read(*,*) d(1:n)
  do i = 1, n
    t(d(i)) = t(d(i))+1
  end do
  if (t(0).gt.1.or.t(12).gt.1) then
    write(*,'(i0)') 0
    stop
  end if
  x = 0
  c(0) = .true.
  c(24) = .true.
  do i = 1, 11
    if (t(i).gt.2) then
      write(*,'(i0)') 0
      stop
    else if (t(i).eq.2) then
      c(i) = .true.
      c(24-i) = .true.
    else if (t(i).eq.1) then
      x = x+1
      y(x) = i
    end if
  end do
  if (t(12).eq.1) c(12) = .true.
  u = 2**x-1
  m = 0
  do k = 0, u
    f = c
    do i = 1, x
      if (btest(k,i-1)) then
        f(y(i)) = .true.
      else
        f(24-y(i)) = .true.
      end if
    end do
    s = 24
    i = 0
    do
      j = i+1
      do while (.not.f(j))
        j = j+1
      end do
      s = min(s,j-i)
      if (j.eq.24) exit
      i = j
    end do
    m = max(m,s)
  end do
  write(*,'(i0)') m
  stop
end program time_gap

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

const int INF = 1 << 30;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	deque<int> d;
	rep(i, n) {
		int p = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
		if (p == 0) d.push_front(a[i]);
		else d[p - 1] = a[i];
	}
	cout << d.size() << endl;
	return 0;
}

Measured memory_bytes: 3952
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=0;i--)
#define rep_re(i,s,n)for(int i = n;i>=0;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_M = 100001;

ll cnt[200001];
vector<ll> v[200001];
void dfs(ll id, ll c) {
	cnt[id] += c;

	if (v[id].size() == 0)return;

	rep(i, 0, v[id].size()) {
		ll nextid = v[id][i];
		dfs(v[id][i], cnt[id]);
	}
}
int main() {
	ll n, q; cin >> n >> q;

	repe(i, 1, n - 1) {
		ll a, b; cin >> a >> b;
		v[a].push_back(b);
	}
	repe(i, 1, q) {
		ll p, q; cin >> p >> q;
		cnt[p] += q;
	}

	dfs(1, 0);

	repe(i, 1, n) {
		cout << cnt[i];
		if (i != n) {
			cout << " ";
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 24320
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#pragma GCC optimize ("-O3")
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
#define tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define ll long long int
ll max(ll a, ll b) {  return a > b ? a : b; }
ll gcd(ll a, ll b) { if (a == 0) return b; return b == 0 ? a : gcd(b, a % b);}
#define case(i) cout<<"Case #"<<i<<": ";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) { cerr << "[ " << *it << " = " << a << " ]"; err(++it, args...); }
#define pii pair <ll , ll >
#define pb push_back
#define PRECISION 10
const ll inf = 1e16;
const int MAXN = 100001;
const int LOGN = 22;
const int MAXBIT = 61;
const int DIGITSIZE = 19;
ll mod = 1e9 + 7;
ll MOD = 998244353;
int x4[] = {1, -1, 0, 0};
int y4[] = {0, 0, 1, -1};
bool take_test_cases = false;
bool print_case_no = false;

void getac(int T) {
    int n;
    cin>>n;
    int m;
    cin>>m;
    int arr[n+1];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    vector < int > adj[n+1];
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].pb(x);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(adj[i].size()==0){
            ans++;
        }
        else{
            int max1=0;
            for(auto it:adj[i]){
                max1=max(max1,arr[it]);
            }
            if(arr[i]>max1){
                ans++;
            }
        }
    }
    cout<<ans<<'\n';
}
int  main()
{

    fastio;
    int t = 1;
    if (take_test_cases) cin >> t;
    int t_t = 1;
    while (t--) {
        if (print_case_no)
        case (t_t);
        getac(t_t);
        t_t++;
    }
    return 0;
}

Measured memory_bytes: 9200
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-13;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}

int main(){
    int a,b;scanf("%d%d",&a,&b);
    long long ret=0;
    for(int i=b+1;i<=a;i++){
        for(int j=0;j<=a/i;j++){
            int nd=j*i;
            int am=min(1+a-nd,i);
            int rm=max(0,am-b);
      //      printf("%d %d: %d\n",i,j,rm);
            ret+=rm;
            if(rm&&j==0&&b==0)ret--;
        }
    }
    printf("%lld\n",ret);
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static boolean solve() {
		int m = in.nextInt();
		int min = in.nextInt();
		int max = in.nextInt();
		if (m + min + max == 0) return false;
		int[] p = new int[m];
		for (int i=0; i<m; i++) {
			p[i] = in.nextInt();
		}

		Arrays.sort(p);

		int md = 0, ans = 0;
		for (int i=m-max; i<=m-min; i++) {
			if (md < p[i] - p[i-1]) {
				ans = m - i;
				md = p[i] - p[i-1];
			}
		}
		out.println(ans);

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 56548
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define FOR(i,m,n) for(int (i)=m;(i)<n;(i)++)




int main(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    cout<<(H-h)*(W-w)<<endl;
    return 0;

}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

template<typename T>
T ModPow(T s, T n)
{
    T res = 1;

    while(n) {
        if (n & 1) { 
            res *= s;
            res %= MOD;
        }
        s *= s;
        s %= MOD;
        n >>= 1;
    }
    return res;
}

template<typename T>
T ModInv(T n) {
    return ModPow(n, MOD - 2);
}

template<typename T>
T ModnCr(T n, T r) 
{
    T x = 1, y = 1;
    
    irep(i, r) {
        x *= n-i;
        x %= MOD;

        y *= r-i;
        y %= MOD;
    }

    T rtn = (x * ModInv(y)) % MOD;
    return rtn;
}

int main(void)
{
    ll n, k;
    cin >> n >> k;
    
    cout << n - k + 1 << endl;

    irep2(i, 2, k) {
        ll a = ModnCr((ll)n-k+1, (ll)i); 
        ll b = ModnCr((ll)k-1, (ll)i-1);
        cout << (a * b) % MOD << endl;
    }
    return 0;
} /*atcoder*/



Measured memory_bytes: 3612
import sys
INF = 10 ** 9
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)

def k(s):
    n = len(s)
    flag = True
    if n%2 == 0:
        l = n//2
    else:
        l = (n - 1)//2

    for i in range(l):
        if s[i] == s[n-i-1]:
            continue
        else:
            flag = False
            break
    return flag


def main():
    s = input()
    n = len(s)
    

    if k(s) and k(s[:((n-1)//2)]) and k(s[((n - 1)//2 + 1):]):
        print('Yes')
    else:
        print('No')
 


if __name__=='__main__':
    main()


Measured memory_bytes: 3444
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    sc.close();

    while (0 < A && 0 < C) {
      C -= B;
      if (C <= 0) break;
      A -= D;
    }

    boolean ans = C <= 0;
    System.out.println(ans ? "Yes" : "No");
  }
}


Measured memory_bytes: 35748
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}

int main(void){

  long n;
  scanf("%ld\n", &n);
  char s[n][11];
  for (long i = 0; i < n; i++) {
    for (long j = 0; j < 11; j++) {
      scanf("%c", &s[i][j]);
      if (s[i][j] < 'a' || s[i][j] > 'z') {
        s[i][j] = '\0';
        break;
      }
    }
  }
  qsort(s, n, sizeof(s[0]), cmp_s);
  long count = 1;
  for (long i = 1; i < n; i++) {
    if (strcmp(s[i-1],s[i]) != 0) {
      count++;
    }
  }
  printf("%ld\n", count);

  return 0;
}

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



using namespace std;


int main(){
  int a,b;
  while (std::cin >> a>>b) {
    if(b>a){
      int t=b;
      b=a;
      a=t;
    }
    while (a%b!=0) {
      int p=a%b;
      a=b;
      b=p;
    }
    std::cout << b << '\n';
  }
}



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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;

int main() {
  int a,b,c,count = 0;
  cin >> a >> b;
  string s;
  cin >> s;

  rep(i,0,s.size()){
    if(s[i] == '-'){
      count++;
      c = i;
    } 
  }

  if((count == 1) && (a == c) && (s.size() == a+b+1)) puts("Yes");
  else puts("No");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string s;
    cin >> s;
    if(s == "SUN") cout << 7 <<endl;
    if(s == "MON") cout <<6 <<endl;
    if(s == "TUE") cout << 5 <<endl;
    if(s == "WED") cout << 4 <<endl;
    if(s == "THU") cout << 3 <<endl;
    if(s == "FRI") cout << 2 <<endl;
    if(s == "SAT") cout << 1 <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2*(1e5)+10;
typedef long long ll;
int n,a[N];
ll cnt[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]),cnt[a[i]]++;
	ll ans=0;
	for(int i=1;i<=n;++i) {
		if(cnt[i]==0) continue;
		else if(i==a[1]) ans+=(cnt[i]-1)*(cnt[i]-2)/2;
		else ans+=cnt[i]*(cnt[i]-1)/2;
	}
	printf("%lld\n",ans);
	for(int i=2;i<=n;++i) {
		ans-=(cnt[a[i-1]]-1)*(cnt[a[i-1]]-2)/2;
		ans+=cnt[a[i-1]]*(cnt[a[i-1]]-1)/2;
		ans-=cnt[a[i]]*(cnt[a[i]]-1)/2;
		ans+=(cnt[a[i]]-1)*(cnt[a[i]]-2)/2;
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 3968
from collections import deque
s = deque(input())
q = int(input())
query = [list(map(str, input().split())) for _ in range(q)]

order = True
for i in query:
    if i[0] == "1":
        order = not order
    elif i[1] == "1":
        if order:
            s.appendleft(i[2])
        else:
            s.append(i[2])
    else:
        if order:
            s.append(i[2])
        else:
            s.appendleft(i[2])

if not order:
    s.reverse()
print("".join(s))

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

m_count = 0
t_num = 1
for r in range(1, n+1):
    flg = True
    t_count = 0
    tr = r
    while(flg):
        if tr // 2 > 0:
            t_count += 1
            tr //= 2
        else:
            flg = False
    if m_count < t_count:
        m_count = t_count
        t_num = r
print(t_num)

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<int>> c(10,vector<int>(10));
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      cin >> c[i][j];
    }
  }
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int k=0;k<10;k++){
        if(c[j][k]>c[j][i]+c[i][k]) c[j][k]=c[j][i]+c[i][k];
      }
    }
  }
  // for(int i=0;i<10;i++) cout << c[i][1] << endl;
  vector<int> kazu(10,0);
  int a;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> a;
      if(a>=0) kazu[a]++;
    }
  }
  int ans=0;
  for(int i=0;i<10;i++){
    ans+=kazu[i]*c[i][1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iomanip>
using namespace std;
int main(){
	int N,sum=0;
	cin >> N;
	int b[N],e[N];
	for(int i=0;i<N;i++){
		cin >> b[i] >> e[i];
	}
	for(int j=0;j<N;j++){
		sum = sum+e[j]-b[j]+1;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
$n = gets.to_i
INF = 10000000
$d = Array.new($n){ Array.new }

$n.times do
  l = gets.split.map(&:to_i)
  (1..l[1]).each do |i|
    $d[l[0]] << l[2*i,2]
  end
end

def main()
  cost = Array.new($n, INF)
  cost[0] = 0
  visited = Array.new($n, false)

  while visited.include?(false)
    m = INF

    # visited???????????????????????????????????????m???
    $n.times do |i|
      if !visited[i] && m > cost[i] then
        m = cost[i]
      end
    end

    # INF???????????£????????????
    break if m == INF

    # ???????????§????????????????¨????
    # ????????????m????????£??????visited??¨???????¢????
    $n.times do |j|
      if m == cost[j]
        visited[j] = true
        $d[j].each do |r|
          u, w = r
          cost[u] = [cost[u], cost[j] + w].min
        end
      end
    end
  end
  cost
end

result = main()
result.each_index{ |i| puts "#{i} #{result[i]}" }

Measured memory_bytes: 57168
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=[0]*n

  for _ in range(k):
    d=I()
    a=LI()
    for x in a:
      l[x-1]+=1

  return l.count(0)

# main()
print(main())


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

using namespace std;
typedef unsigned long long int ll;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

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

}


Measured memory_bytes: 3620
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
  int n;
  double ans = 0;
  int a[50]={0};
  cin >> n;
  for(int i = 0; i < n; i++ ){
    cin >> a[i];
  }
  sort(a, a+50);
  for(int i = 51-n; i < 50; i++){
     if(ans == 0){ ans = ((double)a[i-1]+(double)a[i])/2;}
     else{ans = (ans+(double)a[i])/2;}
  }
  cout << ans;
}

Measured memory_bytes: 256
raw = input()

x1 = int(raw.split(' ')[0])
y1 = int(raw.split(' ')[1])
x2 = int(raw.split(' ')[2])
y2 = int(raw.split(' ')[3])

c = '0'
d = '0'

if x1 > x2:
    d1 = x1 - x2
    c = '1'
else:
    d1 = x2 - x1
 
if y1 > y2:
    d2 = y1 - y2
    d = '1'
else:
    d2 = y2 - y1
    
if c == '1':
    y3 = y2 - d1

    y4 = y1 - d1

else:
    y3 = y2 + d1

    y4 = y1 + d1

if d == '1':
    x3 = x2 + d2

    x4 = x1 + d2
else:
    x3 = x2 - d2
    
    x4 = x1 - d2

print(x3,y3,x4,y4)

Measured memory_bytes: 3064
import math
N, M = map(int, input().split())
S = list(input())
T = list(input())
lcm = (N * M) // math.gcd(N, M)
ans = lcm
Sp = lcm//N
Tp = lcm//M
lcmlcm = (Sp * Tp) // math.gcd(Sp, Tp)
owari = min(Sp*N, M*Tp)
for i in range(0, owari, lcmlcm):
    if S[i//Sp] != T[i//Tp]:
        ans = -1
        break
print(ans)


Measured memory_bytes: 10352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    map<int,int> mp;
    for(int x=2;x*x<=2*n;x++){
        for(int y=2;x*x+y*y<=2*n;y++){
            mp[x*x+y*y]++;
        }
    }
    FOR(i,1,n+1){
        ll ans=0;
        for(int x=1;x*x<=i;x++){
            for(int y=1;x*x+y*y+x*y<=i;y++){
                for(int z=1;x*x+y*y+z*z+x*y+y*z+z*x<=i;z++){
                    if(x*x+y*y+z*z+x*y+y*z+z*x==i){
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3844
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"a == b"<<endl;
    }else{
        if(a<b){
            cout<<"a < b"<<endl;
        }else{
            cout<<"a > b"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3076