akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int INF = 3e18 + 239;

map<int, int> mem;

int rec(int x, int a, int b, int c, int d) {
	// cerr << x << ' ' << cur << endl;
	if (mem.count(x)) return mem[x];
	if (x == 0) {
		return 0;
	}
	if (x == 1) {
		return d;
	}
	int cur = INF;
	{
		int f = (x / 5) * 5;
		for (int to = f; to <= f + 5; to += 5) {
			cur = min(cur, d * abs(x - to) + c + rec(to / 5, a, b, c, d));
		}
	}
	{
		int f = (x / 3) * 3;
		for (int to = f; to <= f + 3; to += 3) {
			cur = min(cur, d * abs(x - to) + b + rec(to / 3, a, b, c, d));
		}
		// rec(x / 3, a, b, c, d, cur + abs(x - f * 3) * d, ans);
		// rec(x / 3 + 1, a, b, c, d, cur + abs(x - (f + 1) * 3) * d, ans);
	}
	{
		if (x % 2 == 0) {
			cur = min(cur, a + rec(x / 2, a, b, c, d));
		} else {
			cur = min(cur, d + a + rec(x / 2, a, b, c, d));
			cur = min(cur, d + a + rec(x / 2 + 1, a, b, c, d));
		}
	}
	if (d < INF / x) {
		cur = min(cur, x * d);
	}
	mem[x] = cur;
	return mem[x];
}

void solve() {
	mem.clear();
	int x, a, b, c, d;
	cin >> x >> a >> b >> c >> d;
	int ans = rec(x, a, b, c, d);
	cout << ans << endl;
}

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

	int q;
	cin >> q;
	while (q--) {
		solve();
	}
}

Measured memory_bytes: 4188
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string s;
	vector<int> result = {};
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		char temp = s.at(i);
		if (temp == '0')
			result.push_back(0);
		else if (temp == '1')
			result.push_back(1);
		else if (temp == 'B')
			if (result.size() != 0)
				result.pop_back();
	}

	for (int i = 0; i < result.size(); i++)
		cout << result.at(i);
	cout << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string a,b,c;
	cin>>a>>b>>c;
	cout<<a[0]<<b[0]<<c[0]<<endl;
	
	return 0;
}

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

const ll INF = 1e18;
const int MX = 2005;

int main() {
  string s;
  cin >> s;
  if(s == "AAA" || s == "BBB"){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/** Which of the favors of your Lord will you deny ? **/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define F first
#define S second

#define ALL(x)      (x).begin(), (x).end()
#define DBG(x)      cout << __LINE__ << " says: " << #x << " = " << (x) << endl
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;

int main()
{
    optimizeIO();

    int n;
    cin>>n;

    map<string,int>m;

    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;

        m[s]++;
    }

    cout<<"AC"<<" x "<<m["AC"]<<endl;
    cout<<"WA"<<" x "<<m["WA"]<<endl;
    cout<<"TLE"<<" x "<<m["TLE"]<<endl;
    cout<<"RE"<<" x "<<m["RE"]<<endl;

//    for(auto x:m)
//    {
//        cout<<x.F<<" x "<<x.S<<endl;
//    }

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Measured memory_bytes: 3664
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long ll;

int main()
{
    double A,B,H,M;
    cin >> A >> B >> H >> M;

    double theta2 = 2.0 * M_PI * M / 60.0;
    double theta1 = (2.0 * M_PI * H / 12.0) + 2.0 * M_PI * ((1.0 / (12.0 * 60.0)) * M);

    double y1 = A * sin(theta1);
    double x1 = A * cos(theta1);
    double y2 = B * sin(theta2);
    double x2 = B * cos(theta2);

    double lx = abs(x1 - x2);
    double ly = abs(y1 - y2);

    cout << fixed << setprecision(13) << sqrt(lx * lx + ly * ly) << endl;

    return 0;
}


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

int main()
{
	int h, w, n, c[105][105], a[10005];
	scanf("%d%d%d", &h, &w, &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	int cur = 0;
	for(int i = 0; i < h; i++)
	{
		if(i%2)
		{
			for(int j = w - 1; j >= 0; j--)
			{
				while(a[cur] == 0) cur++;//whileorz...
				a[cur]--;
				c[i][j] = cur + 1;
			}
		}
		else
		{
			for(int j = 0; j < w; j++)
			{
				while(a[cur] == 0) cur++;
				a[cur]--;
				c[i][j] = cur + 1;
			}
		}
	}
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			if(j)
                printf(" ");
			printf("%d", c[i][j]);
		}
		puts("");
	}
	return 0;
}


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

int main() {
    int i, j, H, W;
    cin >> H >> W;
    while( H != 0 && W != 0 ){
        for ( i = 0; i < H; i++ ) {
            for ( j = 0; j < W; j++ ) {
                if(i == 0 || i == H - 1 || j == 0 || j == W - 1) {
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
    return 0;
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=2e5+10;
int d[maxn],ans[maxn],n;
vector<int>g[maxn];
queue<int>c[3],a[2];
void dfs(int u,int fa){
	d[u]=d[fa]+1;
	for(int x:g[u]){
		if(x==fa) continue;
		dfs(x,u);
	}
}
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	scanf("%d",&n);
	for(int i=1,x,y;i<n;i++){
		scanf("%d%d",&x,&y);
		g[x].pb(y);g[y].pb(x);
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) c[i%3].push(i);
	for(int i=1;i<=n;i++) a[d[i]%2].push(i);
	if(a[0].size()>a[1].size()) swap(a[0],a[1]);
	if(a[0].size()<=n/3){
		while(!a[0].empty()){
			int x=a[0].front();a[0].pop();
			int y=c[0].front();c[0].pop();
			ans[x]=y;
		}
		while(!a[1].empty()){
			int x=a[1].front();a[1].pop();
			for(int i=0;i<3;i++) if(!c[i].empty()){
				ans[x]=c[i].front();c[i].pop();
				break;
			}
		}
	}else{
		while(!c[1].empty()){
			int x=a[0].front();a[0].pop();
			int y=c[1].front();c[1].pop();
			ans[x]=y;
		}
		while(!c[2].empty()){
			int x=a[1].front();a[1].pop();
			int y=c[2].front();c[2].pop();
			ans[x]=y;
		}
		for(int i=0;i<2;i++){
			while(!a[i].empty()){
				int x=a[i].front();a[i].pop();
				int y=c[0].front();c[0].pop();
				ans[x]=y;
			}
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d%c",ans[i],i==n?'\n':' ');
	}
	return 0;
}
/*

1,2,3,4,5
2,1,2,1,0,1,0
*/

Measured memory_bytes: 20480
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int mod=1e9+7,N=5000+5;
int fa[N],fac[N],pw[N],a[N],cyclone[N],f[N],sz[N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
void merge(int x,int y){
	x=find(x);y=find(y);
	if(x==y) return (void)(cyclone[x]=1);
	fa[x]=y;cyclone[y]|=cyclone[x];sz[y]+=sz[x];
}
signed main(){
	int n,k=0;
	cin>>n;
	for(int i=1;i<=n;++i) fa[i]=i,sz[i]=1;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		if(a[i]==-1) ++k;
		else merge(i,a[i]);
	}
	fac[0]=pw[0]=1;
	for(int i=1;i<=n;++i)
		fac[i]=fac[i-1]*i%mod,
		pw[i]=pw[i-1]*(n-1)%mod;
	int ans=n*pw[k]%mod,sum=0;f[0]=1;
	int tot=0;
	for(int i=1;i<=n;++i)
		if(find(i)==i){
			if(cyclone[i]) sum=(sum+pw[k])%mod;
			else{
				++tot;
				for(int l=tot;l>=1;--l)
					f[l]=(f[l]+f[l-1]*sz[i]%mod)%mod; //树的根节点往别人家儿子连边 
				sum=(sum+pw[k-1]*(sz[i]-1)%mod)%mod; //树的根节点往儿子连边 
			}
		}
	for(int l=2;l<=tot;++l)
		sum=(sum+pw[k-l]*fac[l-1]%mod*f[l]%mod)%mod;
	ans=(ans-sum+mod)%mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;

vector<bool> used(1e5 + 10);
vector<vector<ll>> edges(1e5 + 10);
vector<ll> memo(1e5 + 10);

ll dfs(ll now, ll pre){
    if(used[now]) return memo[now];
    used[now] = 1;
    ll len = 0;
    bool has_child = 0;
    for(ll nxt : edges[now]){
        if(nxt == pre) continue;
        has_child = 1;
        len = max(len, dfs(nxt, now));
    }
    return memo[now] = len + has_child;
}

int main(){
    ll N, M;
    cin >> N >> M;
    vector<bool> has_parent(N, 0);
    for(ll i = 0; i < M; i++){
        ll a, b;
        cin >> a >> b;
        edges[a - 1].push_back(b - 1);
        has_parent[b - 1] = 1;
    }
    ll ans = 0;
    for(ll i = 0; i < N; i++){
        if(has_parent[i]) continue;
        ans = max(ans, dfs(i, -1));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11264
using System;
using System.Dynamic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] inputNum = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int tmpMin = inputNum[0];
            int count = 1;

            for (int i = 1; i < n; i++)
            {
                if (tmpMin >= inputNum[i])
                {
                    count++;
                    tmpMin = inputNum[i];
                }
            }
            Console.WriteLine(count);

        }
    }
}


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

N,K,Q=map(int, input().split())

p=[-Q]*N

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1

for i in range(N):
  if p[i]+K<1:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 46940
n = gets.to_i
ans = Array.new(10**4 + 1, 0)

## x <= y <= zとする。

max_x = Math.sqrt(n/6).to_i + 1
max_y = Math.sqrt(n/3).to_i + 1
max_z = Math.sqrt(n).to_i + 1


(1..max_x).each do |x|
  (x..max_y).each do |y|
    (y..max_z).each do |z|
      result = x**2 + y**2 + z**2 + x*y + y*z + z*x
	  break if result > n
      if x == y && x == z
	      plus_cnt = 1
      elsif x == y || y == z || z == x
          plus_cnt = 3
      else
          plus_cnt = 6
      end
	      ans[result] += plus_cnt if result <= n
    end
  end
end

(1..n).each do |i|
  puts ans[i]
end


Measured memory_bytes: 14296
#include<iostream>
using namespace std;
#include<map>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#define int long long int
#define mod 1000000007
int answer=100000000;
void function2(vector<int> &vec,int initial,int final,int mat[][2],int d,int g)
{
	if(initial>final)
	{
		int here=0;
		int sum=0;
		int j;
		vector<int> vec2;
		for(j=0;j<d;j++)
		{
			if(vec[j]==1)
			{
				sum+=(mat[j][1]+100*(j+1)*mat[j][0]);
				here+=mat[j][0];
			}
			else
			{
				int i;
				for(i=0;i<mat[j][0];i++)
				{
					vec2.push_back(100*(j+1));
				}
			}
		}
		if(sum>=g)
		{
			answer=min(answer,here);
			return ;
		}
		sort(vec2.begin(),vec2.end());
		reverse(vec2.begin(),vec2.end());
		int n=vec2.size();
		for(j=0;j<n;j++)
		{
			sum+=vec2[j];
			here++;
			if(sum>=g)
			{
				answer=min(answer,here);
				break;
			}
		}
	}
	else
	{
		vec.push_back(0);
		function2(vec,initial+1,final,mat,d,g);
		vec.pop_back();
		vec.push_back(1);
		function2(vec,initial+1,final,mat,d,g);
		vec.pop_back();
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int d,g;
	cin>>d>>g;
	int mat[d][2];
	int j;
	for(j=0;j<d;j++)
	{
		cin>>mat[j][0]>>mat[j][1];
	}
	vector<int> vec;
	function2(vec,0,d-1,mat,d,g);
	cout<<answer<<endl;
}


Measured memory_bytes: 3652
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let S = rl().chars().collect::<Vec<_>>();
    let T = rl().chars().collect::<Vec<_>>();
    let N = S.len();
    let M = T.len();

    let mut len = vec![vec![0; M + 1]; N + 1];
    let mut last = vec![vec![(0, 0); M + 1]; N + 1];

    for si in 0..N + 1 {
        for ti in 0..M + 1 {
            if si < N && len[si + 1][ti] < len[si][ti] {
                len[si + 1][ti] = len[si][ti];
                last[si + 1][ti] = last[si][ti];
            }

            if ti < M && len[si][ti + 1] < len[si][ti] {
                len[si][ti + 1] = len[si][ti];
                last[si][ti + 1] = last[si][ti];
            }

            if si < N && ti < M && S[si] == T[ti] {
                len[si + 1][ti + 1] = len[si][ti] + 1;
                last[si + 1][ti + 1] = (si, ti);
            }
        }
    }

    let mut U = vec![];
    {
        let mut si = N;
        let mut ti = M;

        while len[si][ti] > 0 {
            let (lsi, lti) = last[si][ti];
            U.push(S[lsi]);

            si = lsi;
            ti = lti;
        }
    }

    debug!((len, last));

    println!("{}", U.into_iter().rev().collect::<String>())
}


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

int main(){
  int N, D;
  cin >> N >> D;
  
  vector<vector<int>> X(N);
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      int a;
      cin >> a;
      X.at(i).emplace_back(a);
    }
  }
  
  int count = 0;
  int dis = 0;
  double dist;
  
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      dis = 0;
      for (int k = 0; k < D; k++) {
        dis += pow(X.at(j).at(k) - X.at(i).at(k), 2);
      }
      dist = (double)sqrt(dis);
      // cout << dist << endl;
      if(floor(dist) == ceil(dist)) {
        count++;
      }
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		// input
		long high = scan.nextLong();
		long mid = scan.nextLong();
		long low = scan.nextLong();
		long num = scan.nextLong();

		//check
		long answer = high - mid;

		// answer
		if (num % 2 == 0) {
			System.out.println(answer);
		} else {
			System.out.println(-answer);
		}
	}
}


Measured memory_bytes: 23764
/*
 Author: Vedang Karwa
 */

//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <map>
#include <set>
#include<vector>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mem(p,v) memset(p,v,sizeof(p))
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
//#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define debug4(x,y,z,a) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<" "<<#a<<" "<<a<<endl;
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
const long long inf = 1e18+5;
const lli M =1e9+7 ;
void show(vector<lli> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(vector<int> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(int a[], int arraysize){for (int i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(lli a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(bool a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(set<int> s){for (auto it = s.begin(); it != s.end(); it++){cout << *it << " ";}cout<<endl;}
void show(map<lli,lli> mp){for (auto it = mp.begin(); it != mp.end(); it++){cout << it->first << " "<<it->second<<endl;}cout<<endl;}
lli modpow(lli x,lli n){lli res=1;while(n>0){if(n&1) res=((res%M)*(x%M))%M;x=((x%M)*(x%M))%M;n>>=1;}return res;}
lli power(lli x, lli n){lli res=1;while(n>0){if(n&1) res=res*x;x=x*x;n>>=1;}return res;}
const int N =1e5+5;
/////// ------ Main code starts here ------ /////

void solve()
{
    string s;
    cin>>s;
    lli a=0;
    fr(i,0,s.length())
    {
        a+=s[i]-'0';
    }
    if(a%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    
}
int main()
{
    run;cout<<fixed<<setprecision(0);
    int t;
    t=1;
    while(t){solve();t--;}
    return 0;
}


Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim > struct rge
{
    c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
    ~debug()
    {
        cerr << endl;
    }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c &)
    {
        ris;
    }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = 1e9 + 7;
const int N = int(3e5) + 999;
//#define int long long int
#define inf 1e18

int n, k;
void add(int &a, int b)
{
    a = a + b;
    if (a >= MOD)
        a -= MOD;
}

void sub(int &a, int b)
{
    a = a - b;
    if (a < 0)
        a += MOD;
}

int main()
{
    cin >> n >> k;
    vector<int> dp(k + 1, 0);
    dp[0] = 1;
    for (int i = 0; i < n; i++)
    {
        int lmt;
        cin >> lmt;
        vector<int> fake(k + 1, 0);
        for (int used = k; used >= 0; used--)
        {
            int tmp = dp[used];
            int l = used + 1;
            int r = used + min(lmt, k - used);
            if (l <= r)
            {
                add(fake[l], tmp);
                if (r + 1 <= k)
                    sub(fake[r + 1], tmp);
            }
        }
        int pp = 0;
        for (int i = 0; i <= k; i++)
        {
            add(pp, fake[i]);
            add(dp[i], pp);
        }
    }
    cout << dp[k];

    return 0;
}

Measured memory_bytes: 1024
from sys import stdin
import collections

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

c = collections.Counter(li)
count = c.items()
point = 0
for i in count:
    if i[0] < i[1]:
        point += i[1]-i[0]
    elif i[0] > i[1]:
        point += i[1]
print(point)

Measured memory_bytes: 18676
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            var a = int.Parse(s[0]);
            a += a * a + a * a * a;

            var ans = a;

            WriteLine(ans);
            Out.Flush();
        }

    }

    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return (m == 1 || m == 0) ? 1L : n * Pow(n, m - 1); }
    }


}

Measured memory_bytes: 27316
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

map<i64, i64> mp;

i64 f(i64 x)
{
    if (mp.count(x))
    {
        return mp[x];
    }
    if (x == 1)
    {
        return mp[x] = 1;
    }
    return mp[x] = 2 * f(x / 2) + 1;
}

void solve()
{
    i64 h, n;
    cin >> h >> n;
    akari<i64> dp(h + 1, 1e15);
    dp[0] = 0;
    for (int i = 0; i < n; i++)
    {
        i64 a, b;
        cin >> a >> b;
        for (int x = 0; x <= h; x++)
        {
            dp[min(h, x + a)] = min(dp[min(h, x + a)], dp[x] + b);
        }
    }
    cout << dp.back() << endl;
}

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


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

A.sort()
ans = 0
while True:
  if A[0]==A[1] and A[0] == A[2]:
    break
  if A[0]==A[1]: # 小さい値を増やす（操作1）
    A[0] += 1
    A[1] += 1
  else:
    A[0] += 2
  A.sort()
  ans += 1

print(ans)  
    

Measured memory_bytes: 3060
n,m=map(int,input().split())
p=list(map(int,input().split()))
pa=list(range(n))
def find(u):
  if u!=pa[u]:pa[u]=find(pa[u])
  return pa[u]
for i in range(m):
  a,b=map(int,input().split())
  a=find(a-1)
  b=find(b-1)
  if a!=b:pa[a]=b
c=0
for i in range(n):
  if find(p[i]-1)==find(i):c+=1
print(c)

Measured memory_bytes: 13880
s=input()
t=input()
n=len(s)
s=list(s)
for i in range(n):
  fs=s.pop()
  s=[fs]+s
  t_str=""
  for ss in s:
    t_str+=ss
  if t_str==t:
    print("Yes")
    exit(0)
print("No")

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out
vector<int> zalgo(string &S) {
  int N=S.size();
  vector<int> Z(N,0);
  int l=0;
  for(int i=1; i<N; ++i) {
    // S[l..r] is current right most prefix-substring
    int r=l+Z[l],pre=Z[i-l];
    if (i+pre<r) {
      Z[i]=pre;
    } else {
      int j=max(0, r-i);
      while(i+j<N&&S[j]==S[i+j]) ++j;
      Z[i]=j;
      l=i;
    }
  }
  Z[0]=N;
  return Z;
}
/*

 6/8/2020

 8:57-

 */

string S;
int N;

void solve() {
  int res=0;
  REP(i,N) {
    string s=S.substr(0,i),t=S.substr(i);
    string T=t+s;
    VI ls=zalgo(T);
    FOR(i,SZ(t),N) SMAX(res,min(SZ(t),ls[i]));
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>S;
  solve();

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){

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

}
cout<<sum<<endl;


return 0;

}


Measured memory_bytes: 3604
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  double A,B,H,M;
  cin>>A>>B>>H>>M;
  double angle_a,angle_b;
  angle_a=2*M_PI*H/12+M_PI/6*M/60;
  angle_b=2*M_PI*M/60;
  double angle=abs(angle_a-angle_b);
  double a_x,a_y,b_x,b_y;
  a_x=0;
  a_y=A;
  b_y=cos(angle)*B;
  b_x=sin(angle)*B;
  double dist=sqrt(pow(a_x-b_x,2)+pow(a_y-b_y,2));
  cout<<fixed<<setprecision(16)<<dist<<endl;
  return 0;
}


Measured memory_bytes: 4164
A=int(input())
B =int(input())
C = int(input())
x = int(input())
ans = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i*500+j*100+k*50==x:
        ans+=1
print(ans)

Measured memory_bytes: 39536
#include<stdio.h>
int main()
{
	int w,rank,ryo,money;
	while(1){
	money=0;
	scanf("%d",&w);
	if(w==-1)
	break;
	rank=w/10;
	ryo=w%10;
	{
		if(rank==0)
			money=1150;
		else if(rank==1)
			money=1150+125*ryo;
		else if(rank==2)
			money=1150+1250+140*ryo;
		else if(rank>=3)
			money=1150+1250+1400+160*(w-30);

	}
	if(money<=4280)
	printf("%d\n",4280-money);
	else if(money>4280)
	printf("-%d\n",money-4280);
	}
	return 0;
}


Measured memory_bytes: 2112
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

arr = factorization(N)

res = 0
for a,b in arr:
    tmp = 1
    while b >= tmp:
        b = b - tmp
        tmp += 1
        res = res + 1

if N == 1:
    print(0)
else:
    print(res)


Measured memory_bytes: 63376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = min(N, B - 1);
    cout << (A * x / B) - A * (x / B) << endl;
}


Measured memory_bytes: 3424
#include<stdio.h>
#include<algorithm>
using namespace std;
double p[20][3];
double d[20][20];
int perm[20];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%lf%lf%lf",&p[i][0],&p[i][1],&p[i][2]);
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<a;j++){
			d[i][j]=(p[i][0]-p[j][0])*(p[i][0]-p[j][0])+(p[i][1]-p[j][1])*(p[i][1]-p[j][1])+(p[i][2]-p[j][2])*(p[i][2]-p[j][2]);
		}
	}
	for(int i=0;i<b;i++){
		perm[a-1-i]=1;
	}
	double ret=0;
	do{
		double val=0;
		for(int i=0;i<a;i++){
			if(perm[i]){
				for(int j=i+1;j<a;j++){
					if(perm[j])val+=d[i][j];
				}
			}
		}
		ret=max(ret,val);
	}while(next_permutation(perm,perm+a));
	printf("%f\n",ret);
}

Measured memory_bytes: 1096
import heapq

li = []
li2 = []
n = int(input())
a = list(map(int, input().split()))

first = sum(a[:n])
last = sum(a[2*n:])

for i in range(n):
    heapq.heappush(li,a[i])
    heapq.heappush(li2,-a[3*n-i-1])

sd = []
sd.append(first)

for i in range(n):
    heapq.heappush(li,a[n+i])
    s = heapq.heappop(li)
    first = first + a[n+i] - s
    sd.append(first)
    
la = []
la.append(last)

for i in range(n):
    heapq.heappush(li2,-a[2*n-1-i])
    s = heapq.heappop(li2)
    last = last + a[2*n-1-i] + s
    la.append(last)

ans = -11451419198104545364364    

for i in range(n+1):
    ans = max(ans , sd[i]-la[n-i])
    
print(ans)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x[8],y[8];
    int n;cin>>n;
    double tot=0.0;
    rep(i,n)cin>>x[i]>>y[i];
    rep(i,n)rep(j,n){
      double tmp=pow(x[i]-x[j],2)+pow(y[i]-y[j],2);
      tot+=pow(tmp,0.5);
    }
    cout<<fixed<<setprecision(10)<<tot/n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                             \
  cerr << __LINE__ << ": " << #x << " = {";          \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) { \
    cerr << ((hoge) ? "," : "") << x[hoge];          \
  }                                                  \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  long long p[A + 1], q[B + 1], r[C + 1];
  for (int i = 0; i < A; i++) cin >> p[i];
  for (int i = 0; i < B; i++) cin >> q[i];
  for (int i = 0; i < C; i++) cin >> r[i];
  p[A] = q[B] = r[C] = 0;
  sort(p, p + A);
  reverse(p, p + A + 1);
  sort(q, q + B);
  reverse(q, q + B + 1);
  sort(r, r + C);
  reverse(r, r + C + 1);
  long long sum = 0;
  for (int i = 1; i <= X; i++) sum += p[i];
  for (int j = 1; j <= Y; j++) sum += q[j];
  int i = X, j = Y, k = 1;
  while (i > 0 || j > 0 && k <= C) {
    if (i == 0 && q[j] >= r[k]) break;
    if (j == 0 && p[i] >= r[k]) break;
    if (min(p[i], q[j]) >= r[k]) break;
    if (j == 0 || p[i] < q[j]) {
      sum -= p[i--];
    } else {
      sum -= q[j--];
    }
    sum += r[k++];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 6012
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <map>
#include <iomanip>
#include <sstream>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long



class Employee {
public:
	int id;
	int parent;
	vector<int> children;
	int salary;

	Employee() {
		
	}

	Employee(int num, int nparent) {
		id = num;
		parent = nparent;
		salary = -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;
	cin >> N;

	vector<vector<int>> abc(N);
	vector<int> inner(3);
	vector<vector<int>> cost(N + 1);

	for (auto i = 0; i < N; i++)
	{
		cin >> inner[0] >> inner[1] >> inner[2];
		abc[i] = inner;
	}

	for (auto& i : inner) {
		i = 0;
	}
	for (auto i = 0; i < N+1; i++)
	{
		cost[i] = inner;
	}
	int temp1, temp2;
	for (auto i = 1; i < N+1; i++)
	{

		//to a
		temp1 = cost[i - 1][1] + abc[i-1][0];
		temp2 = cost[i - 1][2] + abc[i-1][0];
		cost[i][0] = max(temp1, temp2);

		//to b
		temp1 = cost[i - 1][0] + abc[i-1][1];
		temp2 = cost[i - 1][2] + abc[i-1][1];
		cost[i][1] = max(temp1, temp2);

		//to c
		temp1 = cost[i - 1][0] + abc[i-1][2];
		temp2 = cost[i - 1][1] + abc[i-1][2];
		cost[i][2] = max(temp1, temp2);
	}


	cout << max(cost[N][0], max(cost[N][1], cost[N][2])) << endl;


	return 0;
}

Measured memory_bytes: 11136
#!/usr/bin/env ruby

if __FILE__ == $0
	trump = Array.new
	['S', 'H', 'C', 'D'].each do |d|
		1.upto(13) do |r|
			trump += ['%c %d' % [d, r]]
		end
	end

	n = gets.chomp.to_i
	n.times do
		trump.delete(gets.chomp)
	end

	trump.each do |t|
		puts t
	end
end



Measured memory_bytes: 6904
import itertools
N = int(input())
XYH = [tuple(map(int,input().split(' '))) for _ in range(N)]
XYH.sort(key=lambda y:y[2],reverse=True)
x,y,h = XYH[0]
#i,jでありうるすべての中心座標を表現
for i,j in itertools.product(range(101),repeat=2):
  #座標(x,y)における高さと中心座標における高さの関係
  H = h + abs(x-i) + abs(y-j)
  if all(max(H-abs(a-i)-abs(b-j),0)==c for a,b,c in XYH):
    print(i,j,H)
    break

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=25;
int n,q;
int a[maxn];
int flag;
int x;
void cho (int loc,int sum)
{
    if(sum==x)
    {
        flag=1;
        return;
    }
    if(loc>n)
        return;
    cho (loc+1,sum);
    cho (loc+1,sum+a[loc]);
}
void input ()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    scanf("%d",&q);
    while (q--)
    {
        scanf("%d",&x);
        flag=0;
        cho (1,0);
        if(flag)
            printf("yes\n");
        else
            printf("no\n");
    }
}
int main()
{
    input();
    return 0;
}



Measured memory_bytes: 3168
#include <stdio.h>
#include <math.h>

#define PI 3.1415926535	// PIを定義

// 2辺a,bの長さとその間の角Cの大きさ(度)が与えられ、三角形の面積、周の長さ、aを底辺としたときの高さを出力
int main()
{
	double dInputA, dInputB, dInputC;
	double dRad, dAnotherSide;
	double dArea, dRound, dHeight;

	scanf("%lf %lf %lf", &dInputA, &dInputB, &dInputC);

	// 角度をラジアンに変換
	dRad = dInputC * PI / 180;

	// 面積
	dArea = (dInputA * dInputB * sin(dRad)) / 2;

	// もう一辺と周の長さ
	dAnotherSide = sqrt(pow(dInputA, 2) + pow(dInputB, 2) - 2 * dInputA * dInputB * cos(dRad));
	dRound = dInputA + dInputB + dAnotherSide;

	// 高さ
	dHeight = (2 * dArea) / dInputA;

	printf("%.8lf\n%.8lf\n%.8lf\n", dArea, dRound, dHeight);

	return 0;
}


Measured memory_bytes: 2044
main(){double a,b,c,d,e,f,g,h;for(scanf("%lf",&a);~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f,&g,&h);)puts(fabs((c-a)*(h-f)-(d-b)*(g-e))>1e-10?"NO":"YES");exit(0);}

Measured memory_bytes: 612
#include<iostream>
#include<cstring>

using namespace std;

// http://d.hatena.ne.jp/Nekonyan/20110508 
// Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。

int table[10+1][9700];
int memo[10];

void numnum (int size, int depth, int sum )
{
	if (size + 1 == depth ) {
		table[size][sum]++;
	}else{
		for (int i = 0; i <= 9; ++i ){
			if ( memo[i] == 0 ) {
				memo[i] = 1;
				numnum (size, depth + 1, sum + i*depth );
				memo[i] = 0;
			} // end if
		} // end for
	} // end if
}

int main()
{
	memset(table, 0, sizeof (table ) );

	for (int i = 1; i <= 10; ++i ) {
		memset (memo, 0, sizeof (memo ) );
		numnum (i, 1, 0 );
	} // end for

	int n, s;
	while ( cin >> n >> s ) {
		cout << table[n][s] << endl;
	} // end while

	return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define int long long
#define push_back pb
#define getMat(v, n, m) vector<vector<int>> v(n,vector<int>(m))
#define lb lower_bound
#define up upper_bound
#define all(v) v.begin(),v.end()
#define size(v) (int)v.size()
using namespace std;
const int mod = 1e9+7;

int32_t main(){
    fastio;

    string s; cin >> s;
    int ans = 0;
    for(int i=0; i<size(s); i++){
        int j=i, cnt=0;
        while(j<size(s) && s[j]=='R'){
            cnt++;
            j++;
        }
        ans = max(ans, cnt);
    }

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

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

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

    if(X==1){
        cout<<1<<endl;
        return 0;
    }

    int ans=0;
    for(int i=2;i<=X;++i){
        for(int k=2;pow(i,k)<=X;++k){
            ans=max(ans,int(pow(i,k)));
        }
    }
    cout<<ans<<endl;
}

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

public class Main {
 
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int count = 0;
        for (int i = 1; i <= n; i++) {
            if (i < 10) count++;
            if ((i >= 100) && (i < 1000)) count++;
            if ((i >= 10000) && (i < 100000)) count++;
        }         
        System.out.println(count);
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    
    public boolean hasNext() { 
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

int main () {
  int L,R,d;
  cin >> L >> R >> d;
  int ans = 0;
  for (int i = L; i <=R; i++) {
    if (i%d == 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  ll n,x,ans,y,z,i;
  cin >> n >> x;
  ans=1;
  y=0;
  for(i=1;i<=n;i++){
    cin >> z;
    y+=z;
    if(y<=x){
      ans+=1;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K,a=1, b=0;
  cin >> N>>K;
  
  
  for(int i=0;;i++){
    a*=2;
    b++;
    if(a>=K || N==b)
      break;
  }
  cout << a+(N-b)*K << endl;
}

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

using namespace std;

const int L = 128;
const string C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

int query(const string &t)
{
	cout << "? " << t << "\n";
	int r;
	cin >> r;
	return r;
}

string find_password()
{
	vector<string> v(64);
	int n = 0;
	for (int i=0; i < 62; i++)
	{
		v[i] = string(L - query(string(L, C[i])), C[i]);
		n += v[i].size();
	}
	for (int s=32; s > 0; s /= 2)
		for (int i=0; i < s; i++)
		{
			v[i] = v[2*i];
			string &a = v[i], &b = v[2*i+1];
			for (size_t j=0, k=0; j <= a.size(); j++)
				for (; k < b.size() && query(a.substr(0, j) +
					b[k] + a.substr(j)) == n - (int)a.size() - 1;
						j++, k++)
				a.insert(a.begin() + j, b[k]);
		}
	return v[0];
}

int main()
{
 	ios_base::sync_with_stdio(false);
	string s = find_password();
	cout << "! " << s << "\n";
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define MAX 200001
using namespace std;
int main()
{
	int n;
	char s[MAX];
	cin >> n >> s;
	int a[MAX+1], b[MAX+1];
	memset(a, 0, (n + 1) * sizeof(int));
	memset(b, 0, (n+1) * sizeof(int));
	for (int i = 0; i < n; i++)
	{
		if (s[i] == '#')
			b[i + 1] = b[i] + 1;
		else
			b[i + 1] = b[i];
	}
	for (int i = n - 1; i >= 0; i--)
		if (s[i] == '.')
			a[n - i] = a[n - 1 - i] + 1;
		else
			a[n - i] = a[n - 1 - i];
	int ans = MAX+1;
	for (int i = 0; i <= n; i++)
		ans = min(ans, b[i] + a[n - i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>

long double ans[302][302][302], n;

long double solve(long long one, long long two, long long three)
{
//	printf("\n.\n");
	if( ans[one][two][three] != -1 )
		return ans[one][two][three];
	long double day1 = 0, day2 = 0, day3 = 0, count = 0, day = n/(one+two+three);
	if( !one && !two && !three )
		return 0;
//	printf("%lf %lf %lf\n", n, one, n/one);
	if( one )
	{
		count++;
		day1 = day + solve(one-1, two, three);
	}
	if( two )
	{
		count++;
		day2 = day + solve(one+1, two-1, three);
	}
	if( three )
	{
		count++;
		day3 = day + solve(one, two+1, three-1);
	}
//	printf("one: %lld two: %lld three: %lld\n  1: %Lf   2: %Lf     3: %Lf\n%Lf\n", one, two, three, day1, day2, day3, n/(one+two+three));
	
//	printf("ans: %Lf\n\n",  ans[one][two][three] = ( day1 + day2 + day3 + count*n/(one+two+three) ) / count);
//	printf("%Lf\n\n", ans[one][two][three] = count*n/(one+two+three) + day1 + day2 + day3);
	ans[one][two][three] = ( one*day1 + two*day2 + three*day3 ) / ( one + two + three );
//	printf("ans: %Lf\n", ans[one][two][three]);
	return ans[one][two][three];
}

int main()
{
	for(long long i=0; i<302; i++)
		for(long long j=0; j<302; j++)
			for(long long k=0; k<302; k++)
				ans[i][j][k] = -1;
	long long zero = 0, one = 0, two = 0, three = 0, a;
	scanf("%Lf", &n);
//	printf("n: %Lf\n", n);
	for(long long i=0; i<n; i += 1)
	{
		scanf("%lld", &a);
		if( a == 0 )
			zero++;
		else if( a == 1 )
			one++;
		else if( a == 2 )
			two++;
		else
			three++;
	}
	printf("%.12Lf", solve(one,two,three));
	return 0;
}


Measured memory_bytes: 430592
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def cc(al):
	ret = 0
	for (c, s, f) in al:
		if ret <= s:
			ret = s+c
		else:
			st = ((ret + f-1)//f)*f
			ret = st + c
	print(ret)
		

def main():
	n = int(input())
	#if n==4:
	#	return 1/0
	#b , c = tin()
	#s = input()
	al = [lin() for _ in range(n-1)]
	for i in range(n):
		cc(al[i:])
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 9256
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator () (a...); }
} read;

int main () {
	ll n = read, a = read, b = read;
	if (a % 2 == b % 2) printf("%lld\n", std::abs(a - b) >> 1);
	else printf("%lld\n", std::min(
				std::abs(b - a - 1) / 2 + a,
				std::abs(b - a - 1) / 2 + (n - b + 1)));
}


Measured memory_bytes: 128