akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void)
{
    int n,i,a[101];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=n-1;i>=0;i--)
    {
        printf("%d",a[i]);
        if(i!=0) printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int ret = 0;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		if (h >= k) {
			ret++;
		}
	}
	cout << ret << endl;
	return 0;
}

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

const int mod=1e9+7;

int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=0;

  for(int i=k;i<=n+1;i++){
    ans=(ans+(n-i+1)*i%mod+1)%mod;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3628
N,D=map(int,input().split())
X=[0]*N;Y=[0]*N;
count=0
for i in range(N):
  X[i],Y[i]=map(int,input().split())
for i in range(N):
  if((X[i]**2+Y[i]**2)**(1/2)<=D):
    count+=1
print(count)

Measured memory_bytes: 24700
#include<cstdio>
using namespace std;
int main()
{
	int n,i,a[100000],b[100000];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
		b[i]=0;
	}
	for(i=1;i<=n;i++)	b[a[i]]=i;
	printf("%d",b[1]);
	for(i=2;i<=n;i++)	printf(" %d",b[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 1536
#include<map>
#include<cmath>
#include<stack>
#include<cstdio>
#include<queue>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int n,a[105][105],ans,f[105][105];
int main(){
	scanf("%d",&n);
    for(int i=1;i<=2;i++)
    	for(int j=1;j<=n;j++)
    		scanf("%d",&a[i][j]);
    for(int i=1;i<=2;i++)
    	for(int j=1;j<=n;j++)
    		f[i][j]=max(f[i-1][j],f[i][j-1])+a[i][j];
    printf("%d\n",f[2][n]);
    return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int, input().split())

diff_x = tx-sx
diff_y = ty-sy

first_path = 'U'*diff_y + 'R'*diff_x + 'D'*diff_y + 'L'*diff_x
second_path = 'L' + 'U'*diff_y + 'U' + 'R' + 'R'*diff_x + 'D' + \
              'R' + 'D'*diff_y + 'D' + 'L' + 'L'*diff_x + 'U'


print(first_path+second_path)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define _for(i, a, b) for (int i = (a); i < (b); i++)
#define _count(i, a, b) for (int i = (a); i <= b; i++)
#define PB emplace_back
#define MINI -2147483648
#define MAXI 2147483647
#define MAXLL 9223372036854775807
#define MINLL -9223372036854775808
#define VI vector<int>
#define VB vector<bool>
#define VLL vector<long long>
#define LL long long
#define ULL unsigned long long
#define ALL(X) X.begin(), X.end() 
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
//#define Remilia_is_so_cute
#define StarBurst std::ios::sync_with_stdio(false),cin.tie(NULL);
#define lowerBit(x) x&-x
using namespace std;
 
inline void R_P(vector<int> &vec) {
  int temp;
  cin>>temp;
  vec.push_back(temp);
} 
inline bool checkMax(int &base, int test) {
  return (test > base) ? base = test, true : false; 
}
 
inline bool checkMin(int &base, int test){
  return (test < base)? base = test, true : false;
}
template <class T>
void test(vector<T> &vec, const string &warn) {
  cout<<warn<<'\n';
  _for(i, 0, vec.size())
    cout<<vec[i]<<' ';
  cout<<"\nTest end..............\n";
}
 
int n;
int main () {
  StarBurst
  #ifdef Remilia_is_so_cute
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  
  cin >> n;
  VLL vec(n + 1, 0);
  VLL prefix(n + 1, 0);
  _count(i, 1, n) {
    cin >> vec[i];
    prefix[i] = (prefix[i - 1] + vec[i]) % 1000000007;
  }
  //test(prefix, "aa");
  LL ans = 0;
  _for(i, 1, n) {
    int tmp = prefix[n] - prefix[i];
    if (tmp < 0)
      tmp += 1000000007;
    ans += vec[i] * tmp;
    //cout << vec[i] << ' ' << prefix[n] << ' ' << prefix[i] << '\n';
    ans %= 1000000007;
  }

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

Measured memory_bytes: 6360
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    ll A;
    double B;

    cin >> A >> B;
    ll C = (ll)(B * 100 + 0.5);
    ll ans = A* C / 100;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,A,B;
    cin >> N >> A >> B;

    int ans=0;

    for(int i=1;i<N+1;i++){
        int w=0;
        int n=i;
        while(n!=0){
            w+=n%10;
            n=n/10;
        }

        if(A<=w&&w<=B){
            ans+=i;
        }

    }

    cout << ans << endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define ll long long int
#define ull unsigned long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
double p[5000],q[5000];
// long double dp[3001][3001];
long double dp[3004];
int main()
{
    fast;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i];
        q[i]=1-p[i];
    }    
    dp[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=i;j>=0;j--)
        {
            dp[j]=(j==0?0:dp[j-1]*p[i])+dp[j]*q[i];
        }
    }   
    double ans=0;
    for(int i=n/2+1;i<=n;i++)ans+=dp[i];
    cout<<setprecision(12)<<ans<<"\n";
return 0;
}

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

int main(){

  long long int a,b;
  cin >> a >> b;
    for(long long int i = 1; i <= b; i++){
    if((a * i) % b == 0){
      cout << a * i << endl;
      return 0;
    }
  }


}


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

signed main()
{  
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int test=1;
    //cin>>test;
    while(test--){
        int n,s=0,a;
        cin>>n;
        map<int, int> m;
        for(int i=0;i<n;i++){
            cin>>a;
            m[a]++;
        }
        for(auto u:m){
            if(u.second>=u.first) s+=u.second-u.first;
            else s+=u.second;
        }
        cout<<s<<"\n";


    }
    return 0;
}       

Measured memory_bytes: 8164
#include <iostream>

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    if (n < k) {
        cout << min(n, abs(k-n)) << endl;
        return 0;
    }
    else {
        ll a = n / k;
        n -= k*a;
        cout << min(min(abs(n-k), abs(k-n)), n) << endl;
    }
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

constexpr ll BIG = 1000000000000L;

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

    int N, T;
    cin >> N >> T;

    vi A(N);
    vi B(N);

    for (int i=0;i<N;i++) cin >> A[i] >> B[i];

    vector<pair<int, int>> dishes;
    for (int i=0;i<N;i++) dishes.push_back(make_pair(A[i], B[i]));
    sort(dishes.begin(), dishes.end()); // inc in A[i]

    vi dprow(T+1, 0);
    vvi dp(N+1, dprow);

    for (int t=0; t<T;t++) {
        for (int n=0;n<N;n++) {
            dp[n+1][t] = max(dp[n][t], dp[n+1][t]);
            int curA = dishes[n].first;
            int curB = dishes[n].second;
            if (t + curA <= T) dp[n+1][t+curA] = max(dp[n+1][t+curA], dp[n][t] + curB);
        }
    }
    
    vi suffs(N+1, 0);
    for (int n=N-1;n>=0;n--) {
        suffs[n] = max(suffs[n+1], dishes[n].second);
    }

    int ans = 0;
    for (int t=0;t<T;t++) {
        for (int n=0;n<=N;n++) {
            ans = max(ans, dp[n][t] + suffs[n]);
        }
    }
    for(int n=0;n<=N;n++) ans = max(ans, dp[n][T]);

    cout << ans << endl;

    return 0;
}

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

int R , ans=0 ;

int dec(int n){
	int temp=0;
	while(n){
		temp+=n%10;
		n/=10;
	}
	return temp;	
}

int main()
{
	int N , a , b ;
	
	cin>>N>>a>>b;
	
	int m=min(a,b) , M=max(a,b) ;
	
	for( int i ; i<=N ; i++ ){
		int te = dec(i);
		if( te>=m && te<=M )
			ans+=i;
	}
	
	cout<<ans<<endl;
	return 0;			
}

Measured memory_bytes: 256
h, w = map(int, input().split())
grid = []
for i in range(h):
  temp = list(input())
  if not temp.count('.') == w:
    grid.append(temp)

remove = []

for i in range(w):
  count = 0
  for j in range(len(grid)):
    if grid[j][i] == '.':
      count += 1
  
  if count == len(grid):
    remove.append(i)

for i in range(len(grid)):
  ans = ''
  for j in range(len(grid[0])):
    if not j in remove:
      ans += grid[i][j]
  
  print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int n;
    cin >> n;
    int ans = INF;
    while (n) {
        chmin(ans, abs(n % 1000 - 753));
        n /= 10;
        if (n < 100)
            break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
char a[1001][1001];
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin>>a[i][j];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
			cout<<a[i][j];
		cout<<endl;
		for(int j=0;j<m;j++)
			cout<<a[i][j];
		cout<<endl;
	}
    return 0;
}


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

constexpr int64_t INF = 1'010'000'000'000'000'017LL;
constexpr int64_t MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

void primeFactorization2(uint64_t number, list<uint64_t> &factors){
  uint64_t val = sqrt(number);
  for (uint64_t i = 2; i <= val; i++){
    while (number % i == 0){
      number /= i;
      factors.push_back(i);
	}
  }
  if(number != 1){
    factors.push_back(number);
  }
}

signed main() {
  int x, n;
  cin >> x >> n;
  int *p = new int[101];
  int val = 0;
  for(int i = 1; i <= n; i++){
    cin >> val;
    p[val] = 1;
  }

  bool isEnd = false;
  bool isStart  = false;
  bool isFound = false;
  bool isBigger = true;
  int foundInt = 0;
  for(int i = 0; i <= 100; i++){
    if(x-i==0){
      isStart = true;
    }
    if(x+i==101){
      isEnd = true;
    }
    if(!isStart){
      if(p[x-i]==0){
        foundInt = x-i;
        isFound = true;
        break;
      }
    }
    if(!isEnd){
      if(p[x+i]==0){
        foundInt = x+i;
        isFound = true;
        break;
      }
    }
  }
  if(!isFound){
    if(x<=50)
    {
      cout << "0" << endl;
      return 0;
    }
    else{
      cout << "101" << endl;
      return 0;
    }
  }
  if(isFound && x <= abs(x-foundInt))
  {
    cout << "0" << endl;
    return 0;
  }
  if(isFound && abs(101-x) < abs(x-foundInt))
  {
    cout << "101" << endl;
    return 0;
  }
  cout << foundInt << endl;
  return 0;
}

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

int main()
{
    ll a, b, h; cin >> a >> b >> h;

    cout << (a+b)*h/2 << endl;


}


Measured memory_bytes: 3536
/*
* @FileName: D:\代码与算法\2017训练比赛\11.18-atcoder\a.cpp
* @Author: Pic
* @Created Time: 2017/11/18 19:49:23
*/
#include <bits/stdc++.h>
using namespace std;
int has[13];
int main()
{
	//freopen("data.in","r",stdin);
	//freopen("data.out","w",stdout);
	int n;
   	cin>>n;
	int now=-1;
	int tmp=0;
	int cnt=0;
	int flag=0;
	while(n){
		tmp=n%10;
		if(tmp!=now){
			now=tmp;
			cnt=1;
		}
		else{
			cnt++;
			if(cnt>=3){
				flag=1;
				break;
			}
		}
		n/=10;
	}	
	if(flag){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


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

int main()
{
  string s;
  cin>>s;
  
  int sz=0;
  string ans="";
  for(int i=0;s[i];i++)
  {
    if(s[i]=='S')
    {
    	int n = ans.size();
      sz = max(sz,n);
      ans="";
    }
    else
    {
      ans+=s[i];
    }
  }
  if(ans!="")
  {
  	int n = ans.size();
    sz=max(sz,n);
  }
  cout<<sz<<endl;
}
  

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b; cin>>a>>b;
    if (a>=13){
        cout<<b<<endl;
    }else if(a>=6){
        cout<<b/2<<endl;
    }else{
        cout<<"0\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int x;
    cin >> x;
    bool flag = false;
    while(true){
        flag = true;
        for (int i = 2; i < x-1; i++)
        {
            if(x%i==0){
                flag = false;
            }
        }
        if(flag){
            break;
        }
        x++;
        // printf("%d\n", x);
    }    
    cout << x << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
(n, m, l) = [int(i) for i in input().split()]

A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])

B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])

product = [[0 for d in range(l)] for dd in range(n)]

for nc in range(n):
    for lc in range(l):
        for mc in range(m):
            product[nc][lc] += A[nc][mc] * B[mc][lc]

for r in product:
    print(' '.join([str(d) for d in r]))

Measured memory_bytes: 7760
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

std::vector<std::string> split(const std::string str, const char delim) {
  std::vector<std::string> result;
  std::stringstream ss(str);
  std::string item;
  while (std::getline(ss, item, delim)) {
    result.push_back(item);
  }
  return result;
}

std::vector<int> map_to_i(const std::vector<std::string> strs) {
  std::vector<int> result;
  for (auto s : strs) { result.push_back(std::atoi(s.c_str())); }
  return result;
}

void print_result(const std::vector<int> nums) {
  std::stringstream ss;
  ss << nums[0];
  for (auto i = 1; i < nums.size(); ++i) { ss << " " << nums[i]; }
  std::cout << ss.str() << std::endl;
}

std::vector<int> insersion_sort(const std::vector<int> nums, int size) {
  std::vector<int> result;
  for (auto n : nums) { result.push_back(n); }
  for (auto i = 1; i < size; ++i) {
    auto v = result[i];
    auto j = i - 1;
    while (j >= 0 && result[j] > v) {
      result[j + 1] = result[j];
      //std::cout << "i, j, v, result[j+1]: " << i << ", " << j << ", " << v << ", " << result[j+1] << std::endl;
      --j;
    }
    result[j + 1] = v;
    print_result(result);
  }
  return result;
}

int main(void) {
  int size;
  std::string nums_str;

  std::cin >> size;
  std::cin.ignore();
  std::getline(std::cin, nums_str);
  auto elems = map_to_i(split(nums_str, ' '));

  print_result(elems);
  insersion_sort(elems, size);

  return 0;
}

Measured memory_bytes: 3200
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int n;
ll res;
string s;

void f(int k, ll sum, ll x) {
    if (k == n) {
        res += sum + x;
        return;
    }

    f(k + 1, sum, x * 10 + s[k] - '0');
    if (k) {
        f(k + 1, sum + x, s[k] - '0');
    }
}

int main() {
    cin >> s;
    n = s.size();

    f(0, 0, 0);
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using State = string::const_iterator;
class ParseError{};

bool CAT(State& begin){
    if(*begin != 'm'){
        return false;
    }
    begin++;
    CAT(begin);
    if(*begin != 'e'){
        return false;
    }
    begin++;
    CAT(begin);
    if(*begin != 'w'){
        return false;
    }
    begin++;
    return true;
}

int main(){
    string S;
    cin >> S;
    State begin = S.begin();
    cout << (CAT(begin) && begin == S.end() ? "Cat" : "Rabbit") << endl;
}


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

public class Main {
    static int[] factorCnts;
    static boolean checkCoprime = true;

    public static void factorise(int num) {
        if (!checkCoprime)
            return;
        for (int i = 1; i * i <= num; i++) {
            if (num % i == 0) {
                int a = i;
                int b = num / i;
                if (a == b)
                    b = 1;
                if (a != 1) {
                    if (factorCnts[a] == 1) {
                        checkCoprime = false;
                        return;
                    }
                    factorCnts[a]++;
                }
                if (b != 1) {
                    if (factorCnts[b] == 1) {
                        checkCoprime = false;
                        return;
                    }
                    factorCnts[b]++;
                }
            }
        }
    }

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

    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(buffer.readLine());
        String[] inp = buffer.readLine().split(" ");
        int[] arr = new int[n];
        arr[0] = Integer.parseInt(inp[0]);
        factorCnts = new int[1000001];
        int gcdRes = arr[0];
        for (int pos = 1; pos < n; pos++) {
            arr[pos] = Integer.parseInt(inp[pos]);
            gcdRes = gcd(gcdRes, arr[pos]);
        }
        for (int pos = 0; pos < n; pos++) {
            factorise(arr[pos]);
        }
        if (checkCoprime) {
            System.out.println("pairwise coprime");
        } else if (gcdRes == 1)
            System.out.println("setwise coprime");
        else
            System.out.println("not coprime");
    }
}


Measured memory_bytes: 115288
#include<iostream>
#include<iterator>
#include<string>
#include<sstream>
int main(){
	bool flag = true;
	auto s = *std::istream_iterator<std::string>(std::cin);
	for(int i=0;i<s.size() -1;i++){
		if(s[i] == s[i+1]){
			flag = false;
			break;
		}
	}
	if(flag){
		std::cout << "Good";
	}else{
		std::cout << "Bad";
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	in := scanInt()
	arr := make([]int, 4)
	for i := 0; i < 4; i++ {
		arr[3-i] = in % 10
		in /= 10
	}
	ans := make([]int, 4)
	bitExhaustiveSearch(3, func(a []bool) {
		arr2 := make([]int, 4)
		copy(arr2, arr)
		for i := 0; i < 3; i++ {
			if a[i] {
				arr2[i+1] *= -1
			}
		}

		sum := 0
		for i := 0; i < 4; i++ {
			sum += arr2[i]
		}
		if sum == 7 {
			copy(ans, arr2)
		}
	})

	for i := 0; i < 4; i++ {
		if i != 0 && ans[i] >= 0 {
			fmt.Fprint(wr, "+")
		}
		fmt.Fprint(wr, ans[i])
	}
	fmt.Fprintln(wr, "=7")

}

func bitExhaustiveSearch(n int, fn func(a []bool)) {
	all := 1 << uint(n)
	a := make([]bool, n)
	for i := 0; i < all; i++ {
		for j := 0; j < n; j++ {
			if i>>uint(j)&1 == 1 {
				a[j] = true
			} else {
				a[j] = false
			}
		}
		fn(a)
	}
}


Measured memory_bytes: 1780
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        double ans;
        if (n % 2 == 0) ans = 0.5;
        else
        {
            var t = n - (n - 1) / 2;
            ans = (double)t / n;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int ans = 700;
            String s = sc.next();
            for (char ch : s.toCharArray()) {
                if ( ch == 'o' ) {
                    ans += 100;
                }
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int N, n;
bool flag;
set<int> ms;
int main()
{
    flag = true;
    cin>>N;
    while(N--)
    {
        cin>>n;
        if(ms.find(n)==ms.end())
            ms.insert(n);
        else 
            flag = false;
    }
    if(flag) cout<<"YES\n";
    else cout<<"NO\n";
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[100];
int main(){
  ll k; int n=50;
  cin>>k;
  cout<<n<<endl;
  for (int i=1; i<=n; ++i)
    a[i]=n-1+k/n;
  k%=n;
  for (int i=1; i<=k; ++i)
    a[i]+=n-k+1;
  for (int i=k+1; i<=n; ++i)
    a[i]-=k;
  for (int i=1; i<=n; ++i)
    cout<<a[i]<<" ";
  return 0;
}


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

int main()
{
  int N;
  cin >> N;
  
  int ans = 10000;
  int num;
  int A;
  for( int i = 0; i< N; i++){
    cin >> A;
    num = 0;
    while(!(A % 2)) { 
      num++;
      A /= 2;
    } if(num < ans) {
      ans = num;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def val():
    s = input()
    if s == "Vacant":
        exit()
    return 1 if s == "Male" else 0


N = int(input())

print(0, flush=True)
ofs = val()
l = 0
r = N
while True:
    m = (l+r)//2
    print(m, flush=True)
    s = val() ^ m & 1

    if ofs == s:
        l = m
    else:
        r = m

    p = s


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#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 REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll K;
ll t;
ll ret = 0;

void input() {
  IN(N);
  IN(K);
  REP(i, N) {
    IN(t);
    if (t >= K) {
      ret += 1;
    }
  }
  PRINT(ret);
}

void solve() {

}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

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

int main()
{
    char a;
    cin >> a;

    if ('a' <= a && a <= 'z') {
        cout << 'a' << endl;
    } else {
        cout << 'A' << endl;
    }

    return 0;
}


Measured memory_bytes: 3032
n, k = map(int, input().split())
mod = 10**9 + 7

factorial = [1]
inverse = [1]
for i in range(1, 2*n):
    factorial.append(factorial[-1] * i % mod)
    inverse.append(pow(factorial[-1], mod - 2, mod))

def comb(n, r, mod):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % mod


if k >= n-1:
    print(comb(2*n-1, n-1, mod))
else:
    sikiri = n - 1
    basho = 2 * n - 1
    ans = 0
    for i in range(k+1):
        ans = (ans + comb(n, i, mod) * comb(sikiri, sikiri-i, mod)) % mod
    print(ans)

Measured memory_bytes: 97392
#include<stdio.h>
#include<string.h>
int main()
{
   long long int i,sum=0;
    char s[1000000];
    
    scanf("%s",&s);
    for(i=0;i<strlen(s);i++){
        sum+=s[i]-'0';
    }
    if(sum%9==0)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

Measured memory_bytes: 1856
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

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

		sc.close();

		int[] a = new int[3];
		int[] b = new int[3];

		String ans = "No";
		LOOP: for (a[0] = 0; a[0] <= 100; a[0]++) {
			b[0] = c[0][0] - a[0];
			b[1] = c[0][1] - a[0];
			b[2] = c[0][2] - a[0];
			if (b[0] < 0 || b[1] < 0 || b[2] < 0) {
				break;
			}

			a[1] = c[1][0] - b[0];
			a[2] = c[2][0] - b[0];

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (a[i] + b[j] != c[i][j]) {
						continue LOOP;
					}
				}
			}
			ans = "Yes";
			break;
		}

		out.println(ans);
	}

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


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(src,dst)    for(int i=src; i<dst;  i++)
#define rep2(src,dst)   for(int j=src; j<dst;  j++)
#define INF 1000000000000 //1e12
#define MOD 1000000007 //1e9+7
#define PI  acos(-1)
#define ll long long
template<typename T> inline void cMin(T* a, T* b)  {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  div(T a, T b)     {return ((a+b-1)/b);}
template<typename T> inline bool eoVerify(T a)     {return (!(a&1)? true : false );}

/***********************
* O(1)                 *
* O(logN)              *
* O(N)                 *
* O(NlogN)             *
* O(N^2)               *
* O(N^3)               *
* O(k^N)               *
* O(N!)                *
************************/

int main(){
    string str; cin >> str;
    string strc;
    ll ans=0;
    rep(0,str.length()){
        strc = str[i];
        ans += stol(strc);
    }
    cout << (!(ans%9)? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3716
import java.util.*

fun main(args : Array<String>) {
    val scan = Scanner(System.`in`)

    var s = scan.next()
    val q = Integer.parseInt(scan.next())

    var rvFlag = false
    var rvCnt = 0

    val front = ArrayDeque<String>()
    val end = ArrayDeque<String>()

    repeat(q) {
        val q1 = Integer.parseInt(scan.next())

        if (q1 == 1) {
            rvFlag = !rvFlag
            rvCnt++
        } else {
            val q2 = Integer.parseInt(scan.next())
            val c = scan.next()

            if (rvFlag) {
                if (q2 == 1) {
                    end.addLast(c)
                } else {
                    front.addFirst(c)
                }
            } else {
                if (q2 == 1) {
                    front.addFirst(c)
                } else {
                    end.addLast(c)
                }
            }
        }
    }

    s = front.joinToString(separator = "") + s + end.joinToString(separator = "")

    if (rvCnt % 2 == 1) {
        println(s.reversed())
    } else {
        println(s)
    }
}

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

bool is_prime(unsigned int num)
{
  if (num <= 1) {
    return false;
  }
  else if (num == 2) {
    return true;
  }
  else if ((num % 2) == 0) {
    return false;
  }
  for (int i = 2; i < (int)ceil(sqrt(num)); i++) {
    if ((num % i) == 0) {
      return false;
    }
  }
  return true;
}

int main()
{
  unsigned int n;
  cin >> n;
  while(!is_prime(n)) n++;
  
  cout << n << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    string ans;
    ans.push_back(s1.at(0) - 'a' + 'A');
    ans.push_back(s2.at(0) - 'a' + 'A');
    ans.push_back(s3.at(0) - 'a' + 'A');
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
count = 0
for i in range(1,1000):
  x = a*i
  for j in range(1,1000):
    if x%b == c:
      count += 1
    else:
      continue
if count==0:
  print("NO")
else:
  print("YES")

Measured memory_bytes: 3060
import Data.List
import Data.Maybe

gweights :: [Int]
gweights = reverse . take 10 . iterate (*2) $ 1

grandma :: Int -> [Int]
grandma = measure gweights

measure :: [Int] -> Int -> [Int]
measure weights x = catMaybes $ unfoldr f (weights,x) where
    f (_,0) = Nothing
    f ([],_) = Nothing
    f (w:ws, n) = if w <= n then Just (Just w, (ws,n-w))
                            else Just (Nothing, (ws,n))

main = getContents >>=
    mapM_ (putStrLn . unwords . map show . reverse . grandma . read) . lines

Measured memory_bytes: 3840
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i=0;i<n;i++){
    scanf("%d", &a[i]);
  }
  int S = 0;
  for (int i=0;i<n;i++){
    S += a[i];
  }
  int p;
  if (S % n <= n / 2){
    p = S / n;
  }
  else{
    p = S / n + 1;
  }
  int X = 0;
  for (int i=0;i<n;i++){
    X += (a[i] - p) * (a[i] - p);
  }
  printf("%d\n", X);
  return 0;
}

Measured memory_bytes: 128
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
import heapq as H
  
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())
def rec(h, w): return [[0] * w for i in range(h)] 

n = I()
xs = Is()

xs = sorted(xs, reverse=True)

seats = [-xs[0]]
H.heapify(seats)

ans = 0
for x in xs[1:]:
  ans -= H.heappop(seats)
  H.heappush(seats, -x)
  H.heappush(seats, -x)

print(ans)

Measured memory_bytes: 51024
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, sta, n) for (int i = sta; i < n; ++i)

using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    int ans = 0;
    int tmp = 0;
    rep(i, n - 1) {
        if (h[i] >= h[i+1]) tmp++;
        else tmp = 0;
        
        ans = max(ans, tmp);
        //cout << i << " " << ans << " " << tmp << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

int sum(int* ,int );

int main(void){

  int n,m,sub,flag,cnum1,cnum2,i,j,sum1,sum2;
  cin >> n >> m;
  int a[101],b[101];

  while( (n==0&&m==0) != 1 ){ 

    //
    
    for(i=0;i<n;i++){
      cin >> a[i];
    }
    for(j=0;j<m;j++){
      cin >> b[j];
    }
    sub = sum(a,n) - sum(b,m);


    //

    
    flag=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if( (a[i] - b[j])*2 == sub ){
	  if(flag==0){
	    cnum1 = a[i];
	    cnum2 = b[j];
	    flag++;
	  }else{
	    if(a[i] + b[j] < cnum1 + cnum2){
	      cnum1 = a[i];
	      cnum2 = b[j];
	    }
	  }
	}
      }
    }


    if(flag==0){
      cout << "-1" << endl;
    }else{
      cout << cnum1 << " " <<  cnum2 << endl;
    }



    cin >> n >> m;
  }
  
  return 0;
}

int sum(int* p,int n){
  int s=0,i;
  for(i=0;i<n;i++) s+=p[i];
  return s;
}
  

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

typedef long long ll;

 
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int pos=0, neg=0;
  for(int i=0; i<n; i++){
    if(s[i]=='('){
      pos++;
    }else{
      if(pos>0) pos--;
      else neg++;
    }
  }
  for(int i=0; i<neg; i++){
    cout <<"(";
  }
  cout << s;
  for(int i=0; i<pos; i++){
    cout <<")";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define zero_pad(num) setfill('0') << std::right << setw(num)
const int MOD=1e9+7;
const int INF=1e18;
const int N_MAX=1e5;

signed main(){
    int N;cin>>N;
    vector<int>A(N);
    REP(i,N)cin>>A[i];
    sort(A.begin(),A.end());
    bool ok=true;
    if(A[N-1]-A[0]>=2)ok=false;
    if(ok){
        int count=0;
        REP(i,N)if(A[i]==A[0])count++;
        if(count==N){
            if(A[0]!=N-1&&A[0]*2>N)ok=false;
        }
        else{
            if(count>=A[N-1]||2*A[N-1]>N+count)ok=false;
        }
    }
    cout<<(ok?"Yes":"No")<<endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

typedef long long ll;
int a[60];
int main()
{


    int n,m;
    cin>>n>>m;
    int c,b;
    for(int i=0;i<m;i++)
    {
        cin>>c>>b;
        a[c]++,a[b]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<a[i]<<endl;
    }
    return 0;
}


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


int main() {
  int A,B,M;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  for (int i = 0;i<A;i++) cin >> a.at(i);
  for (int i = 0;i<B;i++) cin >> b.at(i);
  int ans = 10000000;
  for (int i = 0;i<M;i++) {
    int x,y,m;
    cin >> x >> y >> m;
    ans = min(ans,a.at(x-1) + b.at(y-1) - m);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ans = min(ans,a.at(0)+b.at(0));
  cout << ans << endl;
    
}



Measured memory_bytes: 1024
#include <iostream>

using namespace std;
typedef long long ll;

bool prime[1001];
ll c[1001];
const int MOD = 1e9 + 7;
int N;

int main() {
  cin >> N;
  
  fill(prime, prime + N + 1,true);

  for(int i = 2; i <= N; i++) {
    for(int j = i * 2; j <= N; j += i) {
      prime[j] = false;
    }
  }

  for(int i = 2; i <= N; i++) {
    int tmp = i;
    for(int j = 2; i <= N; j++) {
      if(!prime[j])continue;
      while(tmp % j == 0) {
	tmp /= j;
	c[j]++;

      }
      if(tmp == 1) break;
    }
  }

  ll ans = 1;
  for(int i = 0; i <= N; i++) {
    if(c[i]) {
      ans = ans * (c[i]+1) % MOD;
    }
  }

  cout << ans % MOD <<endl;
}
  
    
  
  


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int n,m;
char a,b;

int main(){
	while(cin>>n){
		if(n==0)return 0;
		map<char,char> table;
		for(int i=0;i<n;i++){
			cin>>a>>b;
			table[a]=b;
		}
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>a;
			if(table[a]!=0)cout<<table[a];
			else cout<<a;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 904
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			String[] sa = br.readLine().split(" ");
			Obj o = new Obj();
			o.l = Integer.parseInt(sa[0]);
			o.r = Integer.parseInt(sa[1]);
			o.v = o.r - o.l + 1;
			arr[i] = o;
		}
		br.close();

		Obj maxV = new Obj();
		Obj minR = new Obj();
		minR.r = 1000000000;
		for (int i = 0; i < n; i++) {
			Obj o = arr[i];
			if (o.v > maxV.v) {
				maxV = o;
			}
			if (o.r < minR.r) {
				minR = o;
			}
		}

		Arrays.parallelSort(arr);
		Obj maxL = arr[0];
		int ans = maxV.v + Math.max(minR.r - maxL.l + 1, 0);
		if (maxL == minR) {
			System.out.println(ans);
			return;
		}

		int minr = maxL.r;
		for (int i = 1; i < n; i++) {
			Obj o = arr[i - 1];
			minr = Math.min(minr, o.r);
			int v1 = Math.max(minR.r - arr[i].l + 1, 0);
			int v2 = Math.max(minr - maxL.l + 1, 0);
			ans = Math.max(ans, v1 + v2);
		}
		System.out.println(ans);
	}

	static class Obj implements Comparable<Obj> {
		int l, r, v;

		@Override
		public int compareTo(Obj o) {
			if (l != o.l) {
				return o.l - l;
			}
			return o.r - r;
		}
	}
}


Measured memory_bytes: 48976
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

vector<pair<long long, long long> > prime_factorize(long long N) {
  vector<pair<long long, long long> > res;
  for (long long a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    long long ex = 0; // 指数
    
    // 割れる限り割り続ける
    while (N % a == 0) {
      ++ex;
      N /= a;
    }
    
    // その結果を push
    res.push_back({a, ex});
  }
  
  // 最後に残った数について
  if (N != 1) res.push_back({N, 1});
  return res;
}

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

  long long count = 0;
  const auto &res = prime_factorize(N);
  for (auto p : res) {
    long long tmp = (-1+sqrt(1+8*p.second) )/2;
    count += tmp;
  }

  cout << count << endl;
  

  return 0;
}


Measured memory_bytes: 3720
// Problem : C - One Quadrillion and One Dalmatians
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define mk make_pair
#define fast                    \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define sz(x) (int)x.size()
#define mem(a, val) memset(a, val, sizeof(a))
#define deci(x) cout << fixed << setprecision(x);
#define bitcount(x) __builtin_popcountll(x)

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

const long long int mod = 1e9 + 7;
const long double EPS = 1e-12;
const int N = 1e5 + 20;

char f(int a) {
  if (a == 0) return 'z';
  return 'a' + (a - 1);
}
ll f1(ll x) {
  if (x == 0) return 26;
  return x;
}

void solve() {
  ll n;
  cin >> n;
  string ans;
  while (n) {
    ans.push_back(f(n % 26));
    n -= f1(n % 26);
    n /= 26;
  }
  reverse(all(ans));
  cout << ans;
}
int main() {
  fast;
  ll t;
  t = 1;

  // cin>>t;

  while (t--) {
    solve();
  }

  return 0;
}


Measured memory_bytes: 3620
/*input
4
1 4 2
2
1 1 -8
2
*/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 gen;
struct node;
using pnode = node*;
int sz(pnode a);
ll dd(pnode a);
struct node
{
	node *l = NULL, *r = NULL;
	int w;
	int val;
	int dyd = 1;
	ll dyd1;
	node(int val): val(val)
	{
		w = gen();
		dyd1 = val;
	}
	void fixS()
	{
		dyd = 1 + sz(l) + sz(r);
		dyd1 = val + dd(l) + dd(r);
	}
};
int sz(pnode a)
{
	if (a)
		return a->dyd;
	return 0;
}
ll dd(pnode a)
{
	if (a)
		return a->dyd1;
	return 0;
}
pnode merge(pnode a, pnode b)
{
	if (a == NULL)
		return b;
	if (b == NULL)
		return a;
	if (a->w < b->w)
	{
		a->r = merge(a->r, b);
		a->fixS();
		return a;
	}
	else
	{
		b->l = merge(a, b->l);
		b->fixS();
		return b;
	}
}
pnode merge(pnode a, pnode b, pnode c)
{
	return merge(merge(a, b), c);
}
void split(pnode a, int v, pnode &x, pnode &y)
{	// (x <= v), (y > v)
	if (a == NULL)
	{
		x = NULL;
		y = NULL;
		return;
	}
	if (a->val <= v)
	{
		split(a->r, v, a->r, y);
		x = a;
	}
	else
	{
		split(a->l, v, x, a->l);
		y = a;
	}
	a->fixS();
}
void split_(pnode a, int k, pnode &x, pnode &y)
{	// (x->sz = min(a->sz, k))
	if (a == NULL)
	{
		x = NULL;
		y = NULL;
	}
	else
	{
		if (k <= 0)
		{
			x = NULL;
			y = a;
		}
		else if (a->dyd < k)
		{
			x = a;
			y = NULL;
		}
		else
		{
			if (sz(a->l) + 1 <= k)
			{
				split_(a->r, k - 1 - sz(a->l), a->r, y);
				x = a;
			}
			else
			{
				split_(a->l, k, x, a->l);
				y = a;
			}
			a->fixS();
		}
	}
}
void print(pnode a, char g = '\n')
{
	if (a == NULL)
	{
		if (g != ' ')
			cout << g;
		return;
	}
	print(a->l, ' ');
	cout << a->val << ' ';
	print(a->r, g);
}

int main()
{
	ios_base::sync_with_stdio(false);
	ll sumb = 0;
	pnode x = NULL;
	int Q;
	cin >> Q;
	int kiek = 0;
	while (Q--)
	{
		int t;
		cin >> t;
		if (t == 1)
		{
			kiek++;
			ll a, b;
			cin >> a >> b;
			sumb += b;
			pnode l, r;
			split(x, a, l, r);
			x = merge(l, new node(a), r);
		}
		else
		{
			pnode a, b, c;
			ll k = (kiek - 1) / 2;
			split_(x, k, a, b);
			split_(b, 1, b, c);
			ll X = b->val;
			ll Y = sumb;
			Y += dd(c);
			Y -= dd(a);
			Y += X * (sz(a) - sz(c));
			cout << X << " " << Y << "\n";
			x = merge(a, b, c);
		}
		//cout << "x: ";
		//print(x);
	}
}

Measured memory_bytes: 9600
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mod (int)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
    	int i,n;
    	cin>>n;
		string s;
		cin>>s;
		// int n=s.size();
		int w=0,r=0;
		repf(i,0,n)
		{
			if(s[i]=='W') w++; else r++;
		}
		int ans=0;
		repf(i,0,r)
		{
			if(s[i]!='R') ans++;
		}
		cout<<ans;
    }
    return 0;
} 


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int a, b, t;

int ans;

int main(void) {
  // Here your code !

  scanf("%d %d %d", &a, &b, &t);

  ans = (t / a) * b;

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

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
abs_a = list(map(abs, a))

count = 0
for x in a:
    if x == 0:
        print(sum(abs_a))
        exit()
    elif x < 0:
        count += 1
if count % 2 == 1:
    mins = min(abs_a)
    print(sum(abs_a) - 2 * mins)
else:
    print(sum(abs_a))


Measured memory_bytes: 64800