akhauriyash/Code-Regression huggingface dataset:
n = int(input())

s = 6
m = 9
Can = [1]
count = 2
while s < 10**5:
    Can.append(s)
    s = 6**count
    count += 1

count = 2
while m < 10**5:
    Can.append(m)
    m = 9**count
    count += 1

DP = [1]
for i in range(1,n):
    dp_can = []
    if i+1 in Can:
        # print(i+1)
        DP.append(1)
        continue
    
    for num in Can:
        if num > i:
            continue
        dp_can.append(DP[i-num]+1)
    DP.append(min(dp_can))

# print(DP)
print(DP[-1])


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

#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 all(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

using ll = long long;

int main() {
    IN(long double, l);
    cout << fixed << setprecision(15) << (l/3)*(l/3)*(l/3) << endl;
    return 0;
}


Measured memory_bytes: 256
N, M, C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

ans = 0
for i in range(N):
    res = C
    for j in range(M):
        res += B[j] * A[i][j]
    if res > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
N,M=map(int,input().split())
H=list(map(int,input().split()))
L=[1] * N
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]==H[B-1]:
        L[A-1]=0
        L[B-1]=0
    elif H[A-1]>H[B-1]:
        L[B-1]=0
    else:
        L[A-1]=0
AAA=sum(L)
print(AAA)

Measured memory_bytes: 20112
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;cin>>N;
    int a[N+1];
    for(int i=1;i<=N;i++){
        cin>>a[i];
    }
    int count=0;
    for(int i=1;i<=N;i++){
        if(i%2==1&&a[i]%2==1){
            count++;
        }
    }
    cout<<count;
}


Measured memory_bytes: 3524
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<double, int> PDI;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

bool is_lose(string s){
	if(s.size() == 2) return true;	
	FOR(i, 1, s.size()-1){
		if(s[i-1] != s[i+1]) return false;
	}
	return true;
}


int main(void){
	/*
	string s;
	int player = 1; //1->先手　0->後手
	cin >> s;
	*/
	double x[1002], y[1002];
	double r[1002];
	vector<PDI> G[1002];
	double d[1002];

	int N;
	r[0] = 0;
	r[1] = 0;
	cin >> x[0] >> y[0] >> x[1] >> y[1];
	cin >> N;
	REP(i, N){
		cin >> x[i+2] >> y[i+2] >> r[i+2];
	}
	REP(i, N+2){
		REP(j, N+2){
			if(i == j) continue;
			double dist = sqrt(pow(x[i]-x[j], 2) + pow(y[i]-y[j], 2));
			dist = max(0.0, dist - r[i] - r[j]);
			G[i].push_back(make_pair(dist, j));
			G[j].push_back(make_pair(dist, i));
		}
	}

	priority_queue<PDI, vector<PDI>, greater<PDI> > que;
	fill(d, d+1002, INF_LL);
	d[0] = 0;
	que.push(PDI(0, 0));

	while(!que.empty()){
		PDI p = que.top(); que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		REP(i, G[v].size()){
			PDI e = G[v][i];
			if(d[e.second] > d[v] + e.first){
				d[e.second] = d[v] + e.first;
				que.push(PDI(d[e.second], e.second));
			}
		}
	}
	cout << fixed << setprecision(10) << d[1] << endl;;
	return 0;
}


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

int main() {
  int h,w;
  cin>>h>>w;
  vector <string> a(h);
  for(int i=0;i<h;i++){
      cin>>a.at(i);
  }
  for(int i=0;i<w+2;i++){
      cout<<"#";
  }
  cout<<endl;
  for(int i=0;i<h;i++){
      cout <<"#"<<a.at(i)<<"#"<<endl;
  }
  for(int i=0;i<w+2;i++){
      cout<<"#";
  }
  cout<<endl;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,m;
  cin >> n >> m;
  ll a=1;
  ll b=n;
  if(n%2==1){
    rep(i,m){
      cout << a << " " << b << endl;
      a++;b--;
    }
  }
  else{
    ll c=0;
    rep(i,m){
      cout << a << " " << b << endl;
      a++;b--;
      if(2*(b-a)<=n&&c==0){
        a++;
        c++;
      }
    }
  }
}

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

#define MAX_N 55555

long long int prime[MAX_N]; // i番目の素数
bool is_prime[MAX_N + 1];   // is_prime[i]がtrueならばiは素数

// n以下の素数の数を返す
long long int sieve(long long int n) {
    long long int p = 0;
    for (long long int i = 0; i <= n; i++)
        is_prime[i] = true;
    is_prime[0] = false;
    is_prime[1] = false;
    for (long long int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (long long int j = 2 * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return p;
}

int main(){
    int n;
    cin >> n;
    sieve(55555);
    vector<int> v;

    int idx = -1, cnt = 0;
    while(cnt < n){
        idx++;
        if(prime[idx]%5 != 1)continue;
        cout << prime[idx] << " ";
        cnt++;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  ll n, m;
  cin >> n >> m;
  ll ans = 0;
  while (n <= m) {
    ans++;
    n *= 2;
  }
  cout << ans << endl;
}

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;

int main(){
    rep(i, 5){
        int x;
        cin >> x;
        if(x == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
#define INF 123456789
#define MOD 1000000007

int main()
{
	int N;
	int ans = 1;
	int buf = 1;

	scanf("%d", &N);

	while (buf <= N)
	{
		buf *= 2;
		ans *= 2;
	}

	printf("%d\n", ans / 2);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
#define maxn 40005
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
inline void Max(int& x,int y){x=x>y?x:y;}
inline void Min(int& x,int y){x=x>y?y:x;}
#define ls k<<1
#define rs k<<1|1
int n,m,N;
struct op{ll x,y;}a[maxn];
struct node
{
    ll x;int id;
    bool operator <(const node& b){return x==b.x?id<b.id:x<b.x;}
}b[maxn];
vector<int>G[maxn<<2];
int id[maxn],iid[maxn<<2];
inline void built(int k,int l,int r)
{
    if(l==r){id[l]=k;iid[k]=l;Max(N,k);return ;}
    int mid=(l+r)>>1;
    built(ls,l,mid);built(rs,mid+1,r);
    G[k].push_back(ls);G[k].push_back(rs);
}
inline void connect(int k,int l,int r,int x,int y,int v)
{
    if(x<=l&&r<=y){G[v].push_back(k);return ;}
    int mid=(l+r)>>1;
    if(x<=mid)connect(ls,l,mid,x,y,v);
    if(y>mid)connect(rs,mid+1,r,x,y,v);
}
int dfn[maxn<<2],low[maxn<<2],inst[maxn<<2];
int zhan[maxn<<2],top,tot,cnt;
int vis[maxn<<2],bel[maxn<<2];
inline void Tarjan(int u)
{
    dfn[u]=low[u]=++cnt;zhan[++top]=u;inst[u]=1;
    for(int v:G[u])
    {
        if(!dfn[v])Tarjan(v),Min(low[u],low[v]);
        else if(inst[v])Min(low[u],dfn[v]);
    }
    if(dfn[u]!=low[u])return ;
    inst[u]=0;int v;++tot;
    while(zhan[top]!=u)
    {
        v=zhan[top--];inst[v]=0;
        bel[v]=tot;
    }--top;bel[u]=tot;
}
inline int check(int d)
{
    reg int i,l,r;cnt=0;--d;
    for(i=1;i<=N;++i)G[i].clear();
    built(1,1,m*2);
    for(i=1;i<=m;++i)
    {
        l=lower_bound(b+1,b+1+m,node{b[i].x-d,0})-b;
        r=lower_bound(b+1,b+1+m,node{b[i].x+d+1,0})-b-1;
        if(l<i)connect(1,1,m*2,l+m,i-1+m,id[i]);
        if(i<r)connect(1,1,m*2,i+1+m,r+m,id[i]);
    }
    for(i=1;i<=n;++i)
    {
        l=a[i].x;r=a[i].y;
        G[id[l]].push_back(id[r+m]);
        G[id[r+m]].push_back(id[l]);
        G[id[l+m]].push_back(id[r]);
        G[id[r]].push_back(id[l+m]);
    }
    memset(dfn,0,sizeof dfn);
    memset(low,0,sizeof low);
    Tarjan(1);
    for(i=1;i<=m;++i)
        if(bel[id[i]]==bel[id[i+m]])
            return 0;
    return 1;
}
int main()
{
    n=read();reg int i,x,y;
    for(i=1;i<=n;++i)
    {
        x=read(),y=read();
        b[++m]=node{x,i},b[++m]=node{y,i};
    }
    sort(b+1,b+1+m);
    for(i=1;i<=m;++i)
    {
        if(vis[b[i].id])a[b[i].id].y=i;
        else vis[b[i].id]=1,a[b[i].id].x=i;
    }
    reg int l=0,r=1e9+1,mid;
    while(l<r-1)
    {
        mid=(l+r)>>1;
        if(check(mid))l=mid;
        else r=mid;
    }
    printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 16640
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))

    ans = 0
    best = INF
    for i in range(N):
        a = abs(T - H[i] * 0.006 - A)
        if a < best:
            ans = i + 1
            best = a
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <time.h>
#include <stdlib.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(),a.end()

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

using namespace std;
using namespace __gnu_pbds;

int main()
{
    IOS
    int n;
    cin>>n;
    int res=0;
    for(int i=1;i<=n;i++)
    {
        int temp;
        cin>>temp;
        if(temp!=i)
            res++;
    }
    if(res==0||res==2)
        cout<<"YES\n";
    else
        cout<<"NO\n";
    return 0;
}


Measured memory_bytes: 256
//shara's here
//SPEEEEEEEEEED IS KEEEEEEEEEEY
//REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
#include <bits/stdc++.h>
using namespace std;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
const ll MOD = 1e9 + 7;
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define vll vector<vector<ll> >
#define ins insert
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main(){
	speed
	ll x,ans=0;
	cin >> x;
	while( x >= 500 ){
	ans+=1000;	
	x-=500;
	}
	while(x>5){
	ans+=5;
	x-=5;	
	}
	cout << ans << endl;








	
	
	
	






return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  rep(i,s.size() ){
    if(s[i]=='?') s[i]='D';
  }
  cout<<s<<endl;

  return 0;
}


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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;

const int mod = 998244353;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }  

int main(){
    int n;
    cin >> n;
    cout << setprecision(10) << fixed;
    vector<pair<int, int>> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i].first >> a[i].second;
    }
    double sum = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int x = a[i].first - a[j].first;
            x *= x;
            int y = a[i].second - a[j].second;
            y *= y;
            double temp = sqrt(x+y);
            sum+=temp;
        }
    }
    sum*=2;
    cout << sum/n;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  int A,B,C,K;
  cin >> A >> B >> C >> K;
  while (K > 0 && A >= B) {
    K--;
    B *= 2;
  }
  while (K > 0 && B >= C) {
    K--;
    C *= 2;
  }
  if (A < B && B < C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}



Measured memory_bytes: 3548
#![allow(unused_imports)]
#![allow(unused_macros)]
use itertools::Itertools;
use std::cmp::{max, min};
use std::collections::*;
use std::i64;
use std::io::{stdin, Read};
use std::usize;

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, a: [i64; n]);
    let mut a: Vec<i64> = a;
    let mut si = vec![0; n];
    let mut ret = 0;
    while !a.iter().all(|&x| x < n as i64) {
        let mut s = 0;
        for i in 0..a.len() {
            si[i] = a[i] / n as i64;
            s += si[i];
        }
        for (i, a) in a.iter_mut().enumerate() {
            *a -= si[i] * n as i64;
            *a += s - si[i];
        }
        ret += s;
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2120
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        h: [i32; n],
    }
    let mut h = h;
    for i in 0..n - 1 {
        let j = n - 2 - i;
        if h[j] > h[j + 1] + 1 {
            println!("No");
            return;
        }
        if h[j] == h[j + 1] + 1 {
            h[j] -= 1;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 6396
<?php
  
$input = trim(fgets(STDIN));
$input = str_replace(array('\r','\r','\r'), '', $input);
$array = str_split($input);
  
$count = 0;
    for( $i = 0; $i < count($array); $i++) {
    if( $array[$i] == 1) {
        $count++;
    }
}
echo $count;
?>

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


int main() {
 int a, b;
  cin >> a >> b;
  if(a<=b){
    for(int i=0;i<b;++i){
      cout << a;
    }
  }
    else if(a>b){
      for(int i=0;i<a;++i){
    cout << b;
      }
    }

}


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

#define ll long long

char s[200050];
int cnt[26];

int main(){
	scanf("%s", s+1);
	int len = strlen(s+1);
	ll ans = 0;
	for(int i = 1; i <= len; i++) cnt[s[i]-'a']++;
	for(int i = 0; i <= 26; i++) ans += (1ll * cnt[i] * (cnt[i]-1))>>1;
	printf("%lld", ((1ll * len * (len-1))>>1) - ans + 1);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

ll sieve[10000005];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll n;
	cin >> n;
	
	ll ans = 0;
	
	for(ll i = 2; i <= n; i++){
		if (!sieve[i]) {
			for (ll j = i; j<=n; j+=i){
				ll x = j;
				ll c = 0;
				while(x%i==0){
					x/=i;
					c++;
				}
				if(!sieve[j]) {
					sieve[j]=1;
				}
				sieve[j]*=c+1;
			}
		}
		ans+=i*sieve[i];
	}
	
	cout << ans+1 << "\n";
	
	
}


Measured memory_bytes: 81732
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>

#define MAX 100
#define INFTY 1<<30 // 2^30
#define N 100
#define N2 10000  // N * N
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(o) (o).begin(), (o).end()

/*
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/


using namespace std;

typedef long long llong;

int V, E, R, S[500010], T[500010], D[500010];
int C[100010];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  cin >> V >> E >> R; // V ???????????° E ????????°
  REP(i,E)
    cin >> S[i] >> T[i] >> D[i];
  REP(i,V)
    C[i] = INFTY;
  C[R] = 0;
  REP(t,V)
  {
    bool update = false;
    REP(i,E)
    {
      int s = S[i], t = T[i], d = D[i];
      if(C[s] < INFTY && C[s] + d < C[t])
      {
        C[t] = C[s] + d;
        update = true;
      }
    }
    if(!update) break;
  }
  REP(i,V)
  {
    if(C[i] == INFTY) cout << "INF" << endl;
    else cout << C[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 7412
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  int N;
  cin>>N;
  int action[N][3];
  int i;
  REPD(i,N){
    for(int j=0;j<3;j++){
      cin>>action[i][j];
    }
  }
  ll dp[N][3];
  dp[0][0]=action[0][0];
  dp[0][1]=action[0][1];
  dp[0][2]=action[0][2];
  for(int i=1;i<N;i++){
    
    for(int j=0;j<3;j++){
      dp[i][j]=0;
      for(int k=0;k<3;k++){
        if(j==k)continue;
        dp[i][j]=max(dp[i-1][k]+action[i][j],dp[i][j]);
      }
    }
  }
  ll result=max(dp[N-1][0],dp[N-1][1]);
  result=max(result,dp[N-1][2]);
  cout<<result<<endl;

}

Measured memory_bytes: 3712
S = input()
count = 0
s1 = 0
s2 = 0
A = dict()
N = len(S)
judge = True
for i in range(N):
    if S[i] in A:
        A[S[i]] += 1
        if A[S[i]] > 2:
            judge = False

    else:
        A[S[i]] = 1
        count += 1
if count > 2:
    judge = False
    
if judge:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    string s;
    cin >> s;
    int count0=0;
    int count1=0;
    int n=s.size();
    for(int i=0; i<n; i++){
        if(s[i]=='0') count0 ++;
        else count1 ++;
    }
    int ans = 2*min(count0,count1);
    cout << ans << endl;


}

Measured memory_bytes: 3764
M=10**9+7
n,k=map(int,input().split())
a=0
for i in range(k,n+2):
    l=i*~-i//2
    r=n*-~n//2-(n-i)*(n-i+1)//2
    a=(a+r+1-l)%M
print(a)

Measured memory_bytes: 9152
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll xor_sum = 0;
    REP(i, n){
        cin >> a[i];
        xor_sum ^= a[i];
    }
    ll cnt = 0;
    for(ll i = 30; i >= 0; i--){
        if(xor_sum & (1 << i)){
            REP(j, n){
                if((a[j] ^ (a[j] - 1)) == (1 << (i + 1)) - 1){
                    cnt++;
                    xor_sum ^= a[j] ^ (a[j] - 1);
                    break;
                }
            }
        }
    }
    if(xor_sum == 0){
        cout << cnt << endl;
    }
    else{
        cout << -1 << endl;
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h> //g++-9で実行（gcc version 9.3.0），g++だとデフォルトのclang

using namespace std;

//#define int long long                         //intでオーバフローした時の切り替え用
#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;                         \
    }
#define Sp(p) cout << setprecision(25) << fixed << p << endl; //小数点以下を25桁で表示
#define all(obj) (obj).begin(), (obj).end()
#define pb push_back

//usingエイリアス（別名という意味，型定義のこと）
using ll = long long;
//template <class T> using Vec = std::vector<T>;//エイリアステンプレート

const ll MOD = (ll)1e9 + 7;
//const ll MOD = 998244353;
const ll INF = (ll)1e18 + 1;
const double EPS = 1e-9;
const long double pi = 3.1415926535897932384626433832795028841971L;

//マクロでintをlong longと定義したときはsinged
int main()
{
    cin.tie(0);                  //cinとcoutの同期を切る（高速化)
    ios::sync_with_stdio(false); //iostreamとstdioの同期を切る（高速化)

    ll N, M;
    cin >> N >> M;
    vector<vector<ll>> graph(N);
    ll a, b;
    for (ll m = 0; m < M; m++)
    {
        cin >> a >> b;
        graph[a-1].pb(b-1);
        graph[b-1].pb(a-1);
    }
    vector<ll> dist(N, -1); //-1は未訪問,道標
    queue<ll> que;

    dist[0] = 0;
    que.push(0); //0を訪問済み

    while (!que.empty())
    {
        ll v = que.front();
        que.pop();

        for (ll nv : graph[v])
        {
            if (dist[nv] != -1)
                continue; //訪問済みの頂点はもういかない
            dist[nv] = v;
            que.push(nv);
        }
    }

    for (ll n = 0; n < N; n++)
    {
        if (dist[n] == -1)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
     for (ll n = 1; n < N; n++) cout << dist[n]+1 << endl;

    return 0;
}

Measured memory_bytes: 12900
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, vector<pair<int, int>>> m;
    for (int i = 0; i < n; ++i) {
        string s;
        int p;
        cin >> s >> p;
        m[s].push_back({ p, i });
    }
    for (pair<string, vector<pair<int, int>>> p : m) {
        vector<pair<int, int>> v = p.second;
        sort(v.rbegin(), v.rend());
        for (pair<int, int> pp : v) {
            cout << pp.second + 1 << endl;
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <array>
#include <algorithm>
#include <numeric>

using namespace std;

class EnergyDrink{
	
public:
	
	long long int cost;
	long long int num;
	
	EnergyDrink(long long int c, long long int n){
		cost = c;
		num = n;
	}
	
	bool operator < (const EnergyDrink &a) const {
        return cost < a.cost;
    }
	
};

int main(){
	
	long long int N, M;
	vector<EnergyDrink> V;
	long long int tmp1, tmp2;
	long long int ans = 0;
	
	scanf("%lld", &N);
	scanf("%lld", &M);
	
	for(long long int i=0; i<N; i++){
		scanf("%lld", &tmp1);
		scanf("%lld", &tmp2);
		V.push_back(EnergyDrink(tmp1, tmp2));
	}
	
	/*
	printf("----test----\n");
	for(int i=0; i<V.size(); i++){
		printf("[%d] A:%d, B:%d\n", i, V[i].cost, V[i].num);
	}
	*/
	
	sort(V.begin(), V.end());
	
	long long int i = 0;
	while(1){
		
		if(V[i].num < M){
			M -= V[i].num;
			ans += V[i].cost * V[i].num;
			i++;
		}else{
			ans += V[i].cost * M;
			break;
		}
		
	}
	
	printf("%lld\n", ans);
	
	return 0;
	
}


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

int main() {
    int a,b,c,d;//b,c,dはそれぞれ1,10,100の位
    cin >> a;
    b = a % 2;
    c = ( a - b ) / 10 % 2;
    d = ( a - b  - c ) / 100 % 2;
    cout << b + c + d << endl;
/*
    int x, y, z;
    cin >> x >> y;
    z = x + y;
    cout << z / 2 + z % 2 << endl;
//    double a, b;
//    cin >> a >> b;
//    cout <<  << endl;*/
}

Measured memory_bytes: 256
#include <iostream>
typedef long long int ll;
using namespace std;
int main(){
	ll n,t,sum=0,af,be;
	cin >> n >> t;
	cin >> be;
	for(ll i=1;i<n;i++){
		cin >> af;
		if((be = af - be) > t)
			sum += t;
		else
			sum += be;
		be = af;
	}
	cout << sum + t << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>

#include <iomanip> //小数点以下を表示させる(setprecision())

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

typedef long long ll; //64bit型
using namespace std;
const ll INF = 1LL << 20;

int main()
{
        int N, K, X, Y;
        cin >> N >> K >> X >> Y;
        int ans = 0;
        if (N < K)
        {
                ans = X * N;
        }
        else
        {
                ans = K * X + (N - K) * Y;
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,k;
    cin >> n >> k;
    VI a(n);
    if ((n + 1) / 2 >= k) cout << "YES" << endl;
    else cout << "NO" << endl;

}

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

Measured memory_bytes: 256
import itertools
S = [i for i in input()]

U = itertools.product(sorted(range(2)), repeat=len(S)-1)
ans = 0

for i in U:
  
  #print("i", i)  #0なら無視1なら数字を区切る
  #print("len(i)", len(i))
  # (0, 0) ... (1, 1) 1つのタプルにlen(S)-1個の要素が入ってる

  n1 = S
  #n2 = []
  for j in range(len(i))[::-1]:
    #print("----")
    #print("j", j)
    #print("i[j]", i[j])
    if i[j] == 1:
      ans += int("".join(n1[j+1:]))
      #n2.append(n1[j+1:])
      n1 = n1[:j+1]
      #print("n1", n1)
  #print("n1", n1, "type:", type("".join(n1)))
  ans += int("".join(n1))
  #n2.append(n1)
#print("======")
#print("n2", n2)
print(ans)



Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int y = s.nextInt();
		String ans = "No";

		if((1==x||3==x||5==x||7==x||8==x||10==x||12==x)&&(1==y||3==y||5==y||7==y||8==y||10==y||12==y)) {
			ans="Yes";
		}else if((4==x||6==x||9==x||11==x)&&(4==y||6==y||9==y||11==y)) {
			ans="Yes";
		}else if(2==x&&2==y) {
			ans="Yes";
		}
		System.out.println(ans);

	}

}

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

char c;

int main(){ 

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

cin>>c;

for(ll i=0; i<10000000000; i++){
	int x=0;
	int y=1;
	x++; y++;
}

if(c=='a'){
	cout<<"vowel"<<endl;
	return 0;
}
if(c=='e'){
	cout<<"vowel"<<endl;
	return 0;
}
if(c=='i'){
	cout<<"vowel"<<endl;
	return 0;
}
if(c=='o'){
	cout<<"vowel"<<endl;
	return 0;
}
if(c=='u'){
	cout<<"vowel"<<endl;
	return 0;
}

cout<<"consonant"<<endl;

}



Measured memory_bytes: 256
NumString = int(input())
String = input()

r_string_num, g_string_num, b_string_num = 0, 0, 0
for i_string in String:
    if i_string == 'R':
        r_string_num += 1
    elif i_string == 'G':
        g_string_num += 1
    else:
        b_string_num += 1
    
total_ans = r_string_num * g_string_num * b_string_num

exclude_num = 0
for i in range(NumString-2):
    for j in range(i+1, NumString-1):
        if (2*j - i) < NumString and String[i] != String[j] and \
            String[j] != String[2*j-i] and String[i] != String[2*j-i]:
            exclude_num += 1

total_ans -= exclude_num

print(total_ans)

Measured memory_bytes: 68160
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define pi acos(-1)

using namespace std;

int main() {
    nl // Bazzi - Paradise

    string s; cin >> s;

    int ans = 0, ma = 0;

    for(auto x : s) {
        if(x == 'R') {
            ans++;
            ma = max(ma, ans);
        }
        else 
            ans = 0; 
    }
    
    cout << ma;
    return 0;
}

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

using namespace std;

int main() {
    int price = 700;
    string add;
    cin >> add;

    for (int i = 0; i < add.length(); ++i) {
        if (add[i] == 'o') {
            price += 100;
                }
    }

    cout << price << '\n';
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

int main() {
  IN(N); IN(M);

  int L = 0, R = N;
  REP(i, M) {
    IN(l); IN(r);
    L = max(L, l);
    R = min(R, r);
  }
  OUT(max(0, R-L+1));

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int):
    for i in range(1,10):
        for j in range(1,10):
            if i*j == N:
                print(YES)
                exit()

    print(NO)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>

int main()
{
    int a, b, c, d;
    std::cin >> a >> b >> c >> d;
    if ((std::abs(a - b) <= d && std::abs(c - b) <= d) || (std::abs(c-a) <=  d))
    {
        std::cout << "Yes" << std::endl;
    }
    else
    {
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

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

	cout << (a / b) << " " << (a%b) << " ";
	printf("%f05\n", (a / (double)b));

	return 0;
}

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

happiness = list(map(int,input().split()))
dp = happiness # dp: i日目にa~cそれぞれの活動をしたときの幸福度の最大値

for i in range(1,N):
    happiness = list(map(int,input().split()))
    dp_pre = dp.copy()

    dp[0] = max(dp_pre[1],dp_pre[2])+happiness[0] # i日目にaをする場合
    dp[1] = max(dp_pre[0],dp_pre[2])+happiness[1] # i日目にbをする場合
    dp[2] = max(dp_pre[1],dp_pre[0])+happiness[2] # i日目にcをする場合
     
print(max(dp))

Measured memory_bytes: 3064
S = input()

l = S[:2]
r = S[2:]

def isMonth(num):
  if 1 <= int(num) <= 12:
    return True
  else:
    return False
  
if isMonth(l) and isMonth(r):
  print("AMBIGUOUS")
elif isMonth(l):
  print("MMYY")
elif isMonth(r):
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3064
# Your code here!
my $N = <STDIN>;
my $s = <STDIN>;
my @s = split(//,$s);

$R=0; $G=0;$B=0;
for(my $i=0;$i<$N;$i++){
    if( $s[$i] eq "R"){
        $R++;
    }elsif( $s[$i] eq "G"){
        $G++;
    }elsif( $s[$i] eq "B"){
        $B++;
    }
}
my $count;
for(my $i=0;$i<$N;$i++){
  for(my $j=$i+1;$j<$N;$j++){
    if( $s[$i] eq $s[$j]){next;}
    #i j固定
    if( (2*$j -$i)>=$N ){ next;}
    if( $s[$i] eq $s[$j+($j-$i)]){next;}
    if( $s[$j] eq $s[$j+($j-$i)]){next;} 
    #print "$i $j $j+$j-$i\n";
    $count++;
 }
}
#print "$R $G $B $count\n";
$ans = ($R * $G * $B) -$count;
print "$ans";

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

int main(){
    string s1;
    string p;
    cin >> s1 >> p;
    string s2 = s1 + s1;
    if(s2.find(p) != -1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0; 
}   

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
	cin >> N;
	int n = N % 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9){
		cout << "hon\n";
	}else if(n == 3){
		cout << "bon\n";
	}else{
		cout << "pon\n";
	}
 
	return 0;
}

Measured memory_bytes: 3592
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    ret = 0
    for k in range(K, N + 2):
        ret += (2 * N - k + 1) * k // 2 - (k - 1) * k // 2 + 1
    print(ret % MOD)


if __name__ == '__main__':
    main()


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

using namespace std;

#define INF (1LL<<45)
typedef vector<double> Vec;

int N;
Vec vw,pf,vf,th;

double f(double W,double pw){
    double res = 0;
    for(int i = 0 ; i < N ; i++){
        double Fi = max(0.0,(th[i]-W*vw[i])/vf[i]);
        res += Fi*pf[i];
    }
    res += W*pw;
    return res;
}

void init(){
    vw.clear(); vw.resize(N);
    pf.clear(); pf.resize(N);
    vf.clear(); vf.resize(N);
    th.clear(); th.resize(N);
}

int main(){
    double pw;
    while(scanf("%d %lf",&N,&pw), N){
        init();
        for(int i = 0 ; i < N ; i++){
            scanf("%lf %lf %lf %lf",&vw[i],&pf[i],&vf[i],&th[i]);
        }
        double L = 0, R = INF;
        for(int i = 0 ; i < 150 ; i++){
            double l = (L*2 + R) / 3;
            double r = (L + R*2) / 3;
            if(f(l,pw) > f(r,pw)){
                L = l;
            }else{
                R = r;
            }
        }
        printf("%.12f\n",f((L+R)/2,pw));
    }
    return 0;
}

Measured memory_bytes: 4172
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let nk = readn::<usize>(" ");
    let n = nk[0];
    let k = nk[1];

    let mut l = readn::<usize>(" ");
    l.sort_by(|a, b| b.cmp(&a));

    let mut sum = 0;
    for i in 0..k {
        sum += l[i];
    }

    println!("{}", sum);
}

Measured memory_bytes: 4352
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;

namespace abc150
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new Input(Console.In));
        }

        public void Solve(Input input)
        {
            var c = input.Read.ToCharArray()[0];
            var ascii = (int)c;
            var output = (char)(ascii + 1);

            Console.WriteLine(output);

        }
    }

    public class Input
    {
        private TextReader Stream { get; }
        private char Separator { get; }
        private Queue<string> InputStream { get; }

        public Input(TextReader stream, char separator = ' ')
        {
            Stream = stream;
            Separator = separator;
            InputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (InputStream.Count != 0) return InputStream.Dequeue();
                string[] tmp = Stream.ReadLine().Split(Separator);
                for (int i = 0; i < tmp.Length; ++i)
                    InputStream.Enqueue(tmp[i]);
                return InputStream.Dequeue();
            }
        }

        public string ReadLine => Stream.ReadLine();
        public int ReadInt => int.Parse(Read);
        public long ReadLong => long.Parse(Read);
        public double ReadDouble => double.Parse(Read);
        public int[] ReadIntArray => Stream.ReadLine().Split(Separator).Select(i => int.Parse(i)).ToArray();
        public long[] ReadLongArray => Stream.ReadLine().Split(Separator).Select(l => long.Parse(l)).ToArray();
    }
}


Measured memory_bytes: 11220
# -*- coding: utf-8 -*-

import sys
from itertools import combinations
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

if N==1:
    print(1)
    exit()

xy=[]
for i in range(N):
    x,y=MAP()
    xy.append((x, y))

C=Counter()
for comb in combinations(xy, 2):
    a,b=comb
    if a[0]-b[0]==0:
        key=INF
    else:
        key=(a[1]-b[1])/(a[0]-b[0])
    C[(key, abs(a[0]-b[0]), abs(a[1]-b[1]))]+=1

mx=max(C.values())
print(N-mx)


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

using namespace std;

#define INPUT_OUTPUT { \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout); \
}

int main()
{
    // INPUT_OUTPUT;
    string s;
    cin >> s;
    for(int i=0; i < (int)s.size(); i++) {
        if(s.at(i) == ',') s.at(i) = ' ';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256