akhauriyash/Code-Regression huggingface dataset:
import bisect
from collections import Counter

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

two_bekis = [2**i for i in range(31)]

ans = 0
cnt = Counter(A)
seta = set(A)
for i, a in enumerate(reversed(A)):
    b = two_bekis[bisect.bisect_right(two_bekis, a)] - a
    if b not in seta:
        continue

    if a == b and cnt[a] >= 2:
        ans += 1
        cnt[a] -= 2
    elif a != b and cnt[a] >= 1 and cnt[b] >= 1:
        ans += 1
        cnt[a] -= 1
        cnt[b] -= 1
print(ans)


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

using namespace std;
using ll = long long;

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

int main() {
  char c;
  cin >> c;
  if (c == 'A') cout << 'T' << endl;
  if (c == 'C') cout << 'G' << endl;
  if (c == 'G') cout << 'C' << endl;
  if (c == 'T') cout << 'A' << endl;
  return 0;
}


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

struct UnionFind {
    vector<int> par;
    vector<int> sz;

    UnionFind(int n=0){ if(n>0) initialize(n); }
    void initialize(int n){
        par.resize(n);
        sz.assign(n, 1);
        for(int i=0; i<n; i++){
            par[i] = i;
        }
    }

    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }

    bool unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y) return false;
        if(sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        return true;
    }

    bool same(int x, int y){ return find(x) == find(y); }
    int size(int x){ return sz[find(x)]; }
};

int main(){
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	while(M--){
		int a, b;
		cin >> a >> b;
		uf.unite(a-1, b-1);
	}
	int ans = -1;
	for(int i=0; i<N; i++) if(uf.find(i) == i) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a,b,v,w;
cin>>a>>v;
cin>>b>>w;
int t;
cin>>t;
int l=a-v*t;
int r=a+v*t;
int l1=b-w*t;
int r1=b+w*t;
if(l<=l1&&r>=r1)
{
    cout<<"YES"<<endl;
}
else
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 3692
#include<vector>
#include<iostream>
using namespace std;
int main(void){
  int N; //すぬけくん
  int K; //お菓子
  cin >> N >> K;
  int *have = new int[N];
  for(int i=0;i<N;i++){
    have[i] = 0;
  }

  int d = 0;
  for(int i = 0; i<K; i++){
    cin >> d;
    int dij = 0;
       for(int j = 0; j <  d; j++){
	cin >> dij;
	have[dij-1] = have[dij-1] + 1;
         }
  }

  int Ans = 0;
  for(int k = 0; k < N; k++){
    if(have[k] == 0){
      Ans++;
    }
  }
  cout << Ans << endl;
  
  delete[] have;
  return 0;
}


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

int main(){
	int n,m,count = 0;
	int c[4],p[4],num[] = {10,50,100,500};
	while(1){
		cin >> n;
		if(n == 0)break;
		m = 0;
		for(int i = 0;i < 4;i++){
			p[i] = 0;
		}
		if(count != 0)cout << endl;
		count++;
		cin >> c[0] >> c[1] >> c[2] >> c[3];
		for(int i = 0;i < 4;i++){
			m += num[i] * c[i];
		}
		m -= n;
		for(int i = 3;i >= 0;i--){
			p[i] = m/num[i];
			m %= num[i];
		}
		for(int i = 0;i < 4;i++){
			if(c[i] - p[i] > 0)cout << num[i] << " " << c[i] - p[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int A, B;
    cin >> A >> B;
    if (B % A == 0) {
        cout << A + B << endl;
    } else {
        cout << B - A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
int find(int a){
     if(par[a]==a)return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);if(a==b)return ;
     parent[b]=a;
}*/
 
 
 
 
 
 
 











int main(){
     int n,m,q;
     cin>>n>>m>>q;
     ll c[n+2][n+2];
     memset(c,0,sizeof(c));
     for(int i=0;i<m;i++){
          int l,r;cin>>l>>r;
          c[l][r]++;
     }
     for(int i=n;i>=1;i--){
          for(int j=1;j<=n;j++){
               c[i][j]+=c[i+1][j]+c[i][j-1]-c[i+1][j-1];
          }
     }
     while(q--){
          int p,q;
          cin>>p>>q;
          cout<<c[p][q];
          cout<<endl;
     }
}

























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

int main(){
	int w, h, x, y, r;
	cin>>w>>h>>x>>y>>r;
	if(0<=x-r && x+r<=w && 0<=y-r && y+r<=h){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 1128
function Main(input) {
  input = input.split("\n");
  var sum = 0;
  var arr = input[2].split(" ").map(Number);
  arr.forEach(function(val){
      sum += Math.min(val,input[1]-val);
      })
      console.log(sum*2);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
import collections

n = int(input())
s = [input() for i in range(n)]

# リストsに含まれる単語と出現回数の辞書を作成
# keyに要素　valueに出現回数 
a = collections.Counter(s)

# 出現回数の最大値を取得
max_a = max(a.values())

# value=max_a　なら　keys　に key（単語） を書き込む
# k / for k, v in a.items() / if v == max_a
keys = [k for k, v in a.items() if v == max_a]
keys.sort()

[print(word) for word in keys]

Measured memory_bytes: 35564
n = int(input())
h = int(input())
w = int(input())
#a,b=map(int,input().split()) #横並び
#x=[int(input()) for i in range(3)] #縦に並んだのを配列に
#y=list(map(int,input().split())) #横に並んだのを配列に
print((n-h+1)*(n-w+1))
#print('YNEOS'[1::2])


Measured memory_bytes: 2940
n = int(input())
import bisect
a = sorted(list(map(int, input().split(" "))))
ans = 0
for i in range(1, n-1):
  b = a[:i]
  c = a[i + 1:]
  #print(b, c)
  for j in b:
    ans += bisect.bisect(c, a[i]+j-0.1)
    #print(bisect.bisect(c, a[i]+j-0.1))
print(ans)

Measured memory_bytes: 9288
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

def bsr(a, v, lo=0, hi=None):
	if None == hi:
		hi = len(a) - 1
	while lo <= hi:
		mi = (lo + hi) // 2
		if a[mi] <= v:
			lo = mi + 1
		else:
			hi = mi - 1
	return lo

INF = 10 ** 18
s = [-INF] + S + [INF]
t = [-INF] + T + [INF]

for x in X:
	sp = bsr(s, x)
	tp = bsr(t, x)
	cost = []
	cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]
	cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 0])]
	cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 1])]
	cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]
	cost += [abs(t[tp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]
	cost += [abs(t[tp - 1] - x) + abs(s[sp - 0] - t[tp - 1])]
	cost += [abs(t[tp - 0] - x) + abs(s[sp - 1] - t[tp - 0])]
	cost += [abs(t[tp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]
	print(min(cost))


Measured memory_bytes: 18336
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

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

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

template<typename T> class BinaryIndexedTree
{
private:
    int N = 0;
    vector<T> Data;

public:
    BinaryIndexedTree(int n) : N(n) { Data.assign(N + 1, 0); }

    // (i&-i)は最下位ビット
    void add(int k, T x)
    {
        for (int i=k+1;i<=N;i+=(i&-i)) { Data[i] += x; }
    }

    // [0,k]の総和を求める
    int sum(int k)
    {
        T res = 0;
        for (ll i=k+1;i>0;i-=(i&-i)) { res += Data[i]; }
        return res;
    }

    // [l,r]の総和を求める
    int sum(int l, int r) { return sum(r) - (l >= 1 ? sum(l - 1) : 0); }
};

struct Query
{
    ll ID, L, R;
};

int main()
{
    ll N, Q;
    cin >> N >> Q;

    vector<ll> C(N);
    rep (i, N) { cin >> C[i]; --C[i]; }

    vector<Query> queries(Q);
    rep (i, Q)
    {
        auto& query = queries[i];
        query.ID = i;

        cin >> query.L >> query.R;
        --query.L;
        --query.R;
    }

    sort(queries.begin(), queries.end(), [](const auto& a, const auto& b)
    {
        return a.R < b.R;
    });

    vector<ll> ans(Q, -1);
    vector<ll> last(N, -1);

    // SegmentTree<ll> seg(N, 0LL, [](ll a, ll b) { return a + b; });
    BinaryIndexedTree<ll> bit(N);

    ll index = 0;

    for (const auto& query : queries)
    {
        while (index <= query.R)
        {
            auto& prev = last[C[index]];

            if (prev != -1) { bit.add(prev, -1); }
            bit.add(index, 1);

            prev = index;
            ++index;
        }

        ans[query.ID] = bit.sum(query.L, query.R);
    }

    for (const auto& x : ans) { cout << x << endl; }

    return 0;
}


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

def countingSort(A, k):
    n = len(A)
    C = [0] * (k+1)
    for i in A:
        C[i] += 1
    for i in range(1, k+1):
        C[i] += C[i-1]
    B = [0] * n
    A.reverse
    for i in A:
        B[C[i]-1] = i
        C[i] -= 1
    return B
def main():
    n = int(input())
    A = list(map(int, input(). split()))
    B = countingSort(A, 10000)
    print(' '.join(list(map(str, B))))

if __name__ == '__main__': main()


Measured memory_bytes: 240324
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int t = in.nextInt();
        int result = (int)(b*Math.floor((t+0.5)/a));
        System.out.println(result);
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int N,M,Q;
    cin >> N >> M >> Q;
    vector<string> S(N); 
    rep(i,N) cin >> S[i];
    vector<vector<int>> blue(N+1,vector<int>(M+1,0));
    rep(i,N) rep(j,M) if (S[i][j]=='1') ++blue[i+1][j+1];
    rep(i,N+1) rep(j,M) blue[i][j+1]+=blue[i][j];
    rep(j,M+1) rep(i,N) blue[i+1][j]+=blue[i][j];
    vector<vector<int>> eh(N+1,vector<int>(M,0)),ew(N,vector<int>(M+1,0));
    rep(i,N) rep(j,M-1) if (S[i][j]=='1'&&S[i][j+1]=='1') ++eh[i+1][j+1];
    rep(i,N+1) rep(j,M-1) eh[i][j+1]+=eh[i][j];
    rep(j,M) rep(i,N) eh[i+1][j]+=eh[i][j];
    rep(j,M) rep(i,N-1) if (S[i][j]=='1'&&S[i+1][j]=='1') ++ew[i+1][j+1];
    rep(j,M+1) rep(i,N-1) ew[i+1][j]+=ew[i][j];
    rep(i,N) rep(j,M) ew[i][j+1]+=ew[i][j];
    rep(i,Q){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        int node=blue[c][d]-blue[c][b-1]-blue[a-1][d]+blue[a-1][b-1];
        int edge=eh[c][d-1]-eh[a-1][d-1]-eh[c][b-1]+eh[a-1][b-1];
        edge+=ew[c-1][d]-ew[a-1][d]-ew[c-1][b-1]+ew[a-1][b-1];
        cout << node-edge << endl;
    }
}

Measured memory_bytes: 52992
// Try AtCoder
// 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 w = get!();
    let h = get!();
    let x = get!();
    let y = get!();
    
    let ans = (w * h) as f64 / 2.0;
    let unq = if x + x == w && y + y == h {
        1
    } else { 0 };
    
    println!("{} {}", ans, unq);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
const ll fact_table = 5000000;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[550010];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
//ll mod = 1000000007;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,idx,ans;
ll x[500005],y[500005],z[500005];
char s[500005];

int main(){
    cin >> n;
    if(n % 2 == 0){
        p((n - 1) / 2);
    }else{
        p((n - 1) / 2);
    }
    return 0;
}


















Measured memory_bytes: 13952
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_map>

using namespace std;

void solve() {
    string str; cin >> str;
    int flag = true;
    for(int i = 0; i < str.length()-1; i++){
        if(str.substr(i,1) == str.substr(i+1,1)){
            flag = false;
            break;
        }
    }
    cout << (flag?"Good":"Bad") << endl;
}

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

Measured memory_bytes: 256
import java.util.Scanner;

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

		String t;
		String e;
		int count = 0;

		String str = sc.nextLine();
		String[] strX = str.split("");

		t = strX[0];
		e = strX[strX.length - 1];

		for(int j = 0; j < strX.length - 2; j++){
			count++;
		}

		System.out.println(t + count + e);
	}

}


Measured memory_bytes: 21712
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    int N, remainder;
    char s[100] = {};
    scanf("%d",&N);
    
    if(N==0) s[0] = '0';
    while(N!=0)
    {
        remainder = N % -2;
		N = N / -2;

		if (remainder < 0)
		{
			remainder += 2;
			N += 1;
		}
        if(remainder == 1)
		    strcat(s,"1");
		else
		    strcat(s,"0");
    }
    int n = strlen(s);
    for(int i = 0; i < (int)(n/2); i++)
    {
        int temp = s[i];
        s[i] = s[n-i-1];
        s[n-i-1] = temp;
    }
    printf("%s\n",s);
}


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

double n,m;

int main(){
    scanf("%d %d",&n,&m);
    cout<<n/m<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    ll N;
    cin>>N;
    ll ans=0;
    for(ll i=1;i<=N;i++){
        ll j=N/i;
        ans+=j*(j+1)/2*i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

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

int main() {
	ll sum = 0, n;
	cin >> n;
	
	for(int i = 1; i <= n; i++) {
		if(i%3 != 0 && i%5 != 0) sum += i;
	}
	
	cout << sum << endl;
	
	return 0;
}

















Measured memory_bytes: 3640
#include<iostream>

using namespace::std;

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

  int sum = 0, mx = 0;
  for (int i=0; i<N; i++){
    int p;
    cin >> p;
    sum += p;
    mx = max(mx, p);
  }
  cout << sum - (mx / 2);
}

Measured memory_bytes: 256
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    S_s = ["Sunny", "Cloudy", "Rainy"]
    S = input()
    logging.info("Hello!")

    if S == S_s[0]:
        print(S_s[1])
    elif S == S_s[1]:
        print(S_s[2])
    elif S == S_s[2]:
        print(S_s[0])
        
    
if __name__ == "__main__":
    main()


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

int main() {
 string s; cin >> s;
  int n=s.size();
  int a,b,ans,cnta=0;
  for(int i=0;i<n;i++){
   if(s[i]=='A' &&cnta==0){
     a=i;
     cnta++;
   }
   if(s[i]=='Z')b=i;
  }
  cout << b-a+1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N, M;
	cin >> N >> M;
	std::vector<pair<int,int>> v(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> v[i].first >> v[i].second;
	}
	sort(v.begin(), v.end());
	bool b1[N];
	bool b2[N];
	for (int i = 0; i < N; ++i)
	{
		b1[i] = false;
		b2[i] = false;
	}
	for (int i = 0; i < M; ++i)
	{
		if(v[i].first == 1){
			b1[v[i].second] = true;
		}
	}
	for (int i = 0; i < M; ++i)
	{
		if(v[i].second == N){
			b2[v[i].first] = true;
		}
	}
	bool res = false;
	for (int i = 0; i < N; ++i)
	{
		if(b1[i] && b2[i]){
			res = true;
		}
	}
	if(res){
		cout << "POSSIBLE" << endl;
	}else{
		cout << "IMPOSSIBLE" << endl;
	}
}

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

using namespace std;

string a, b, c;

int init()
{
	cin >> a;
	int len = a.size();
	//sort(a, a + len);
	int C = 0, f = 0;
	for (int i = 0; i < len; ++i)
	{
		if(a[i] == 'C') {
			int cnt = 0;
			for (int j = i + 1; j < len; ++j)
			{
					if(a[j] == 'F') {
						cnt = 1;
					}
					if(cnt == 1) {
						printf("Yes\n"); return 0;
					}
			}

		}
	}
		printf("No\n");
}
int main()
{
	init();

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
int in(){int a;scanf("%d",&a);return a;}
ll lin(){ll a;scanf("%lld",&a);return a;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

int n;
int a[200010];
pii b[200010];
int bit[200010];

int sum(int i)
{
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add(int i, int x)
{
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}

int main()
{
    omajinai;

    cin >> n;

    rep(i, n) cin >> a[i], b[i] = pii(a[i], i);

    sort(b, b+n);

    rep(i, n) {
        a[b[i].scd] = i+1;
    }

    ll ans = 0;

    rep(i, n) {
        ans += i - sum(a[i]);
        add(a[i], 1);
    }

    cout << ans << endl;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

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

  int n;
  cin >> n;
  int l, r;
  int cnt = 0;
  rep(i, 0, n) {
    cin >> l >> r;
    cnt += (r-l+1);
  }

  cout << cnt << endl;

  return 0;
};


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n+2,0),b(n+2,0),c(n+2,0);
  for(int i=1 ;i<=n ;i++){
    cin >> a[i];
  }
  for(int i=0 ;i<=n ;i++){
    b[i+1] = abs(a[i+1] - a[i]) + b[i];
    c[i+1] = abs(a[n+1-i] - a[n-i]) + c[i];
  }
  for(int i=1 ;i<=n ;i++){
    cout << b[i-1] + abs(a[i+1]-a[i-1]) + c[n-i] << endl;
  }
  
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

const int N = 20;
ll mat[N][N];
ll cost[N];

int main(){
	ll n, m, x;
	cin >> n >> m >> x;
	
	fr(i,n){ 
		scanf("%lld", cost+i);
		fr(j,m){ 
		scanf("%lld",mat[i]+j);
		}
	}
	
	
	ll ans = LLONG_MAX;
	
	fr(mask,1<<n){
		ll cur_cost = 0;
		vector<ll> lvl(m,0);
		fr(i,n){
			if(mask&(1<<i)){
				cur_cost+=cost[i];
				fr(j,m) lvl[j]+=mat[i][j];
			}
		}
		int ok = 1;
		fr(j,m) if(lvl[j]<x) ok = 0;
		if(ok){
			ans = min(ans,cur_cost);
		}
	}
	if(ans==LLONG_MAX) ans = -1;
	printf("%lld\n", ans);
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    string S, T;
    cin >> N >> S >> T;

    rep(i, N) {
        cout << S[i] << T[i];
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>

#define DEBUG 0

using namespace std;
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//https://atcoder.jp/contests/abc046/tasks/arc062_b

int main(){

#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    string s;
    cin >> s;

    // (今までにパーを出した回数) <=(今までにグーを出した回数)
    //最初はg確定

    //得点(勝ったターンの数) − (負けたターンの数)
    //勝ちと負けは同じ価値
    //gでは勝つことはできない
    //2/3 g -> 0
    //1/3 g -> -1
    //0/3 g -> -2
    //7/10 g -> 2

    int gCnt = 0;
    REP(i,s.size())
    {
        if(s[i] == 'g')++gCnt;
    }

    int han = (s.size()+1)/2;

    int res = gCnt - han;

    cout << res << endl;
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int placenum = int.Parse(ReadLine());
        string[] coststr = ReadLine().Split(' ');

        int[] cost = new int[placenum];
        for(int i=0;i<placenum;i++){
            cost[i] = int.Parse(coststr[i]);
        }
        
        int[] dp = new int[placenum+10];
        
        for(int i=1;i<placenum;i++){
            if(i-2<0){
                dp[i] = dp[i-1] + Abs(cost[i] - cost[i-1]);
            }else{
                dp[i] = Min(dp[i-1] + Abs(cost[i] - cost[i-1]),dp[i-2] + Abs(cost[i] - cost[i-2]));
            }
        }
        WriteLine(dp[placenum-1]);
    }
}

Measured memory_bytes: 16864
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  double a;
  while(cin>>a){
    double ans = a;
    REP(i,9){
      if(i%2 == 0)
	a *= 2.0;
      else
	a /= 3.0;
      ans += a;
    }
    printf("%.8f\n",ans);
  }
  return 0;
}

Measured memory_bytes: 0
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var inputStones = Console.ReadLine();

            int W = 0;
            int R = CountChar(inputStones, "R");

            int result = R ;

            for(int i = 0; i < n; i++)
            {
                if(inputStones[i] == 'R')
                {
                    R -= 1;
                }
                else if(inputStones[i] == 'W')
                {
                    W += 1;
                }

                result = Math.Min(result, Math.Max(W, R));
            }

            Console.WriteLine(result);
        }

        public static int CountChar(string s, string c)
        {
            return s.Length - s.Replace(c , "").Length;
        }
    }
}



Measured memory_bytes: 30252
n = gets.to_i
ans = 0
for i in 2..((n**0.5))
  count = 0
  base = 1
  while n % i == 0
    count += 1
    if count == base
      ans += 1
      base += 1
      count = 0
    end
    n = n / i
  end
end
if n == 1
  puts ans
else
  puts ans + 1
end

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

#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define MOD 1000000007
#define INF 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y) 
#define mem(a,val) memset(a,val,sizeof(a))
#define f first
#define s second

 
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
ll modinv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

ll ncr(ll n, ll k)  
{  
    ll res = 1;  
  
    // Since C(n, k) = C(n, n-k)  
    if ( k > n - k )  
        k = n - k;  
  
    // Calculate value of  
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]  
    for (ll i = 0; i < k; ++i)  
    {  
        res = (res * (n - i)%MOD)%MOD;  
        res = (res * modinv(i+1,MOD))%MOD;    
    }  
  
    return res;  
} 


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

	ll n,a,b;
	cin>>n>>a>>b;

	ll ans=0;
	ans = (power(2,n,MOD)- ncr(n,a)-ncr(n,b) -1 + MOD+MOD+MOD+MOD)%MOD;
	cout<<ans;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();

        int sum = 0;
        if (a < b) {
            sum = (x / 1000 + (x % 1000 > 0 ? 1 : 0)) * a;
        } else if (a > 2 * b) {
            sum = (x / 500 + (x % 500 > 0 ? 1 : 0)) * b;
        } else {
            sum += a * (x / 1000);
            x = x % 1000;
            if (x / 500 > 0 && x % 500 != 0) sum += a;
            else if (x > 0) sum += b;
        }
        System.out.println(sum);
    }
}


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

int main() {
  int a[2];
  cin>>a[0]>>a[1];
  int b[3];
  for(int i=0;i<2;i++){
    if(a[i]==2) b[2]++;
    else if(a[i]==4 || a[i]==6 || a[i]==9 || a[i]==11) b[1]++;
    else b[0]++;
  }
  if(b[0]==2 || b[1]==2 || b[2]==2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
const int N = 1e5+10;
int n, k, a[N];
int main() {
	scanf("%d%d", &n, &k);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	std::sort(a+1, a+n+1);
	int ans = 0;
	for (int i=1; i<=k; i++) ans += a[i];
	printf("%d\n", ans);
}

Measured memory_bytes: 1712
#include<cstdio>

using namespace std;
int t,count=0;
void dfs(long long num,int flag357){
    if(num <= t){
        if(flag357==07)
            count++;
        dfs(num*10+3,flag357|01);
        dfs(num*10+5,flag357|02);
        dfs(num*10+7,flag357|04);
    }
}
int main()
{
    scanf("%d",&t);
    dfs(0,0);
    printf("%d",count);
    return 0;
}


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

typedef long long ll;

int N,K;
char S[200020] = {0};
int a,b;
ll ans = 10000000000;

int main()
{
    scanf("%d",&N);
    printf("%d\n",(int)sqrt(N) * (int)sqrt(N));
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		int[] abo = {0,0,0,0};
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String tmp = null;
		int cup = 0;
		int mun = 0;
		int ter = 0;
		String[] rrr;
		int st = 0,sr = 0;
		int mon = 0;
		int syo=0,hisi=0;
		char[] ccc,ddd;
		
		
		try {
			tmp = br.readLine();
		} catch (IOException e1) {
			// TODO 自動生成された catch ブロック
			e1.printStackTrace();
		}
		mun = Integer.parseInt(tmp);
		
		int tmo;
		
		for(int i=0;i<mun;i++){
			
			try {
				tmp = br.readLine();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			ccc = new char[tmp.length()];
			ddd = new char[tmp.length()];
			for(int j=0;j<tmp.length();j++){
				ccc[j] = tmp.charAt(j);
				ddd[j] = tmp.charAt(j);
			}
			
			for(int s=0;s<ccc.length;s++){
				for(int j=0;j<ccc.length;j++){
					if(ccc[s] < ccc[j]){
						tmo = ccc[s];
						ccc[s] = ccc[j];
						ccc[j] = (char) tmo;
					}
					if(ddd[s] > ddd[j]){
						tmo = ddd[s];
						ddd[s] = ddd[j];
						ddd[j] = (char) tmo;
					}
				}
			}
			String tyu = String.valueOf(ccc);
			String ghj = String.valueOf(ddd);
			System.out.println((Integer.parseInt(ghj) - Integer.parseInt(tyu)));
		}

	}

}

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

ll GCD(ll m, ll n){
   ll tmp;
   while(m%n != 0){
       tmp = n;
       n = m % n;
       m = tmp;
   }
   return n;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[n];
    cin >> a[0];
    ll gcd_min = 1e10;
    ll gcd_min_idx = -1;

    for (ll i = 1; i < n; ++i){
        cin >> a[i];
        ll gcd_current = GCD(a[0], a[i]);
        if(gcd_min > gcd_current){
            gcd_min = gcd_current;
            gcd_min_idx = i;
        }
    }
    ll gcd1 = a[0];
    for(ll i = 1; i < n; ++i){
        if(i == gcd_min_idx)continue;
        gcd1 = GCD(gcd1, a[i]);
    }

    ll gcd2 = a[1];
    for(ll i = 2; i < n; ++i){
        gcd2 = GCD(gcd2, a[i]);
    }

    ll gcd_min2 = 1e10;
    ll gcd_min_idx2 = -1;

    for (ll i = 0; i < n-1; ++i){
        ll gcd_current = GCD(a[n-1], a[i]);
        if(gcd_min2 > gcd_current){
            gcd_min2 = gcd_current;
            gcd_min_idx2 = i;
        }
    }
    ll gcd3 = a[n-1];
    for(ll i = 0; i < n-1; ++i){
        if(i == gcd_min_idx2)continue;
        gcd3 = GCD(gcd3, a[i]);
    }

    ll gcd4 = a[0];
    for(ll i = 1; i < n-1; ++i){
        gcd4 = GCD(gcd4, a[i]);
    }

    cout << max(max(gcd1, gcd2), max(gcd3, gcd4)) << endl;
}

Measured memory_bytes: 1024
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;

char s[N];
int sum[N];
int main(){
    int n;in>>n;
    in>>s+1;
    int cnt=0;
    int ans=0;
    rep(i,1,n){
        sum[i]=sum[i-1];
        if(s[i]=='R'){
            ++sum[i];
        }
        
    }
    out<<sum[n]-sum[sum[n]];
    return 0;
}


Measured memory_bytes: 4672
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S;
	cin >> S;
	cout << "2018/" << S.substr(5) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
ll a[400000],sum[2000000],sz[4000000];
map<ll,ll>d,vs;
vector<ll> v[40];
queue<ll>q;

int main()
{
    IO;
    ll i, j, n, m,mm=1e6, k=1, t, ans=0,l=0, g, p;
    cin>>n>>m>>l>>k;
    j=min(n,k); k-=j;
    t=min(m,k); k-=t;
    p=min(l,k);
    cout<<j-p<<endl;
    return 0;
}


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


int main()
{

    int a,b,c,count,sum;
    cin>>a>>b>>c;
    int k=max(a,max(b,c));
    int j=min(a,min(b,c));
    count=a+b+c;
    sum=count-(k+j);//middle
    cout<<(abs(a-sum)+abs(b-sum)+abs(c-sum))<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)a
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    ll a; ld b;
    cin >> a >> b;
    b *= 100;
    b = round(b);
    ll B = b;
    ll ans = a * B / 100;
    cout << ans;
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


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

int main() {
	v(a); v(b);
	if (a % b == 0) cout << -1 << endl;
	else {
		int o;
		for (int i = 0; i < i + 1; i++) {
			o = a * (i + 1);
			if (o % b != 0) break;
		}
		cout << o << endl;
	}
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt64

func maxInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func minInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	S := nextString()
	T := nextString()
	min := len(S)
	for i := 0; i <= len(S)-len(T); i++ {
		cnt := 0
		for j := 0; j < len(T); j++ {
			if S[i+j] != T[j] {
				cnt++
			}
		}
		min = minInt(min, cnt)
	}
	fmt.Println(min)
}


Measured memory_bytes: 1776
import os, sys, re, math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

(A, B, C, D) = [int(n) for n in input().split()]

minC = (A + (C - 1)) // C
maxC = B // C

minD = (A + (D - 1)) // D
maxD = B // D

CD = lcm(C, D)
minCD = (A + (CD - 1)) // CD
maxCD = B // CD

countC = maxC - minC + 1
countD = maxD - minD + 1
countCD = maxCD - minCD + 1

print(B - A - (countC + countD - countCD) + 1)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF (ll)(1e18)
#define inf 0x7fffffff
#define inff 100000
#define ff first
#define ss second
#define sz(x) ((int) (x).size())
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define rep(i,N) for(int i = 0;i < N;i++)
#define frep(i,a,b) for(int i = a;i <= b;i++)
#define pii pair<int , int>
#define pll pair<ll , ll>
#define vii vector<int>
#define vpii vector< pii >
#define fill(A,v) memset(A,v,sizeof(A))
#define setbits(x) __builtin_popcountll(x)
#define print(A,j,k) for(int ii=j;ii<k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
#define SQRT 350
#define CASES int t;cin>>t;while(t--)
#define FILE freopen("inp.txt" , "r" , stdin);
#define ld long double
 
const int MOD = 1e9 + 7;
const int N = 1e6 + 5;

ll dp[55][2505];
ll A[55];
 
int main(int argc, char const *argv[])
{
    fast;

    int n , a;
    cin >> n >> a;

    //dp[i][j] denote number of subsets of size exactly i and sum j
    rep(i , n)
        cin >> A[i + 1];

    dp[0][0] = 1;
    frep(i , 1 , n) {

        for(int k = i - 1;k >= 0;k--)
            frep(j , 0 , 2500 - A[i]) {
                dp[k + 1][j + A[i]] = dp[k + 1][j + A[i]] + dp[k][j];
            }

    }

    ll ans = 0;
    frep(i , 1 , n)
        ans += dp[i][i * a];
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 1280