akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


int main() {
  int n;
  cin >> n;
  vi p(n);
  rep (i, n) {
    cin >> p[i];
  }
  int ans = 0;
  rep1 (i, n - 2) {
    vi p2;
    for (int j = -1; j <= 1; j++) {
      p2.push_back(p[i + j]);
    }
    sort(all(p2));
    if (p2[1] == p[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100005],pre[100005],bk[100005];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	int mx=0,t1,t2;
	pre[0]=a[0];
	for(int i=1;i<n;i++) pre[i]=__gcd(pre[i-1],a[i]);
	bk[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--) bk[i]=__gcd(bk[i+1],a[i]);
	int ans=0;
	for(int i=0;i<n;i++) ans=max(ans,__gcd(pre[i-1],bk[i+1]));
	cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mn=1e6+10;
const ll mod=1e9+7;

int main(){
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    printf("%.12f ",0.5*w*h);
    if(x*2==w&&y*2==h)printf("1");
    else printf("0");
}


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

using namespace std;

typedef long long int ll;

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

typedef pair<int,int> pair;

int main(){
    ll h,w;
    cin >> h >> w;
    ll ans=h*w;
    if(ans%2==1){
        ans+=1;
    }

    if(h==1 || w==1){
        ans=1*2;
    }

    cout << ans/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int n;
    string s;
    cin >> n >> s;
    string ans = "";
    rep(i,s.size()) {
        if((s[i]-'A')+n >= 26) {
            ans += 'A'+((s[i]-'A')+n)%26;
            continue;
        }
        ans += s[i]+n;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt(), H = scan.nextInt(), x = scan.nextInt(), y = scan.nextInt(), r = scan.nextInt();

        if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26256
#include<stdio.h>
int main()
{
    int a,b,c,sum=0;
    scanf("%d%d%d",&a,&b,&c);
    if(a!=b)
        sum+=1;
    if(a!=c)
        sum+=1;
    if(b!=c)
        sum+=1;
    if (sum==0)
        printf("1");
    else
        printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll unsigned long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)



int main(){
ll N;
cin>>N;
vector<ll> A(N);

for(ll i=0;i<N;i++){
    cin>>A[i];
}

vector<ll> wa(N+1);
wa[0]=0;
for(ll i=0;i<N;i++){
    wa[i+1]=wa[i]+A[i];
}
ll ans=0;
for(ll i=0;i<N-1;i++){
ans+= (A[i]*((wa[N]-wa[1+i])%MOD)%MOD);
ans%=MOD;

}

cout<<ans%MOD<<endl;





}











Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,m;
    cin>>n>>m;
    cout<<(min(n,m)==1?(n*m==1?1:max(n,m)-2):n*m-2*n-2*m+4)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "stdio.h"

int main(int argc, char const *argv[]) {

  int N,M,C,i,j;
  scanf("%d%d%d",&N,&M,&C );
  int A[N][M];
  int B[M];
  for (i = 0; i < M; i++) {
    scanf("%d", &B[i]);
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < M; j++) {
      scanf("%d", &A[i][j]);
    }
  }
  int ans=0;
  int pre=0;
  for (i = 0; i < N; i++) {
    pre=0;
    for (j = 0; j < M; j++) {
      pre=pre+B[j]*A[i][j];
    }

    if (pre+C>0) {
      ans++;
    }
  }
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let k: usize = sc.read();
    let x: usize = sc.read();
    let result = if 500 * k >= x { "Yes" } else { "No" };
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
package main

import (
    "fmt"
)

func main() {
    var s []byte
    fmt.Scan(&s)
    var cnt1, cnt2 int 
    b1 := byte('0')
    b2 := byte('1')
    for _, b := range s { 
        if b != b1 {
            cnt1++
        }   
        b1 = toggle(b1)
        if b != b2 {
            cnt2++
        }   
        b2 = toggle(b2)
    }   
    if cnt1 < cnt2 {
        fmt.Println(cnt1)
    } else {
        fmt.Println(cnt2)
    }   
}

func toggle(b byte) byte {
    if b == '0' {
        return '1' 
    }   
    return '0' 
}


Measured memory_bytes: 1408
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int a = sc.nextInt(), b = sc.nextInt();
            int c = a+b;
            int x = 1;
            while (c >= 10) {
                c /= 10;
                x++;
           }
            System.out.println(x);
        }
    }
}

Measured memory_bytes: 20596
N,*P=map(int,open(0).read().split());I={P[i]:i+1for i in range(N)};I[0]=T=f=0
while N>1:
 x=I[f];y=I[N-1];z=I[N]
 if(z>y)^(y>x)^(x>z):T+=1;f=N
 N-=1
print(T)

Measured memory_bytes: 37884
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

const int MAX_V = 1e6;
int n,m;
vector<int> G[MAX_V];
int dp[MAX_V];
//メモリ犠牲
bool visited[MAX_V];

int dfs(int v){
  if(visited[v]) return dp[v];
  visited[v] = true;
  int val = 0;
  REP(to, G[v].size()){
    val = max(val, dfs(G[v][to])+1);
  }
  return dp[v] = val;
}

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

  REP(i, m){
    int x, y;
    cin >> x >> y;
    x--;y--;
    G[x].push_back(y);
  }
  //時間犠牲
  //REP(i, MAX_V) dp[i] = -1;
  int ans = 0;
  REP(i, n) {
    ans = max(ans, dfs(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 30848
#include<stdio.h>
#include<stdlib.h>

int main (void){
  
  int a,b,c,d,e,f=0,g[10000],h=0,i=0,p=0,z=0,x=0;
  scanf("%d%d%d",&a,&b,&c);
  if(1<=a<=10000 && 1<=b<=10000 && 1<=c<=10000 && a<=b){
    for(e=1;c>=e;e++){
      if(c%e==0){
	g[h]=e;
	h++;
	if(g[h-1]==a){
	  z++;
	}
  }
    
    }
      for(e=1;a>=e;e++){
	if(e==g[i]){
	  p++;
	  i++;
	}
      }
	i=0;
	for(e=1;b>=e;e++){
	  if(e==g[i]){
	    z++;
	    i++;
	  }
	}
	x=z-p;

	printf("%d\n",x);
  }
  return(0);
}



Measured memory_bytes: 2116
import itertools
a=[]
n=int(input())
b=[]
for i in range(n):
    b.append(i+1)
for permutation in itertools.permutations(b):
    a.append(list(permutation))
c=a.index(list(map(int,input().split())))+1
d=a.index(list(map(int,input().split())))+1
print(abs(d-c))

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {
	
	
	int n;
	cin >> n;
	VI a(n);
	VI b;
	REP(i, n)cin >> a[i];
	b = a;
	sort(ALL(b));
	reverse(ALL(b));
	REP(i, n) {
		if (a[i] == b[0])cout << b[1] << endl;
		else cout << b[0] << endl;
	}

	return 0;
}



Measured memory_bytes: 3200
n = int(input())
w = [int(x) for x in input().split()]

t = int(n/2)
s1 = sum(w[0:t])
s2 = sum(w[t:n])

if s1 == s2:print(0)
else:
    if s1<s2: a=1
    if s1>s2: a=-1
    out = abs(s1-s2)

    for xi in range(n):
        t = t+a
        if a == 1:
            s1 += w[t-1]
            s2 -= w[t-1]
        if a ==-1:
            s1 -= w[t]
            s2 += w[t]
        if out<abs(s1-s2):break
        out = abs(s1-s2)

print(out)


Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
string s;
LL su = 0;

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

	cin >> s;
	for(auto u : s){
		su += (u - '0');
		//su %= 9;
		//cout << u << " " << su << endl;
	}

	if((su%9) == 0){
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;

	cout.flush();
	return 0;
}

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

using namespace std;

template <typename T>
using Vec = vector<T>;

typedef long double ld;
typedef long long ll;

#define FO(i, N) for (int (i) = 0; (i) < (N); ++(i))
#define FOll(i, N) for (ll (i) = 0; (i) < (N); ++(i))
#define READALL(c) for (auto &e : c) { cin >> e; }
#define PRINTALL(c) for (const auto &e : c) { cout << e << "\t"; } cout << "\n";
#define MP(x, y) (make_pair((x), (y)))
#define MT(...) make_tuple(__VA_ARGS__)
#define G(i, x) get<i>(x)
#define ALL(x) begin(x), end(x)

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

	int N, M;
	cin >> N >> M;

	map<int, Vec<int>> st, en;
	FO(i, M) {
		int a, b;
		cin >> a >> b;
		--a;
		b -= 2;
		st[a].push_back(i);
		en[b].push_back(i);
	}

	set<int> open;
	int cnt = 0;

	FO(i, N) {
		for (int s : st[i]) {
			open.insert(s);
		}
		for (int e : en[i]) if (open.count(e)) {
			++cnt;
			open.clear();
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 22908
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)

N = _I()
T = set([_I() for _ in range(N)])

def lcm(a,b):
    g = fractions.gcd(a,b)
    return a * b // g

l = 1
for t in T:
    l = lcm(l, t)

print(l)


Measured memory_bytes: 5460
import sys
input = sys.stdin.buffer.readline
from operator import itemgetter


class BIT:
    """一点加算、区間取得クエリをそれぞれO(logN)で答えるデータ構造"""
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def build(self, array):
        """arrayを初期値とするBinaryIndexTreeを構築する O(N)"""
        for i in range(self.size):
            self.bit[i + 1] = array[i]
        for i in range(1, self.size):
            if i + (i & -i) > self.size:
                continue
            self.bit[i + (i & -i)] += self.bit[i]

    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def add(self, i, val):
        """i番目の要素にvalを加える"""
        i += 1
        while i <= self.size:
            self.bit[i] += val
            i += i & -i

    def get_sum(self, l, r):
        """区間[l, r)の和を求める"""
        return self._sum(r) - self._sum(l)


n, q = map(int, input().split())
c = list(map(int, input().split()))
query = []
OFFSET = 10 ** 6
for i in range(q):
    l, r = map(int, input().split())
    query.append(i + OFFSET * l + OFFSET * OFFSET * r)


bit = BIT(n)
memo = {}
ans = [0] * q
query.sort()
ind = 0

for tmp in query:
    i = tmp % OFFSET
    l = (tmp // OFFSET) % OFFSET
    r = tmp // (OFFSET * OFFSET)
    while ind < r:
        if c[ind] in memo:
            old_ind = memo[c[ind]]
        else:
            old_ind = -1
        memo[c[ind]] = ind
        bit.add(ind, 1)
        if old_ind != -1:
            bit.add(old_ind, -1)
        ind += 1
    ans[i] = bit.get_sum(l - 1, r)

print("\n".join(map(str, ans)))


Measured memory_bytes: 205284
N = int(input())
a = list(map(int, input().split()))
A = []
B = []
C = []
for i in range(N):
  if a[i]%4 == 0:
    A.append(a[i])
  elif a[i]%2 == 0:
    B.append(a[i])
  else:
    C.append(a[i])
if len(B) == 0 and len(A)+1 >= len(C):
  print('Yes')
elif len(A) >= len(C):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 20040
#include<bits/stdc++.h>
using namespace std;
#define nn 65536*8
#define ll long long
#define mod 1000000007

vector<int> v[nn];
int p[nn],q[nn];
int n,k;int in[nn];
void solve()
{
	for(int i=1;i<=n;i++) 
	{
		for(int j=0;j<v[i].size();j++)
			in[v[i][j]]++;
	}
	priority_queue<int> pq;
	for(int i=1;i<=n;i++) if(in[i]==0) pq.push(-i);
	vector<int> ans;
	while(pq.size())
	{
		int x=-pq.top();pq.pop();ans.push_back(x);
		for(int i=0;i<v[x].size();i++)
		{
			in[v[x][i]]--;
			if(!in[v[x][i]]) pq.push(-v[x][i]);
		}
	}
	for(int i=1;i<=n;i++) p[ans[i-1]]=i;
	for(int i=1;i<=n;i++) printf("%d\n",p[i]);
}

struct segmenttree{
	int pos[nn*2+10];
	int ls[nn*2+10],rs[nn*2+10];int tot;
	#define lc ls[id]
	#define rc rs[id]
	#define mid (l+r)/2
	void build(int l,int r,int &id)
	{
		if(!id) id=++tot;
		if(l==r)
		{
			pos[id]=0;
			return ;
		}
		build(l,mid,lc);build(mid+1,r,rc);
		pos[id]=max(pos[lc],pos[rc]);
	}
	void update(int x,int l,int r,int id,int a)
	{
		if(l==r)
		{
			pos[id]=a;
			return ;
		}
		if(x<=mid) update(x,l,mid,lc,a);
		else update(x,mid+1,r,rc,a);pos[id]=max(pos[lc],pos[rc]);
	}
	int query(int a,int b,int l,int r,int id)
	{
		if(l>=a and r<=b) return pos[id];
		int sm=0;
		if(a<=mid) sm=max(sm,query(a,b,l,mid,lc));
		if(b>mid) sm=max(sm,query(a,b,mid+1,r,rc));
		return sm;
	}
}trcyx;
int check(int i,int j)
{
	if(j&&i&&(i-j))
		if(abs(q[i]-q[j])<k)
		v[q[i]].push_back(q[j]);
}
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) scanf("%d",&p[i]),q[p[i]]=i;
	int rt=0;trcyx.build(1,n,rt);
	for(int i=1;i<=n;i++)
	{
		int j;
		j=trcyx.query(q[i]-k+1,q[i],1,n,rt);
		check(j,i);
		j=trcyx.query(q[i],q[i]+k-1,1,n,rt);
		check(j,i);
		trcyx.update(q[i],1,n,rt,i);
	}

	solve();
	
	return 0; 
}

Measured memory_bytes: 52592
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var a = s.ToCharArray();
        Array.Sort(a);
        Console.WriteLine(a[0] == 'a' && a[1] == 'b' && a[2] == 'c' ? "Yes":"No");
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
set<int> se[26];

// inline int c2i(char c){
//     return (int)(c-'a');
// }
int main(){
    int n;
    string s;
    int q;
    cin >> n >> s >> q;
    //vector<set<int>> se(26);
    rep(i,n){
        se[s[i]-'a'].insert(i);
    }
    
    
    rep(qi,q){
        int a;
        cin >> a;
        if(a==1){
            int i;
            char c;
            cin >> i >> c;
            i--;
            //cout << i << c << endl;    
            se[s[i]-'a'].erase(i);
            s[i] = c;
            se[c-'a'].insert(i);
        }else{
            int l,r;
            cin >> l >> r;
            l--; r--;
            int ans = 0;
            rep(i,26){
                //auto tmp = lower_bound(se[i].begin(),se[i].end(),l);
                auto tmp = se[i].lower_bound(l);
                if(tmp != se[i].end() && *tmp<=r) ans++;
            }
            cout << ans << endl;
            //cout << "aaaaa" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; ++i) cin >> a[i];
	vector<int> res(n + 1);
	vector<int> ans;
	for (int i = n; i >= 1; --i) {
		int tmp = 0;
		for (int j = i + i; j <= n; j += i) {
			tmp += res[j];
		}
		if (a[i]) {
			if (tmp % 2 == 0) res[i] = 1;
		}
		else {
			if (tmp % 2 != 0) res[i] = 1;
		}
		if (res[i] == 1) ans.push_back(i);
	}
	cout << ans.size() << endl;
	reverse(ans.begin(), ans.end());
	for (int c : ans) cout << c << "\n";
	return 0;
}

Measured memory_bytes: 5412
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim_right().to_owned()
    }};
}

fn main() {
    let a = read_line!().parse::<i32>().unwrap();
    read_line!();
    read_line!();
    read_line!();
    let e = read_line!().parse::<i32>().unwrap();
    let k = read_line!().parse::<i32>().unwrap();
    if e - a <= k {
        println!("Yay!");
    } else {
        println!(":(");
    }
}

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

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int n,L;string a[105]; 
int main()
{
	cin>>n>>L;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)cout<<a[i];
	cout<<endl;
	return 0;
}


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

int main(int argc, char const *argv[]) {
    int a, b;
    cin >> a >> b;

    if ((a == 1 && b == 2) || (a == 2 && b == 1)) cout << 3 << endl;
    else if ((a == 2 && b == 3) || (a == 3 && b == 2)) cout << 1 << endl;
    else if ((a == 3 && b == 1) || (a == 1 && b == 3)) cout << 2 << endl;
    return 0;
}


Measured memory_bytes: 3572
#include <stdio.h>

int N;
int T[500010] ={0};

void swap(int T[], int x, int y)
{
    int tmp = T[x];
    T[x] = T[y];
    T[y] = tmp;
}

void maxHeapify(int T[], int i)
{
    int parent = i;
    int left = (i+1)*2 - 1;
    int right = (i+1)*2;
    
    int largest;
    if (right <= N && T[parent] < T[right]) {
        largest = right;
    }
    else {
        largest = parent;
    }
    
    if (left <= N && T[largest] < T[left]) {
        largest = left;
    }
    
    
    /*
    int j;
    printf("p:%d -- ", i);
    for (j = 0; j < 10; j++) {
        printf(" %d", T[j]);
    }puts("");
    */
    
    if (largest != parent) {
        swap(T, largest, parent);
        maxHeapify(T, largest);
    }    
    
    return;
}


int main()
{
    int i, j;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &T[i]);
    }
    for (i = N/2+1; i >= 0; i--) {
        maxHeapify(T, i);
    }
    for (i = 0; i < N; i++) {
        printf(" %d", T[i]);
    }
    puts("");
 
    return 0;
}

Measured memory_bytes: 2560
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007


int main(int argc, char const *argv[]) {
  int n,a[110];
  ll ans=99999999;
  std::cin >> n;
  for(int i=0; i<n; i++) std::cin >> a[i];

  for(int i=-100; i<=100; i++){
    ll sum=0;
    for(int j=0; j<n; j++){
      sum+=(a[j]-i)*(a[j]-i);
    }
    ans=min(ans,sum);
  }
  std::cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define gc getchar
#define rint register int
#define rep(i,u,z) for(rint i=u;i<=z;++i)
#define reb(i,u,z) for(rint i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

int n,ans,digcnt;
int prefered[4]={0,3,5,7},a[11];

inline int readint(){
	int rt=0,sign=1;
	char ch=gc();
	while(ch<'0'||ch>'9'){
		if(ch=='-')sign=-1;
	    ch=gc();
	}
	while(ch>='0'&&ch<='9'){
		rt=(rt<<3)+(rt<<1)+(ch&15);
		ch=gc();
	}
	return rt*sign;
}
inline void dfs(int crt,int nd){
	if(crt>nd){
		rint nu=0;
		bool thr=false,fiv=false,sev=false;
		rep(i,1,crt-1){
			nu=(nu<<3)+(nu<<1)+a[i];
			if(a[i]==3)thr=true;
			else if(a[i]==5)fiv=true;
			else if(a[i]==7)sev=true;
		}
		if(nu<=n&&thr&&fiv&&sev)++ans;
		return;
	}
	rep(i,1,3){
		a[crt]=prefered[i];
		dfs(crt+1,nd);
		a[crt]=0;
	}
}
int main(){
	n=readint();
	if(n<357){
		putchar('0');
		return 0;
	}
	int rn=n;
	while(rn)++digcnt,rn/=10;
	rep(i,3,digcnt){
		dfs(1,i);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
LL n,b,c;
string  a;
int main()
{
  int x;
  cin >> x;
  for(int i=1;i<180;i++){
    if(i*360%x==0){
  cout << i*360/x;
      return 0;
  }
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
constexpr int IINF = INT_MAX;

int main() {
    int n, d[105][105];
    while(cin >> n){
        for(int i=0;i<n;i++) fill(d[i], d[i]+n, IINF/3);
        for(int i=0;i<n;i++){
            int r, k;
            cin >> r >> k;
            r--;
            for(int j=0;j<k;j++){
                int t;
                cin >> t;
                t--;
                d[r][t] = 1;
            }
        }
        for(int k=0;k<n;k++){
            for(int i=0;i<n;i++){
                for(int j=0;j<n;j++){
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
        int p;
        cin >> p;
        for(int i=0;i<p;i++){
            int s, g, v;
            cin >> s >> g >> v;
            s--; g--;
            if(d[s][g] < v){
                cout << d[s][g]+1 << endl;
            }
            else{
                cout << "NA" << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;



int main(){
    ll n;
    cin>>n;
    int k;
    cin>>k;
    int digits=0;
    while(n>0){
        n=n/k;
        digits+=1;
    }
    cout<<digits;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int sum_v[2005][2005] = {};
int sum_e[2][2005][2005] = {};
int N, M, Q;
string S[2005];

inline int f(int sum[2005][2005], int x1, int y1, int x2, int y2){
	return sum[x2][y2] - sum[x1][y2] - sum[x2][y1] + sum[x1][y1];
}

int main(){
	ios_base::sync_with_stdio(false);

	cin >> N >> M >> Q;
	rep(i,N) cin >> S[i];

	rep(i,N) rep(j,M){
		sum_v[i+1][j+1] = sum_v[i+1][j] + sum_v[i][j+1] - sum_v[i][j];
		rep(k,2) sum_e[k][i+1][j+1] = sum_e[k][i+1][j] + sum_e[k][i][j+1] - sum_e[k][i][j];
		if( S[i][j] == '1' ){
			sum_v[i+1][j+1]++;
			if( i>0 && S[i-1][j] == '1' ) sum_e[0][i+1][j+1]++;
			if( j>0 && S[i][j-1] == '1' ) sum_e[1][i+1][j+1]++;
		}
	}

	rep(i,Q){
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int v  = f(sum_v, x1-1, y1-1, x2, y2);
		int e0 = f(sum_e[0], x1, y1-1, x2, y2);
		int e1 = f(sum_e[1], x1-1, y1, x2, y2);
		//cout << v << " " << e0 << " " << e1 << endl;
		cout << v - e0 - e1 << endl;
	}

	return 0;
}

Measured memory_bytes: 53248
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

int main(){
    int N;
    cin >> N;
    map<int,int> D;
    for(int i = 0; i < N; i++){
        int d;
        cin >> d;
        D[d]++;
    }
    cout << D.size() << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[105],sum;
int main(){
	
	cin>>n; int x; cin>>x;
	rep(i,n){
		a[i]=x++;
		sum+=a[i];
	}
	int ans = -INF;
	rep(i,n){
		int s=0;
		rep(j,n)if(i!=j) s+=a[j];
		if(abs(ans-sum) > abs(s-sum)) ans = s;
	}
cout<<ans<<endl;}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long m = sc.nextLong();
    HashMap<Long, Long> map = new HashMap<Long, Long>();
    long sum = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      sum = (sum + a) % m;
      if(map.containsKey(sum)) {
        map.put(sum, map.get(sum) + 1);
      } else {
        map.put(sum, (long)1);
      }
    }
    long ans = 0;
    if(map.containsKey((long)0)) ans = map.get((long)0);
    for(long key : map.keySet()) {
      ans += ((map.get(key) * (map.get(key) - 1)) / 2);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 66456
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    while(cin >> n){
        cout << 180 * (n - 2) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
W, H, N = map(int, input().split())
minx, maxx = 0, W
miny, maxy = 0, H

for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        minx = max(x, minx)
    elif a == 2:
        maxx = min(x, maxx)
    elif a == 3:
        miny = max(y, miny)
    elif a == 4:
        maxy = min(y, maxy)

width = max(0, maxx-minx)
height = max(0, maxy-miny)

print(width*height)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define debug(a,b,c) cout << a << " " << b << " " << c << endl;
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 
#define endl "\n";
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
 
int solve(int st, vi a, int& ans,int& n){
	if(st > n ) return 0;
	int res = 0;
	int x1 = solve(st*2, a, ans, n);
	int x2 = solve(st*2+1, a, ans, n);
	int l1 = (st*2-2)>=a.size()?0:a[st*2-2];
	int l2 = (st*2-1)>=a.size()?0:a[st*2-1];
	l2 += x2; l1+=x1;
	ans += abs(l2-l1);
	return max(l1,l2); 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//code here
	int a, b;
	cin >> a>> b;
	cout << (ll) a*b << endl;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

vector<int> x(10), y(10);

int main() {
    int n; cin >> n;
    vector<int> v(n);
    REP(i, n) { 
        cin >> x[i] >> y[i];
        v[i] = i + 1;
    }
    double ans = 0;
    int f = 0;
    do {
        for (int i = 0; i < n - 1; i++) { 
            ans += pow(pow(x[v[i] - 1] - x[v[i + 1] - 1], 2) + pow(y[v[i] - 1] - y[v[i + 1] - 1], 2), 0.5);
        }
        f++;
    } while (next_permutation(v.begin(), v.end()));
    cout << setprecision(10) << ans / f << endl;
}


Measured memory_bytes: 384
N = int(input())
H = list(map(int, input().split()))

ans = 0
kouho = 0

for i in range(0, N-1):
  if H[i] >= H[i+1]:
    kouho += 1
    ans = max(ans, kouho)
  else:
    kouho = 0
    
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// #include <ext/pb_ds/assoc_container.hpp>
// typedef tree<int,null_type,less<int>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define pc(x)  __builtin_popcount (x)
#define vl vector< ll >
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<ll>())
#define ss second
#define ff first
#define ll long long
#define ld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod 1000000007
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define gcd __gcd
#define primeDEN 727999983
#define nx_pe next_permutation(s.begin(),s.end())
#define cl cout<<"\n"
#define sp(x) setprecision(x)

void solve()
{
   string s;
   cin>>s;
   ll ans=0;
   ll n=s.size();
   ll vol=0;
   rep(i,n){
      if(s[i]=='R'){
         vol++;
      }
      else
      {
         ans=max(ans,vol);
         vol=0;
      }
      
   }
   ans=max(ans,vol);
   cout<<ans<<"\n";
}


    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("ouput.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    std::ios::sync_with_stdio(false);
    ll te=1;
    // cin>>te;
    while(te--){
        solve();
    }
    
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
#define NM (int)2e5
using namespace std;

string s,t;
int dp[3005][3005];

void Solve(int i,int j,int lg)
{   if(!lg)
        return;
    for(int x=i; x; x--)
        for(int y=j; y; y--)
            if(dp[x][y]==lg && s[x-1]==t[y-1])
            {   Solve(x-1,y-1,lg-1);
                cout<<s[x-1];
                return;
            }
}

int main()
{   cin>>s>>t;
    int n=s.size(),m=t.size();
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
            if(s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    Solve(n,m,dp[n][m]);
    return 0;
}

Measured memory_bytes: 39004
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g,h,S,T;

	scanf("%d %d %d %d",&a,&b,&c,&d);// A???????????????
	
	scanf("%d %d %d %d",&e,&f,&g,&h);// B???????????????

	S=a+b+c+d;

	T=e+f+g+h;

	if(S>T){
	printf("%d\n",S);
	}

	else{
	printf("%d\n",T);
	}

	return 0;
}

Measured memory_bytes: 1852
import math
import statistics

def ret(l, b):
  r = 0
  for i in range(len(l)):
    r += int(math.fabs(l[i] - b - i - 1))
  return r

input()
l = list(map(int, input().split()))
a = []
for i in range(len(l)):
  a.append(l[i] - i - 1)
x = statistics.median_low(sorted(a))
y = statistics.median_high(sorted(a))
print(min(ret(l, x), ret(l,y)))

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

typedef long long ll;
const ll INF = 1LL << 60;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
} 

mint choose(ll n, ll a) {
    mint x = 1, y = 1;
    rep(i, a) {
        x *= (n - i);
        y *= (i + 1);
    }

    return x / y;
}
int n, a, b;
int main() {
    cin >> n >> a >> b;
    // cout << ss.x << endl;

    // mint total(2);
    // mint ans = total.pow(n);
    // ans -= 1;
    mint ans = mod_pow(2, n, mod) - 1;
    // cout << ans.x << endl;
    ans -= choose(n, a);
    ans -= choose(n, b);
    cout << ans.x << endl;
}

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

int main() {
    int n;
    int a[200];
    int min = 100;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] & 1)  {
            puts("0");
            return 0;
        }
    }
    for(int i = 0; i < n; ++i) {
        int c = 0;
        while(!(a[i] & 1)) {
            c++;
            a[i] >>= 1;
        }
        min = std::min(min, c);
    }
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll a,b,c,d,i,j,k,l=1,x=1,y;
vector<ll>v,vv;
cin>>a;
for(i=1;i<=a;i++)
{
 cin>>b;
 if(i==1){l=1;x=b;}
 else
 {
 if(b<=x){l++;x=b;}
 }

}
    cout<<l<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};


int main() {
    int K,T; cin >> K >> T;
    vector<int>A(T);

    rep(i,T){
        int a; cin >> a;
        A[i]=a;
    }

    sort(A.begin(), A.end());
    if(A.size()==1){
        cout << A[T-1]-1 << endl;
        return 0;
    }

    int sukima=0;
    for(int i=0; i<T-2; i++){
        sukima+=A[i];
    }

    cout << max(0, A[T-1]-A[T-2]-sukima-1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int main(){
    int H,W;
    while(true){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(int i=0;i<H;i++){
        if(i%2==0){
            for(int j=0;j<W;j++){
                if(j%2==0){
                    printf("#");
                }else{
                    printf(".");
                }
            }printf("\n");
        }else{
            for(int j=0;j<W;j++){
                if(j%2==0){
                    printf(".");
                }else{
                    printf("#");
                }
            }printf("\n");
        }
    }printf("\n");
    }
}



Measured memory_bytes: 2628
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define FOR(i,j,n) for(int i=(j);i<=((int)n);++i)
#define N 100005
#define MOD 1000000007

typedef long long int ll;
using namespace std;
vector <int>g[N];
void init()
{
	for(int i = 0; i < N; i++) {
		g[i].clear();
	}
}
int n;
ll dp[N][3];

ll dfs(int x,int p,int t)
{
	if (g[x].size()==1 and g[x][0]==p)
	{
		return 1;
	}
	else if (dp[x][t]!=-1)
	return dp[x][t];
	else
	{
		ll z=1;
		for (int i=0;i<g[x].size();i++)
		{
			if (g[x][i]==p)
			continue;
			if (t==2)
			{
				z=z*((dfs(g[x][i],x,1)+dfs(g[x][i],x,2))%MOD)%MOD;
			}
			else
			{
				z=z*(dfs(g[x][i],x,2)%MOD)%MOD;
			}
		}
		dp[x][t]=z%MOD;
		return z%MOD;
	}
	
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>n;
    FOR(i,1,n-1)
    {
    	int x,y;
    	cin>>x>>y;
    	g[x].push_back(y);
    	g[y].push_back(x);
	}
ll s=0;
memset(dp,-1,sizeof(dp));
s=s+dfs(1,0,1);
memset(dp,-1,sizeof(dp));
s=s+dfs(1,0,2);
cout<<s%MOD<<endl;
}




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

#define LEN 100005

typedef struct task{
    char name[100];
    int time;
};

task Queue[LEN];
int head,tail,n;

void enQueue(task x){
    Queue[tail] = x;
    tail = (tail + 1)%LEN;
}

task deQueue(){

    task x = Queue[head];
    head = (head+1)%LEN;
    return x;
}

int min(int a,int b){return a<b?a:b;}



int main(){
    int n,timeSlot;
    scanf("%d %d",&n,&timeSlot);

    task theOne;

    for(int i = 0;i<n;i++){
        scanf("%s",&Queue[i].name);
        scanf("%d",&Queue[i].time);
    }

    head = 0;tail = n;

    int mark = 0;

    //?¨????
    while(head!=tail){
        theOne = deQueue();
        int cosume = min(theOne.time,timeSlot);
        theOne.time -= cosume;

        mark += cosume;
        if (theOne.time > 0) {
            enQueue(theOne);
        } else {
            printf("%s %d\n",theOne.name,mark);
        }


    }





    return 0;
}

Measured memory_bytes: 12860