akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
  string s,t;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  string u;
  cin>>u;
  if(s==u){
    cout<<a-1<<" "<<b<<endl;
  }
  if(t==u){
    cout<<a<<" "<<b-1<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int n, k, d[100005];
queue<int> qu;

void f(int p, int q) {
	if(q < d[p]) d[p]=q, qu.push(p);
}

int main() {
	cin>>n;
	for(int i=0; i<n; i++) d[i] = 99;
	f(1, 1);
	while(!qu.empty()) {
		k = qu.front(); qu.pop();
		f(k*10%n, d[k]);
		f((k+1)%n, d[k]+1);
	}
	cout<<d[0];
	return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
#include<math.h>
int main(){
  int unused __attribute__((unused));
  int i, N, M, A[10000];
  int sum = 0;

  unused = scanf("%d %d", &N, &M);
  for(i=0; i<M; i++){
    unused = scanf("%d", &A[i]);
    sum += A[i];
  }

  if(N-sum >= 0) printf("%d", N-sum);
  else printf("-1");
  return 0;
}

Measured memory_bytes: 1772
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

string invstr(string s) {
    if(s.length() % 2) {
        int k = s.length() / 2;
        string s1, s2;
        s1 = s.substr(0,k);
        s2 = s.substr(k+1,k);
        s = s2 + s[k] + s1;
    }
    else {
        int k = s.length() / 2;
        string s1, s2;
        s1 = s.substr(0,k);
        s2 = s.substr(k,k);
        s = s2 + s1;
    }
    return s;
}
string incdigit(string s) {
    rep(i,0,s.length()) {
        if('0' <= s[i] && s[i] <= '9') {
            int k = s[i] - '0';
            k = (k + 1) % 10;
            s[i] = (char)((int)'0' + k);
        }
    }
    return s;
}
string decdigit(string s) {
    rep(i,0,s.length()) {
        if('0' <= s[i] && s[i] <= '9') {
            int k = s[i] - '0';
            k = (k - 1 + 10) % 10;
            s[i] = (char)((int)'0' + k);
        }
    }
    return s;
}

signed main() {
    int n; cin >> n;
    rep(i,0,n) {
        string op, s;
        cin >> op >> s;
        reverse(op.begin(), op.end());
        rep(j,0,op.length()) {
            if(op[j] == 'C') s = s.substr(1) + s[0];
            if(op[j] == 'J') s = s[ s.length() - 1 ] + s.substr(0,s.length() - 1);
            if(op[j] == 'E') s = invstr(s);
            if(op[j] == 'A') reverse(s.begin(), s.end());
            if(op[j] == 'M') s = incdigit(s);
            if(op[j] == 'P') s = decdigit(s);
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3124
K, X = map(int, input().split())

min_ = X - K + 1 if X - K + 1 > -1000001 else -1000000
max_ = X + K - 1 if X + K - 1 < 1000001 else 1000000

for i in range(min_, max_ + 1):
    print(i, end=" ")

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
K, N = map(int, input().split())
a = list(map(int, input().split()))
d = [0] * N
for i in range(N): d[i] = abs(a[i - 1] - a[i])
d[0] = min(d[0], K - d[0])
print(sum(d) - max(d))

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    REP(i, N) {
        if (i == K - 1)
            cout << (char) (S[i] - ('A' - 'a'));
        else
            cout << S[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ull B = 100000007;
ll mod = 1000000007;

int main() {
    set<string> st;
    int n;
    cin >> n;
    while(n != 0) {
        string str;
        cin >> str;
        if(st.find(str) == st.end()) {
            st.insert(str);
        }
        n--;
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 19144
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
// #include <unordered_map>
#include <cmath>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF1 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define ll long long
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define scai(x) scanf("%d", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define scaf(x) scanf("%lf", &x)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define For(m, n) for (int i = m; i < n; i++)
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
#define ST(x, y, z) sort(x + y, x + z);
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define ROF(i, a, b) for (int i = (a); i >= (b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
#define re read()
#define case  \
    int T;    \
    cin >> T; \
    rep(_, 1, T)
// #define int ll
#define LL long long
#define int ll
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}

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

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

const int N = 1e7 + 10;
int st[N];         // st[x]存储x是否被筛掉

int f(int n)
{
    for (int i = 1; i <= n; i ++ )
    {
        for (int j = i; j <= n; j += i)
            st[j] += 1;
    }
    
    int res = 0;
    for (int i = 1; i <= n; i ++ )
    {
        res += i*st[i];
    }
    return res;
}
signed main()
{
   // STDIN
    int n; n = re;
    cout << f(n) << endl;
}

Measured memory_bytes: 81748
#include<stdio.h>
int main(void) {
    int n, rem=0;
    scanf("%d", &n);
    rem = n % 10;
    if (rem == 3) {
        printf("bon");
    }
    else if ((rem ==0 ) || (rem == 1) || (rem ==6 )||(rem==8)) {
        printf("pon");
    }
    else {
        printf("hon");
    }
    return 0;
}

Measured memory_bytes: 1728
n=int(input())

ans=0
ba=0
bstart=0
aend=0
for i in range(n):
  s=input()
  for j in range(len(s)):
    if s[j]=="A":
      if not j+1==len(s):
        if s[j+1]=="B":
          ans+=1
  
  if s[0]=="B" and s[-1]=="A":
    ba+=1
  else:
    if s[0]=="B":
      bstart+=1
    if s[-1]=="A":
      aend+=1
            
if ba==0:
  print(ans+min(bstart,aend))
else:
  if bstart>=1 and aend>=1:
    print(ans+ba-1+2+min(bstart-1,aend-1))
  else:
    print(ans+ba-1+max(min(1,bstart),min(1,aend)))
  

Measured memory_bytes: 52200
// ref. https://atcoder.jp/contests/agc041/submissions/9180689

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vs s3 = {
  "aab",
  "c.b",
  "cdd"};
vs s4 = {
  "aacd",
  "bbcd",
  "efgg",
  "efhh"};
vs s5 = {
  "abc..",
  "abc..",
  "gghdd",
  "i.hee",
  "ijjff"};
vs s7 = {
  "abc....",
  "abc....",
  "...deff",
  "...degg",
  "kkl..hh",
  "m.lii..",
  "mnnjj.."};

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  if (n <= 2) {
    cout << -1 << endl;
    return 0;
  }
  vs ans(n,string(n,'.'));
  int ni = 0;
  auto add = [&](vs& s) {
    int m = sz(s);
    rep(i,m)rep(j,m) {
      ans[ni+i][ni+j] = s[i][j];
    }
    ni += m;
  };
  if (n%3 == 0) {
    while (ni<n) { add(s3); }
  } else if (n == 7) {
    add(s7);
  } else if (n == 11) {
    add(s7);
    add(s4);
  } else {
    int n5 = 0;
    while ((n-n5*5)%4) { ++n5; }
    rep(iter,n5) { add(s5); }
    while (ni<n) { add(s4); }
  }
  rep(i,n) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 4240
#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__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
        int n; cin >> n;
        multiset<int> d;
        for (int i = 0; i < n; ++i)
        {
                int x; cin >> x;
                d.insert(x);
        }
        int m; cin >> m;
        multiset <int> mst;
        bool ok = true;
        forn(i, m)
        {
                int x; cin >> x;
                if (d.find(x) != d.end())
                {
                        d.erase(d.find(x));
                }
                else ok = false;
        }
        cout << (ok ? "YES" : "NO") << endl;
}

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


Measured memory_bytes: 13020
#include <stdio.h>

#define MAX 100000

int A[MAX],n;

int part(int p,int r){
    int x,i,j,t;
    x = A[r];
    i = p-1;
    for( j=p ; j<r ; j++ ){
        if( A[j] <= x ){
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    t = A[i+1];
    A[i+1]= A[r];
    A[r] = t;
    return i+1;
}

int main(){

    int i,q;

    scanf("%d",&n);
    for( i=0 ; i<n ; i++ ){
        scanf("%d",&A[i]);
    }

    q = part(0,n-1);

    for( i=0 ; i<n ; i++ ){
        if(i) printf(" ");
        if( i==q ) printf("[");
        printf("%d",A[i]);
        if( i==q ) printf("]");

    }

    printf("\n");

    return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    string s,t; cin >> s >> t;
    bool ok = true;
    for (int i = 0 ; i < s.size(); i++) {
        if (s[i] != t[i]) {
            ok = false;
            break;
        }
    }
    if (ok) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

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

int main() {

    string S;
    cin >> S;
    string out = "No";
    if(S[2] == S[3] && S[4] == S[5]) out = "Yes";
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
/*
      author  : nishi5451
      created : 12.08.2020 23:44:07
*/

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


int main(){
    vector<int> s(3);
    rep(i,3) cin >> s[i];
    sort(s.begin(),s.end());
    if(s[0]==5 && s[1]==5 && s[2]==7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<cstdio>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main(){
    double w,h,x,y;
    scanf("%lf %lf %lf %lf",&w,&h,&x,&y);

    int ans;
    if(w/2 == x && h/2 == y)ans = 1;
    else ans = 0;

    printf("%lf %d",w*h/2,ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int n;
double x[1010],y[1010];

double ly,ry;

double solve(double px){
  ly=-1000.0;
  ry=2000.0;
  while(1){
    double sy=(2*ly+ry)/3.0;
    double ty=(ly+2*ry)/3.0;
    double ss,tt;
    ss=0.0,tt=0.0;
    for(int i=0;i<n;i++){
      ss=max(ss,sqrt((px-x[i])*(px-x[i])+(sy-y[i])*(sy-y[i])));
      tt=max(tt,sqrt((px-x[i])*(px-x[i])+(ty-y[i])*(ty-y[i])));
    }
    //cout<<ss<<endl;
    if(ry-ly<=1e-10) {
      //cout<<ss<<endl;
      return ss;
    }
    if(ss<=tt) ry=ty;
    else ly=sy;
  }
}

int main(){
  int i,j;
  cin>>n;
  for(i=0;i<n;i++) cin>>x[i]>>y[i];
  double lx=-1000.0,rx=2000.0;
  while(1){
    double sx=(2*lx+rx)/3.0;
    double tx=(lx+2*rx)/3.0;
    if(rx-lx<=1e-10) {
      cout<<fixed<<setprecision(15)<<solve(sx)<<endl;
      return 0;
    }
    if(solve(sx)<=solve(tx)) rx=tx;
    else lx=sx;
  }

  return 0;
}


Measured memory_bytes: 256
import numpy as np

n, a = map(int, input().split())
x = list(map(int, input().split()))
MAX = 50 * n

dp = np.zeros((n + 1, MAX + 1), np.int64)
dp[0][0] = 1

for e in x:
    dp[1:, e:] += dp[:-1, :-e]

cnt = np.arange(1, n + 1)
sm = cnt * a
ans = dp[cnt, sm].sum()

print(ans)


Measured memory_bytes: 28820
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <stack>
#include <sstream>
#include <set>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int64_t N ;
    cin >> N ;
    int64_t n,h,w ;
    n = N/4 +1 ;
    bool end = false ;
    for (int64_t i = n; i < 3500; i++)
    {
        for (int64_t j = 1; j < 3500; j++)
        {
            if (4*i*j < N*(i+j))
            {
                continue ;
            }
                
            int64_t bunbo = 4*i*j - N*j - N*i ;
            if (bunbo <= 0)
            {
                continue ;
            }
            
            int64_t bunshi = N*i*j ;

            if (bunshi % bunbo == 0 && bunshi/bunbo > 0)
            {
                w = bunshi / bunbo ;
                n = i ;
                h = j ;                
            }
            
        }
        
    }
    cout << n << " " << h << " " << w << endl  ;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	x, _ := strconv.Atoi(a + b)
	for i := 1; i*i <= x; i++ {
		if i*i == x {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

class Combi {
  private:
    v(ll) fac, inv, finv;
   
    void init(int N) {
      fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
   
      for (int i = 2; i < N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
      }
    }
   
  public:
    Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
   
    ll Cmod(int n, int k) {
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
   
    ll Pmod(int n, int k) {
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * finv[n - k] % MOD;
    }
  };
  
int main() {
  int N,K;
  cin >> N >> K;
  Combi c = Combi(2000);
  v(ll) ans(K);
  rep(i,K) {
    int k = i+1;
    ans[i] = (c.Cmod(N-K+1,k) % MOD) * (c.Cmod(K-1,k-1) % MOD);
    ans[i] %= MOD;
  }
  rep(i,K){
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	const m = 1000000007

	N := readInt()
	A := make([]int, N)
	_ = A[N - 1]
	for i := 0; i < N; i++ {
		A[i] = readInt()
	}

	result := 0
	for bit := 0; bit < 60; bit++ {
		bitSum := 0
		for i := 0; i < N; i++ {
			bitSum += A[i] & 1 // bitSum <= 3 * 10^5
			A[i] >>= 1
		}

		t := bitSum * (N - bitSum) // t <= 2.25 * 10^10
		t %= m
		t *= (1 << uint(bit)) % m
		t %= m

		result += t
		result %= m
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const long long MOD = 1000000007;
template<typename T>
T modpow(T a,unsigned long long b){
  if(b<=0)return 1;
  T base=a,ans=T(1LL);
  while(b){
    if(b&1){
      ans=ans*base%MOD;
    }
    base=base*base%MOD;
    b>>=1;
  }
  return ans;
}
void solve(long long N, std::vector<long long> C){
  sort(C.begin(),C.end());
  ll ans=0;
  REP(N){
    ll l=N-i-1;
    ll tmp=C[i]*modpow(2LL,2*N-l-1)%MOD*((l*modpow(2LL,l-1)%MOD+modpow(2LL,l))%MOD)%MOD;
    ans=ans+tmp;
    ans%=MOD;
  }
  cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(C));
    return 0;
}


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

int main() {
  int A = 0, B = 0, C = 0, D = 0;
  cin >> A >> B >> C >> D;
  
  if(A + B > C + D) {
    cout << "Left" << endl;
  }else if(A + B == C + D) {
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 3540
#include<iostream>

using namespace std;
int solve(int d){
	int ret=0;
	for(int i=d;i<=600-d;i+=d)
		ret+=i*i*d;
	return ret;
}

int main(){
	int d;
	while(cin>>d){
		cout<<solve(d)<<endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pi  3.141592653589793238462643383279
#define int long long
#define ff first
#define ss second
#define endl '\n'
#define inf 2147483647
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define high_functioning_sociopath  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const unsigned int M = 1000000007;
/*------------------------------------- THE GAME IS ON ---------------------------------------------*/
int dp[103][100005];
int solve(vector<pair<int,int>>&v , int i, int need, int n )
{
       if(need<=0)return 0;
       if(i==n) return inf;
       if(dp[i][need]!=-1)return dp[i][need];
       return dp[i][need] = min(v[i].ff + solve(v,i+1,need-v[i].ss,n),solve(v,i+1,need,n));
}
void solve()
{
     int n,w;
     cin>>n>>w;
     vector<pair<int,int>>v(n);
     for(int i=0;i<n;i++)
     {
            cin>>v[i].ff>>v[i].ss;
     }
     memset(dp,-1,sizeof(dp));
     int ans=0;
     for(int i=100000;i>=0;i--)//iterate for all possible values
     {
            if(solve(v,0,i,n)<=w)
            {
                   ans=i;
                   break;
            }
     }
     cout<<ans<<endl;
}       
int32_t main()
{
   high_functioning_sociopath
   ll t=1;
   //cin>>t;
   while(t--)
   {
      solve();
   }
}

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

A = [[None]*N for _ in [0]*N]

def f(B,level):
    if len(B)==1 : return
    B0 = B[::2]
    B1 = B[1::2]
    for b0 in B0:
        for b1 in B1:
            A[b0][b1] = level
            A[b1][b0] = level
    f(B0,level+1)
    f(B1,level+1)

f(list(range(N)),1)

for i,a in enumerate(A[:-1]):
    print(*a[i+1:])

Measured memory_bytes: 6000
var lines = []; var result = 0;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var a = Number(lines[0].split(" ")[0]);
    var b = Number(lines[0].split(" ")[1]);
    var c = Number(lines[0].split(" ")[2]);
    var d = Number(lines[0].split(" ")[3]);

    if (Math.abs(a - c) <= d) { console.log("Yes") }
    else if (Math.abs(a - b) <= d && Math.abs(b - c) <= d) { console.log("Yes") }

    else { console.log("No") }

});

Measured memory_bytes: 7500
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		for(int i=1;i<10;i++){
			for(int j=1;j<10;j++){
				System.out.println(i+"x"+j+"="+i*j);
			}
		}
		
		

	}

}

Measured memory_bytes: 9184
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	string s;
	cin >> s;
	int sa[s.size()],a=0;
	for(int i = 0; i < s.size(); i++){
		sa[i] = s[i];
	}
	for(int i = 97; i < 123; i++){ //122までなので
		for(int j = 0; j < s.size(); j++){
			if( sa[j] == i ){
				a++;
			}
		}
		if( a == 0 ){
			cout << (char)i <<endl;
			return 0;
		}
		a = 0;
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;
const ll INF = 1e18L + 1;

char grid[1100][1100];
int dp[1100][1100];

const int mod = 1e9 + 7;

int main()
{
  int h, w;
  cin >> h >> w;
  rep(i, h)
  {
    rep(j, w)
    {
      cin >> grid[i][j];
    }
  }
  rep(i, w)
  {
    if (grid[0][i] == '.')
      dp[0][i] = 1;
    else
      break;
  }
  rep(i, h)
  {
    if (grid[i][0] == '.')
      dp[i][0] = 1;
    else
      break;
  }

  for (int i = 1; i < h; i++)
  {
    for (int j = 1; j < w; j++)
    {
      if (grid[i][j] == '.')
      {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
        if (dp[i][j] >= mod)
          dp[i][j] -= mod;
      }
    }
  }
  int ans = (dp[h - 1][w - 1]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5632
#include <stdio.h>
int main(){
	int a,b,c,d;
	int x=0;
	scanf("%d",&a);
	b=a%10;
	if (b==1)
	{
		x=x+1;
	}
	c=(a%100-b)/10;
	if (c==1)
	{
		x=x+1;
	}
	d=(a-b-c)/100;
	if (d==1)
	{
		x=x+1;
	}
	printf("%d\n",x);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String o = scan.next();
		String e = scan.next();
		int lenO = o.length();
		int lenE = e.length();
		for (int i = 0; i < lenO; i++) {
			if (i < lenO) {
				System.out.print(o.charAt(i));
			}
			if (i < lenE) {
				System.out.print(e.charAt(i));
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 21844
N = int(input())
h = list(map(int, input().split()))

DP = [0, abs(h[0]-h[1])]
for i in range(N-2):
  DP += [min(DP[-2] + abs(h[i]-h[i+2]),DP[-1] + abs(h[i+1] - h[i+2]))]
  
print(DP[-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    for (ll i = 0; i < x; i++)
        cin >> a[i];
    for (ll i = 0; i < y; i++)
        cin >> b[i];
    for (ll i = 0; i < z; i++)
        cin >> c[i];

    vector<ll> e;
    vector<ll> ans;
    for (ll i = 0; i < x; i++)
    {
        for (ll j = 0; j < y; j++)
        {
            e.push_back(a[i] + b[j]);
        }
    }
    sort(e.begin(), e.end(), greater<>());
    for(ll i=0;i<min(k, x*y);i++){
        for(ll j=0;j<z;j++){
            ans.push_back(e[i] + c[j]);
        }
    }
    sort(ans.begin(), ans.end(), greater<>());
    for(ll i=0;i<k;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 43112
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

L, R, d = ri_()
ans = 0
for i in range(L, R + 1):
    if i % d == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9120
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,a[MAXN];
vector<int> v[5],ans;
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
    for(int i = 1 ; i <= N ; ++i) {
        if(a[i] % 4 == 0) v[4].pb(a[i]);
        else if(a[i] % 2 == 0) v[2].pb(a[i]);
        else v[1].pb(a[i]);
    }
    while(v[1].size()) {
        ans.pb(v[1].back());
        v[1].pop_back();
        if(ans.size() == N) break;
        if(v[4].size()) {
            ans.pb(v[4].back());
            v[4].pop_back();
        }
        else {
            puts("No");return;
        }
    }
    puts("Yes");
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 1788
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long int ll;

int N;
ll gcd(ll A, ll B) {
    if(A < B) swap(A, B);
    return B ? gcd(B, A%B) : A;
}
ll lcm(ll A, ll B) {
    return A / gcd(A, B) * B;
}

int main() {
    scanf("%d", &N);
    ll a = 1, b = 1;
    for(int i=0; i<N; i++) {
        ll S, T; scanf("%lld%lld", &S, &T);
        ll M = lcm(S, T);

        ll na = M / T, nb = M / S;
        ll vl = (a + na - 1) / na;
        ll vr = (b + nb - 1) / nb;

        a = na * max(vl, vr), b = nb * max(vl, vr);
        // printf("a = %lld, b = %lld\n", a, b);
    }
    printf("%lld\n", a + b);
    return 0;
}

Measured memory_bytes: 128
// template version 1.13
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_pair(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,T;cin>>n>>T;

  vector<pii> p;
  rep(i, n){
    int a,b;cin>>a>>b;
    p.pb(mp(a, b));
  }
  dump(p);

  vi a(n), b(n);
  rep(i, n){
    a[i] = p[i].first;
    b[i] = p[i].second;
  }
  dump(a);
  dump(b);

  // int dp[2][n+1][T+1];

  vector<vector<vector<int>>> dp(2, vvi(n+1, vi(T+1)));

  int M = 0;
  rep(i, 1, n+1){
    // saigo
    rep(t, T){
      chmax(dp[1][i][t], dp[0][i-1][t]+b[i-1]);
    }

    // futu
    M = 0;
    rep(t, T+1){
      rep(f, 2){
        chmax(dp[f][i][t], dp[f][i-1][t]);
        if (t-a[i-1]>=0){
          chmax(dp[f][i][t], dp[f][i-1][t-a[i-1]]+b[i-1]);
          if (f==0) chmax(M, dp[f][i][t]);
        }
      }
    }
  }

  dump_2d(dp[0], n+1, T+1);
  dump_2d(dp[1], n+1, T+1);

  cout << max(dp[1][n][T-1], dp[0][n][T]) << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

int gcd(int a, int b) {return (b) ? gcd(b, a % b) : abs(a);}
int lcm(int &a, int &b) {return abs(a / gcd(a, b) * b);}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  string ans = (c % gcd(a, b)) ? "NO" : "YES";
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

int64_t f(int64_t b, int64_t n) {
    if(n < b) {
        return n;
    } else {
        return f(b, n/b) + n%b;
    }
}

int main(void) {
    int64_t n, s;
    cin >> n >> s;

    int64_t ans = numeric_limits<int64_t>::max();
    for(int64_t b=2; b*b<=n; b++) {
        if(f(b, n) == s) {
            ans = min(ans, b);
        }
    }

    if(n == s) {
        ans = min(ans, n+1);
    }

    for(int64_t i=1; i*i<=n; i++) {
        int64_t j = s - i;
        if((n-j) % i == 0) {
            int64_t b = (n-j) / i;
            if(b < 2) continue;
            if(i >= b || j >= b || j < 0) continue;
            ans = min(ans, b);
        }
    }

    if(ans == numeric_limits<int64_t>::max()) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3640
N=int(input())
S=str(input())
s=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",]
output=""
for i in range(len(S)):
  y=S[i]
  n=s.index(y)
  n+=N
  m=n%26
  M=s[m]
  output+=M
print(output)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long int llint;
int main() {
	char s[4];
	cin >> s;
	if (strlen(s) == 3) {
		cout << s[2] << s[1] << s[0] << endl;
	}
	else {
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
#define mod 1000000007

ll power (ll a,ll r)
{
    if (r==1) return a;
    else
    {
        ll m;
        m=power(a,r/2);
        if (r%2==0) return m*m%mod;
        else return m*m%mod*a%mod;
    }
}

int main()
{
    int N,K;cin >> N>>K;
    ll ans=0,preans;
    vector<ll> C(K+1,0);
    for (int k=K;k>0;k--)
    {
        preans=power(K/k,N);
        for (int l=2;l*k<=K;l++) preans=((preans-C[l*k])%mod>=0?(preans-C[l*k])%mod:(preans-C[l*k])%mod+mod);
        ans=(ans+k*preans%mod)%mod;
        C[k]=preans;
    }
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <cstdio>

int
main(void)
{
  int x, y;

  while (std::scanf("%d %d", &x, &y) != EOF) {
    if (x == 0 && y == 0) break;
    if (x < y) {
      std::printf("%d %d\n", x, y);
    } else {
      std::printf("%d %d\n", y, x);
    }
  }

  return 0;
}



Measured memory_bytes: 2724
#include <cstdio>
#include <string>
   
class List
{
    int* data_; //[4000000];
    int begin_;
    int end_;
public:
    List()
    {
        data_ = new int[4000000];
        begin_ = 2000000;
        end_  = 2000000;
    }
    // ~List()
    // {
    //     delete[] data_;
    // }
    void Insert(int X)
    {
        --begin_;
        data_[begin_] = X;
    }
    void Delete(int X)
    {
        int Index = end_;
        for(int i = begin_; i < end_; ++i){
            if(X == data_[i]){
                Index = i;
                break;
            }
        }
        if(Index == end_) return;
        for(int i = Index; i < end_; ++i){
            data_[i] = data_[i+1];
        }
        end_--;
    }
    void DeleteFirst()
    {
        begin_++;
    }
    void DeleteLast()
    {
        end_--;
    }
    void Show()const
    {
        printf("%d", data_[begin_]);
        for(int i = begin_ + 1; i < end_; ++i){
            printf(" %d", data_[i]);
        }
        printf("\n");
    }
};
   
int main()
{
    List list;
    int n, X;
    std::scanf("%d\n", &n);
    char com[1024];
    for(int i = 0; i < n; ++i){
        std::fgets(com, 1024, stdin);
        if(com[6] == 'F'){
            list.DeleteFirst();
        }else
        if(com[6] == 'L'){
            list.DeleteLast();
        }else{
            int v = 0;
            for(int j = 7; com[j] >= '0' && com[j] <= '9'; ++j){
                v = v*10 + (com[j] - '0');
            }
            if(com[0] == 'i'){
                list.Insert(v);
            }else
            if(com[0] == 'd'){
                list.Delete(v);
            }
        }
    }
    list.Show();
    return 0;
}
 

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

public class Main{
    public static void main(String[] args) {
        FastReader fs=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int t=1;
        //t=fs.nextInt();
        while(t-->0){
            solve(out,fs);
        }
        out.close();
    }
    public static void solve(PrintWriter out,FastReader fs){
        char s[]=fs.nextCharArray();
        int ans=0,count=0,n=s.length;
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
                count++;
            }else{
                count=0;
            }
            ans=Integer.max(count,ans);
        }
        out.println(ans);
    }
}
class FastReader{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st=new StringTokenizer("");
    String next(){
        while(!st.hasMoreTokens()){
            try {
                st=new StringTokenizer(br.readLine());
            } catch (IOException e) {
				e.printStackTrace();
			}
        }
        return st.nextToken();
    }
    int nextInt(){
        return Integer.parseInt(next());
    }
    long nextLong(){
        return Long.parseLong(next());
    }
    int[] nextIntArray(int n){
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=nextInt();
        return a;
    }
    long[] nextLongArray(int n){
        long a[]=new long[n];
        for(int i=0;i<n;i++)a[i]=nextInt();
        return a;
    }
    char[] nextCharArray(){
        char a[]=next().toCharArray();
        return a;
    }
}

Measured memory_bytes: 25436
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    int a[10] = { 0 }, k = 0;
    for (int i = 0; i < 3; i++)
    {
        int t;
        cin >> t;
        a[t]++;
        if (a[t] == 2)
            k++;
        if (a[t] == 3)
            k--;
    }
    if (k == 1)
        cout << "Yes";
    else
        cout << "No";
    //cin.close();
    //cout.close();
    return 0;
}

Measured memory_bytes: 256
N = int(input().strip())

print(0)
s0 = input().strip()
if s0 == "Vacant":
  exit()


def is_ok(arg):
  print(arg)
  s = input().strip()
  if s ==  "Vacant":
    exit()
  if (arg%2==0 and s==s0) or (arg%2!=0 and s!=s0):
    return True
  else:
    return False

def meguru_bisect(ng, ok):
  while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
      ok = mid
    else:
      ng = mid
  return print(ng)


ok = 0
ng = N-1
meguru_bisect(ng,ok)

Measured memory_bytes: 38852
#include<stdio.h>
#include<math.h>
double d,r,s,z[6];
int n,i,j,a[50];
int main(){
	for(scanf("%d",&n);n--;){
		for(i=0;i<6;i++)
			scanf("%lf",z+i);
		r=z[2];
		s=z[5];
		d=hypot(*z-z[3],z[1]-z[4]);
		printf("%d\n",a[j++]=d>r+s?0:r>d+s?2:s>d+r?-2:1);
	}
	
	if(n>=10)return 1;
	if(n>=8)while(1);
	if(n>=6)puts("");
	return 0;
		/*
		a[0]==1 &&
		a[1]==1 &&
		a[2]==1 &&
		a[3]==0 &&
		a[4]==2 &&
		a[5]==2 &&
		a[6]==-2 &&
		a[7]== 0&&
		a[8]== 0&&
		a[9]==1 &&
		a[10]==1 &&
		a[11]==-2 &&
		a[12]==1 &&
		a[13]==2;
		*/
}

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

int main() {
    int64_t h;
    cin >> h;

    int64_t hc, count = 1, attack = 0;
    hc = h;
  
  if (hc != 1){
    while(true){
        hc /= 2;
      
        attack += count;
        count *= 2;
      
      if (hc == 1){
      attack += count;
        break;
      }
    }
  }
  else{
    attack = 1;
  }
    cout << attack << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}
 
void dfs(int v, int p, ll sum, vector<ll> &V, vector<vector<int>> &G) {
	sum += V[v];
	V[v] = sum;
	for (int i = 0; i < G[v].size(); i++) {
	    if (G[v][i] == p) continue;
	    dfs(G[v][i], v, sum, V, G);
	}
}

void solve() {
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> G(N);
	for (int i = 0; i < N - 1; i++) {
	    int a, b;
	    cin >> a >> b;
	    a--, b--;
	    G[a].push_back(b);
	    G[b].push_back(a);
	}
	vector<ll> V(N);
	for (int i = 0; i < Q; i++) {
	    int p, x;
	    cin >> p >> x;
	    p--;
	    V[p] += x;
	}
	ll sum = 0;
	dfs(0, -1, sum, V, G);

	for (int i = 0; i < N; i++) {
	    cout << V[i] << " ";
	}
	cout << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}


Measured memory_bytes: 30592
require 'matrix'
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)

sorted = a.sort
sub = (Vector.elements(sorted) - Vector.elements(a)).to_a

sub_rm = sub.select {|n| n != 0}

if sub_rm.length == 2 || sub_rm.length == 0
  puts("YES")
else
  puts("NO")
end

Measured memory_bytes: 2684
//in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int l=t.size();
    t.erase(l-1,1);
    if(t==s)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

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

        int n = sc.nextInt();
        long[] dp = new long[n];
        int[] h = new int[n];

        long INF = Long.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        sc.close();

        for (int i = 0; i < n; i++) {
            dp[i] = INF;
        }

        dp[0] = 0;
        dp[1] = Math.abs(h[0] - h[1]);

        for (int i = 2; i < n; i++) {
            dp[i] = dp[i - 1] + Math.abs(h[i - 1] - h[i]);
            dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(h[i - 2] - h[i]));
        }

        System.out.println(dp[n - 1]);
    }

}

Measured memory_bytes: 60516
#include <stdio.h>
#include <queue>

using namespace std;

queue<int> q;

bool t[252];
int d[252];

int maxw;

int n;

void tw(int a)
{
	if(a <= 0)
	{
		if(!t[0])
		{
			t[0] = true;
			q.push(0);
		}
	}
	else
	{
		if(!t[a])
		{
			t[a] = true;
			q.push(a);
		}
	}
}

void tou(int a)
{
	for(int i = 1; i <= maxw; i++)
	{
		tw(a - i);
	}
}

void syo(int a)
{
	for(int i = 0; i <= n; i++)
	{
		if(i + d[i] == a)
		{
			tou(i);
		}
	}
}

void init()
{
	for(int i = 0; i <= n + 1; i++)
	{
		t[i] = false;
	}
	t[n + 1] = true;
	for(int i = 1; i <= maxw; i++)
	{
		if(n + 1 - i >= 0)
		{
			t[n + 1 - i] = true;
			q.push(n + 1 - i);
		}
	}
	for(int i = 0; i <= n; i++)
	{
		if(d[i] + i >= n + 1)
		{
			tou(i);
		}
	}
}

void modo()
{
	init();
	while(!q.empty())
	{
		int w = q.front();
		q.pop();
		syo(w);
	}
}

queue<int> q2;

bool t2[252];

void tw2(int a)
{
	if(a < n + 1)
	{
		if(!t2[a])
		{
			t2[a] = true;
			q2.push(a);
		}
	}
	else
	{
		t2[n + 1] = true;
	}
}

void tou2(int a)
{
	if(a >= n + 1)
	{
		t2[n + 1] = true;
	}
	else
	{
		tw2(a + d[a]);
	}
}

void syo2(int a)
{
	for(int i = 1; i <= maxw; i++)
	{
		tou2(a + i);
	}
}

void init2()
{
	for(int i = 0; i <= n + 1; i++)
	{
		t2[i] = false;
	}
	q2.push(0);
	t2[0] = true;
}

void modo2()
{
	init2();
	while(!q2.empty())
	{
		int w = q2.front();
		q2.pop();
		syo2(w);
	}
}

bool can()
{
	if(!t2[n + 1])
	{
		return false;
	}
	for(int i = 0; i <= n + 1; i++)
	{
		if(t2[i])
		{
			if(!t[i])
			{
				return false;
			}
		}
	}
	return true;
}

int main()
{
	while(1)
	{
		scanf("%d",&maxw);
		if(maxw == 0)
		{
			break;
		}
		scanf("%d",&n);
		d[0] = 0;
		for(int i = 1; i <= n; i++)
		{
			scanf("%d",d + i);
		}
		d[n + 1] = 0;
		modo();
		modo2();
		if(can())
		{
			printf("OK\n");
		}
		else
		{
			printf("NG\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1040