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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll n, d;
  cin >> n >> d;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];

  vector<bool> flag1(n);
  vector<ll> b(n), pfxb(n+1);
  REP(i, n) b[i] = a[i]-i*d;
  pfxb[0] = LLINF;
  REP(i, n) {
    if(b[i] < pfxb[i]) {
      flag1[i] = 1;
      pfxb[i+1] = b[i];
    } else {
      pfxb[i+1] = pfxb[i];
    }
  }

  vector<bool> flag2(n);
  vector<ll> c(n), sfxc(n+1);
  REP(i, n) c[i] = a[i]+i*d;
  sfxc[n] = LLINF;
  for(ll i=n-1; i>=0; --i) {
    if(c[i] < sfxc[i+1]) {
      flag2[i] = 1;
      sfxc[i] = c[i];
    } else {
      sfxc[i] = sfxc[i+1];
    }
  }

  ll prev = -1, ret = 0;
  REP(i, n) {
    if(flag1[i] && flag2[i]) {
      if(prev != -1) ret += a[i] + a[prev] + d * (i-prev);
      prev = i;
    } else {
      ll t1 = pfxb[i] + a[i] + i*d;
      ll t2 = sfxc[i] + a[i] - i*d;
      ret += min(t1, t2);
    }
  }
  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
using namespace std;
template <class T> bool chmax(T &a, const T &b) {if (a<b) {a = b; return 1;} return 0;}
template <class T> bool chmin(T &a, const T &b) {if (b<a) {a = b; return 1;} return 0;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007;
const ll MAX = 510000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}
// 二項係数計算
long long COM(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;
}

int main() {
    string s;
    cin >> s;
    string year = s.substr(0,2);
    string month = s.substr(2,2);
    vector<string> Y = {"01","02","03","04","05","06","07","08","09","10","11","12"};
    bool yy = false;
    bool mm = false;
    rep(i,Y.size()) {
        if (month == Y[i]) {
            mm = true;
        }
        if (year == Y[i]) {
            yy = true;
        }
    }
    if (mm == true && yy == true) {
        cout << "AMBIGUOUS" << "\n";
    }
    if (mm == true && yy == false) {
        cout << "YYMM" << "\n";
    }
    if (mm == false && yy == true) {
        cout << "MMYY" << "\n";
    }
    if (mm == false && yy == false) {
        cout << "NA" << "\n";
    }
}


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

using namespace std;

int grid[3][3];

int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) cin>>grid[i][j];
    }

    int n,tmp;

    cin>>n;
    for(int k=0;k<n;k++){

        cin>>tmp;

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++) if(grid[i][j] == tmp) grid[i][j] = -1;
        }
    }

    int flag = 0;

    if(grid[0][0] == grid[0][1] && grid[0][0] == grid[0][2]) flag = 1;
    if(grid[0][0] == grid[1][0] && grid[0][0] == grid[2][0]) flag = 1;
    if(grid[0][0] == grid[1][1] && grid[0][0] == grid[2][2]) flag = 1;
    if(grid[0][1] == grid[1][1] && grid[0][2] == grid[2][0]) flag = 1;
    if(grid[0][2] == grid[1][2] && grid[0][2] == grid[2][2]) flag = 1;
    if(grid[0][1] == grid[1][1] && grid[0][1] == grid[2][1]) flag = 1;
    if(grid[1][0] == grid[1][1] && grid[1][0] == grid[1][2]) flag = 1;
    if(grid[2][0] == grid[2][1] && grid[2][0] == grid[2][2]) flag = 1;

    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;

long long q[maxn],top;
long long sum[maxn];
long long dp[maxn];
int findid(long long num)
{
    int l=0,r=top-1,ans=-1;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(q[mid]<=num){
            ans=mid;
            l=mid+1;
        }
        else r=mid-1;
    }
    return ans;
}
int main()
{
    int n,Q;
    scanf("%d%d",&n,&Q);
    top=0;
    q[top++]=n;
    for(int i=1;i<=Q;i++)
    {
        long long x;
        scanf("%lld",&x);
        while(top&&x<=q[top-1])
            top--;
        q[top++]=x;
    }
    int N=n;
//    for(int i=0;i<top;i++)
//        printf("%d ",q[i]);
//    printf("\n");
    n=(int)min(1LL*n,q[0]);
    memset(sum,0,sizeof(sum));
    memset(dp,0,sizeof(dp));
    dp[top-1]=1;
    for(int i=top-1;i;i--)
    {
        long long now=q[i];
        dp[i-1]+=dp[i]*(now/q[i-1]);
        now=now%q[i-1];
        while(now>n){
            int id=findid(now);
            dp[id]+=dp[i]*(now/q[id]);
            now=now%q[id];
        }
        sum[1]+=dp[i];
        sum[now+1]-=dp[i];
//        for(int j=0;j<top;j++)
//            printf("%lld ",dp[i]);
//        printf("\n");
    }
    sum[1]+=dp[0];
    sum[n+1]-=dp[0];
    for(int i=2;i<=N;i++)
        sum[i]+=sum[i-1];
    for(int i=1;i<=N;i++)
        printf("%lld\n",sum[i]);
    return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    vector<tuple<ll,ll,ll>> in(4);
    ll num[4] = { 25,50,100,200 };
    FOR(i, 0, 4) {
        cin >> get<1>(in[i]);
        get<2>(in[i]) = num[i];
        get<0>(in[i]) = 200 / get<2>(in[i]) * get<1>(in[i]);
    }
    ll n;
    cin >> n;
    n *= 100;

    SORT(in);
    ll ans = 0;
    for (auto a : in) {
        if (!n)break;
        ans += n / get<2>(a) * get<1>(a);
        n %= get<2>(a);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	vector<pair<long long,pair<long long, long long>>> vec, vec1;
	set<pair<long long, long long>> st;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long a, b;
		cin >> a >> b;
		vec.emplace_back(make_pair(a+b,make_pair(a, b)));
	}
	sort(vec.begin(), vec.end());
	long long ta = 0, ao = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			ta += vec[n - i - 1].second.first;
		}
		else {
			ao += vec[n - i - 1].second.second;
		}
	}
	cout << ta - ao << endl;
	return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    unsigned long S{0};
    vector<unsigned long> cnt(100001);
    for(unsigned long i{0}, A; i < N; ++i){
        cin >> A;
        S += A;
        ++cnt[A];
    }
    unsigned long Q;
    cin >> Q;
    for(unsigned long i{0}, B, C; i < Q; ++i){
        cin >> B >> C;
        S -= B * cnt[B];
        S += C * cnt[B];
        cnt[C] += cnt[B];
        cnt[B] = 0;
        cout << S << endl;
    }
    return 0;
}

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

int main() {
	int n, a[105], ans = 0, max = 0, maxnum;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) {
	    for (int j = 1; j <= n; j++) {
	        if (max < a[j]) {
	            max = a[j];
	            maxnum = j;
	        }
	    }
      	if (i % 2 != 0) ans += max;
	    else ans -= max;
	    a[maxnum] = 0;
        max = 0;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int linearSearch(int s[],int key,int n){
   
	int i = 0;
   s[n] = key;
	while (s[i] != key) {
		i++;
		if(i==n){// i が n に達した
			return n;
		}
	}
   return i;
}

int main(void){

	int n;
	
	scanf("%d",&n);
	
	int S[n+1];
	int i;
	
	for(i=0;i<n;i++){
	
		scanf("%d",&S[i]);
	
	}
	
	int q;
	scanf("%d",&q);
	
	int T[q];
	
	for(i=0;i<q;i++){
	
		scanf("%d",&T[i]);
	
	}
	
	int Sum=0;
	
	for(int j=0;j<q;j++){
		if(linearSearch(S,T[j],n)!=n){
			Sum++;
		}
	}
	
	printf("%d\n",Sum);
	
}



Measured memory_bytes: 2128
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<numeric>
#include<map>
#include<math.h>

using namespace::std;

int main(void)
{

  int counter = 1;
  int n;

  while(cin >> n , n != 0 )
    {
      vector< pair<double,double> > vertex(n);
      double sum = 0.0;

      for(int i = 0; i < n; i++)
        {
          cin >> vertex[i].first >> vertex[i].second;
        }

      for(int i = 0; i < vertex.size(); i++)
        {
          if( i == vertex.size() - 1 )
            {
              sum += 0.5 * ( (vertex[i].first * vertex[0].second) - (vertex[i].second * vertex[0].first) );
            }
          else
            {
              sum += 0.5 * ( (vertex[i].first * vertex[i+1].second) - (vertex[i].second * vertex[i+1].first) );
            }
        }

      printf("%d %.1f\n", counter , fabs(sum));
      counter++;

    }

  return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
	int p[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }
  int operation = 0;
  int flag = 1;
  for (int i = 0; i < n; i++) {
    if (p[i] != i+1) {
      if (operation > 0) {
        flag = 0;
        break;
      } else {
        operation++;
        p[p[i]-1] = p[i];
      }
    }
  }

  if (flag == 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

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

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

  vector<bool> dp(1 + x);
  dp[0] = true;

  Rep(i, x + 1) {
    Rep(j, 6) {
      int prev = i - (100 + j);
      if (prev < 0) break;
      dp[i] = dp[i] || dp[prev];
    }
  }
  cout << (dp[x] ? 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
 
function input($func = null) {
    if ($func === null) {
        return trim(fgets(STDIN));
    } else {
        return $func(trim(fgets(STDIN)));
    }
}
function input_array($func = null) {
    if ($func === null) {
        return explode(' ', input());
    } else {
        return array_map(function($v) use ($func) {
            return $func($v);
        }, explode(' ', input()));
    }
}

input();
$ls = input_array('intval');
sort($ls);
echo array_sum(
    array_filter(
        $ls,
        function($k) {
            return $k % 2 === 0;
        },
        ARRAY_FILTER_USE_KEY
    )
) . "\n";

Measured memory_bytes: 4604
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll ur,num=0,vis[5005],ans=0,dp[5005][5005],a[5005],cnt=0,n,tot=0,p[5005],ok=0,anm;
vector<int>s[5005];
const ll mod=1e9+7;
void dfs(int h)
{
	int v;
	vis[h]=1;
	tot++;
	if(p[h]==-1)ok=1;
	for(int i=0;i<s[h].size();i++)
	{
		v=s[h][i];
		if(vis[v])continue;
		dfs(v);
	}
}
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&p[i]);
		if(p[i]>-1)
		{
			s[p[i]].push_back(i);
			s[i].push_back(p[i]);
		}
		else num++;
	}
	ur=1;ans=n;
	for(int i=1;i<=num;i++)ur=ur*(n-1)%mod,ans=ans*(n-1)%mod;
	anm=1;
	for(int i=1;i<num;i++)anm=anm*(n-1)%mod;
	for(int i=1;i<=n;i++)
	{
		ok=0;tot=0;
		if(vis[i])continue;
		dfs(i);
		if(ok==0)ans=(ans-ur+mod)%mod;
		else a[++cnt]=tot;
	}
	dp[0][0]=1;
	for(int i=1;i<=cnt;i++)
	{
		for(int j=0;j<=cnt;j++)
		{
			if(dp[i-1][j]==0)continue;
			dp[i][j]=(dp[i][j]+dp[i-1][j]*(n-1))%mod;
			dp[i][j+1]=(dp[i][j+1]+dp[i-1][j]*a[i]%mod*max(1ll,1ll*j))%mod;
		}
	}
	if(cnt)
	{
		for(int j=2;j<=cnt;j++)ans=(ans-dp[cnt][j]+mod)%mod;
		for(int i=1;i<=cnt;i++)if(a[i]>1)ans=(ans-anm*(a[i]-1)%mod+mod)%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 120072
#include <stdio.h>
#include <stdlib.h>
#define max_size (int)(2e5 + 1)

int main(){
	int i, S = 0, ans = 0;
	char *X = (char *)malloc(sizeof(char) * max_size);
	scanf("%s", X);
	for(i = 0; X[i] != '\0'; i++){
		if(X[i] == 'S'){
			S++;
		}
		else{
			if(S > 0){
				S--;
			}
			else{
				ans++;
			}
		}
	}
	printf("%d\n", 2 * ans);
	return 0;
}

Measured memory_bytes: 384
if __name__ == '__main__':
    l_c = int(input())
    trips = []
    for i in range(l_c):
        trips.append([int(v) for v in input().split(' ')])
    pos = [0, 0, 0]
    for t in trips:
        time = t[0] - pos[0]
        n = pos[1] - t[1]
        if n < 0:
            n *= -1
        n2 = pos[2] - t[2]
        if n2 < 0:
            n2 *= -1
        dist = n + n2

        e_or_o = [time % 2, dist % 2]
        if time < dist or e_or_o[0] != e_or_o[1]:
            print('No')
            exit(0)
        pos = t
    print('Yes')

Measured memory_bytes: 21152
N = int(input())
s = []
t = []
for i in range(N):
    si, ti = input().split()
    ti = int(ti)
    s.append(si)
    t.append(ti)
X = input()
ans = 0
for i in range(s.index(X)+1):
    ans += t[i]
print(sum(t) - ans)



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define repp(i, n) rep(i, n)
#define reppp(i, n) repp(i, n)
#define rrepp(i, n) rrep(i, n)
#define repss(i, n) reps(i, n)
#define repcc(i, n) repc(i, n)
#define repii(i, a, b) repi(i, a, b)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n, k; cin >> n >> k;
  if (n > k) cout << 0 << '\n';
  else cout << 1 << '\n';
}



Measured memory_bytes: 3172
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}




//-----CODE------//
//-----CODE------//


void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  int Q;
  cin>>Q;
  for (int i = 0; i < Q; i++)
  {
    int ANS = 0;
    int A,B;
    cin>>A>>B;
    A--;
    for (int j = 0; j < N; j++)
    {
      if(j == A)
      {
        ANS += B;
      }
      else
      {
        ANS += vec[j];
      }
      
    }
    cout<<ANS<<endl;
    
  }
  
  
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

using namespace std;

void load(void);
void output(void);

int N;

int main(){
	load();
	output();
	return 0;
}

void load(void){
	cin >> N;
}

void output(void){
	int res;
	if(N % 1000 != 0){
		res = 1000 - (N % 1000);
	}else{
		res = 0;
	}
	cout << res;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T1, class T2> inline int chkmin(T1& a, const T2& val) {return val < a ? a = val, 1 : 0;}
template<class T1, class T2> inline int chkmax(T1& a, const T2& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return (int) fpow(a, p - 2, p);}

const int maxn = 1000 + 10;
int ispr[maxn];

void solve() {
    fill_n(ispr + 2, maxn - 2, 1);
    FOR(i, 2, maxn) if (ispr[i]) {
        for (long long j = (long long) i * i; j < maxn; j += i) {
            ispr[j] = 0;
        }
    }
    int n; cin >> n;
    int ans = 1;
    FOR(i, 2, maxn) if (ispr[i]) {
        int tmp = 0;
        for (int p = i; p <= n; p *= i) {
            tmp += n / p;
        }
        ans = mult(ans, tmp + 1);
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if (fopen("in.txt", "r")) {
        freopen("in.txt", "r", stdin);
    }
    solve();
    cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
    return 0;
}


Measured memory_bytes: 764
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int ans = INF;
	int L, R;
	cin >> L >> R;
	rep(i, L, min(R + 1, L + 2019))
	{
		rep(j, i + 1, min(R + 1, L + 2019))
		{
			chmin(ans, (i*j) % 2019);
		}
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n, m;
    cin >> n >> m;

    int g[10][10] = {};
    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b;
        a--; b--;

        g[a][b] = 1;
        g[b][a] = 1;
    }

    vector<int> p;
    for (int i = 1; i < n; ++i) {
        p.push_back(i);
    }

    int ans = 0;

    do {
        bool ok = true;
        if (g[0][p[0]] == 0) ok = false;

        for (int i = 1; i < n - 1; ++i) {
            if (g[p[i-1]][p[i]] == 0) {
                ok = false;
                break;
            }
        }

        if (ok) ans++;
    } while (next_permutation(p.begin(), p.end()));

    cout << ans << endl;
}

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

int main() {
	int h,w,k;
	cin>>h>>w>>k;
	for(int i=0;i<=h;i++)
	{
		for(int j=0;j<=w;j++)
		{
			int ans=i*w+j*h-2*i*j;
			if(ans==k)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String answer = "Three";
		Scanner sc = new Scanner(System.in);
		int hina = sc.nextInt();
		int p = 0;	// 桃色
		int w = 0;	// 白色
		int g = 0;	// 緑色
		int y = 0;	// 黄色

		String tmp;
		for (int i = 0; i < hina; i++) {
			tmp = sc.next();
			// ひなあられの文字列判定
			switch (tmp) {
			case "P":
				if (p > 0) break;
				p++;
				break;

			case "W":
				if (w > 0) break;
				w++;
				break;

			case "G":
				if (g > 0) break;
				g++;
				break;

			case "Y":
				if (y > 0) break;
				y++;
				break;

			}
			// 4種類だと確定した場合スキップ
			if (p + w + g + y == 4) {
				answer = "Four";
				break;
			}

		}

		System.out.println(answer);

	}

}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;

#define TT template<typename T>
#define TTF template<typename T, typename F>
#define ET(T) typename T::value_type
TT inline T sq(T x){return x*x;}
TT inline T In(){T x;cin>>x;return x;}
TT inline void Out(T&x){cout<<x;}
TT inline void sort(T&v){sort(begin(v),end(v));}
TT inline void revs(T&v){reverse(begin(v),end(v));}
TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
#undef TT
#undef TTF
#undef ET

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000;

struct Edge {
  int from, to;
  int cost;
  Edge(int from, int to, int cost) : from(from), to(to), cost(cost) {}
  bool operator<(const Edge& e){
    return cost < e.cost;
  }
};

int main()
{
  int mat[128][128];
  int n = in();
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      mat[i][j] = in();
    }
  }
  ll tot = 0;
  for (int i = 0; i < n; i++){
    for (int j = i; j < n; j++){
      tot += min(mat[i][j], mat[j][i]);
    }
  }
  printf("%lld\n", tot);
  return (0);
}

// priority_queue queue deque front stringstream max_element min_element insert count make_tuple

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,-1,sizeof(i));
#define pb push_back
int main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int cont[n+5] = {};
	f(n){
		cin>>cont[i];
	}
	int now=0;
	int pre[n+5] = {};
	int suf[n+5] = {};
	f(n){
		now = __gcd(now,cont[i]);
		pre[i]=now;
	}
	now =0;
	for(int i=n-1;i>=0;i--){
		now = __gcd(now,cont[i]);
		suf[i]= now;
	}
	int ans=suf[1];
	for(int i=0;i<n;i++){
		ans = max(ans,__gcd(pre[i],suf[i+2]));
	}
	cout << ans << endl;

}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ?????????????????°?????????
		int cnt1;
		int cnt2;

		// ??°?????????????????????
		while (true) {

			// ??\???????????°????????\???????????°H???W
			int H = sc.nextInt();
			int W = sc.nextInt();

			// ??\???????????????
			if (H == 0 && W == 0)
				break;

			// ???????????°???????????????
			for (cnt1 = 1; cnt1 <= H; cnt1++) {

				for (cnt2 = 1; cnt2 <= W; cnt2++) {

					if (cnt1 % 2 == 1 && cnt2 % 2 == 1) {

						System.out.print("#");

					} else if (cnt1 % 2 == 1 && cnt2 % 2 == 0) {

						System.out.print(".");

					} else if (cnt1 % 2 == 0 && cnt2 % 2 == 1) {

						System.out.print(".");

					} else if (cnt1 % 2 == 0 && cnt2 % 2 == 0) {

						System.out.print("#");

					}

				}
				// ??????
				System.out.println();
			}

			// ?????????
			System.out.println();
		}
		// ?????????????????\?????????
		sc.close();
	}

}

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

typedef long long int lli;

int main() {
  lli n, akar, a;
  scanf("%lld", &n);
  akar = sqrt(n);
  for (lli i = akar; i > 0; i--)
    if (n % i == 0) {
      a = n / i;
      printf("%lld\n", i + a - 2);
      return 0;
    }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		System.out.print(a*b+" "); 
		System.out.println(a+b+a+b); 
	}

}

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

using namespace std;


int main()
{
   int a,b,c;
   cin >>a>>b>>c;
   if ((a == 5 && b == 5 && c == 7) ||(a == 5&&b==7&&c==5)|| (a==7&&b==5&&c==5))
    printf("YES\n");
   else
    printf("NO\n");


    return 0;
}


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

int main() 
{
  int n;
  ll k;
  cin >> n >> k;
  int a[n];
  rep(i, n) cin >> a[i];
  
  ll cnt_first[n] = {};
  ll cnt_all[n] = {};
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (a[i] > a[j]) ++cnt_all[i];
    }
    for (int j = i+1; j < n; ++j) {
      if (a[i] > a[j]) {
        ++cnt_all[i];
        ++cnt_first[i];
      }
    }
  }
  
  ll ans = 0;
  rep(i, n) {
    ans += cnt_first[i] * k;
    ans %= mod;
    ll tmp;
    tmp = k * (k-1) / 2;
    tmp %= mod;
    ans += cnt_all[i] * tmp;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        Scanner scan = new Scanner(System.in);
        double sum = 100000.0;
        int a = scan.nextInt();
        for(int i =1 ;i<=a ;i++){
            sum = sum *0.05+sum;
            sum = (Math.ceil(sum /1000)) *1000;
        }
        System.out.printf("%.0f\n",sum);
    }
}

Measured memory_bytes: 26336
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#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 << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	ll a, b, c;
	cin >> a >> b >> c;
  ll p1 = a + b;
  ll p2 = c - p1;
  if (p2 >= 0 && p2*p2 > 4 *a*b) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

Measured memory_bytes: 256
def dfs(v,n,visited):
    all_visted=1#全ての点を探索したか判別する
    for i in range(n):
        if visited[i]==0:#まだi番目の点を訪問していない時
            all_visted=0
    if all_visted==1:#全ての辺を訪問した場合
        return 1
    count=0#全ての辺を訪問する回数を格納する変数
    for i in range(n):
        if path[v][i]==0:#辺がないとき、つまり隣接していない時
            continue
        if visited[i]==1:#既に訪問している
            continue
        visited[i]=1#訪問する
        count+=dfs(i,n,visited)#countに+1をする
        visited[i]=0#まだ探索していないノードまで戻る
    return count
#グラフの位置情報を読み取る
n,m=map(int,input().split())
path=[[0]*n for i in range(n)]#0は未訪問,1は訪問済み
for i in range(m):
    a,b=map(int,input().split())
    path[a-1][b-1]=1#隣接しているところは1になる
    path[b-1][a-1]=1
visited=[0]*n
visited[0]=1#点1は既に訪問済みなので記録
print(dfs(0,n,visited))


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

#define MAX(a,b) (((a)>(b))?(a):(b))

using namespace std;

int main()
{
    int N;
    int cnt, temp;

    cin >> N;
    vector<int> H(N);
    for(int i=0; i<N; ++i) cin >> H[i];

    cnt = 0;
    temp = 0;
    for(int i=0; i<N-1; ++i){
        if(H[i] >= H[i+1]) ++cnt;
        else{
            temp = MAX(cnt,temp);
            cnt = 0;
        }
    }
    cnt = MAX(cnt, temp);

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 640
from collections import deque

H,W = map(int, input().split())
que = deque()
A = [input() for i in range(H)]

dy = [0,1,0,-1]
dx = [1,0,-1,0]
Field = [[-1]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            Field[i][j] = 0
            que.append((i, j))

d = 0
while que:
    y,x = que.popleft()
    d = Field[y][x]
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if not 0 <= nx < W or not 0 <= ny < H or Field[ny][nx] != -1:
            continue
        Field[ny][nx] = d+1
        que.append((ny, nx))
print(d)


Measured memory_bytes: 88412
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

unsigned long long mod = 1000000007;
int main()
{
    int H, W, K;
    std::cin >> H >> W >> K;
    std::vector<unsigned long long> layers(W, 0);

    layers.at(0) = 1;
    // あみだくじ全通り
    std::vector<std::vector<bool>> amida(1, std::vector<bool>(W, false));
    for (int j = 1; j < W; j++) {
        std::vector<std::vector<bool>> last = amida;
        for (const auto& a : last) {
            if (not a.at(j - 1)) {
                std::vector<bool> to_add = a;
                to_add.at(j) = true;
                amida.emplace_back(to_add);
            }
        }
    }
    for (int i = 1; i <= H; i++) {
        std::vector<unsigned long long> layers_copy(W, 0);
        // i - 1からiへ
        for (const auto& a : amida) {
            for (int j = 0; j < W; j++) {
                if (j == 0) {
                    if (a.size() == 1 or not a.at(1)) {
                        layers_copy.at(j) += layers.at(j);
                    } else {
                        layers_copy.at(j) += layers.at(j + 1);
                    }
                } else if (j == W - 1) {  // 0だったら前のifに入る
                    if (a.at(j)) {
                        layers_copy.at(j) += layers.at(j - 1);
                    } else {
                        layers_copy.at(j) += layers.at(j);
                    }
                } else {
                    if (a.at(j)) {
                        layers_copy.at(j) += layers.at(j - 1);
                    } else if (a.at(j + 1)) {
                        layers_copy.at(j) += layers.at(j + 1);
                    } else {
                        layers_copy.at(j) += layers.at(j);
                    }
                }
                layers_copy.at(j) %= mod;
            }
        }
        layers = layers_copy;
    }
    std::cout << layers.at(K - 1) << std::endl;

    return 0;
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

class UnionFind {
public:
    vector<int> par;
    vector<int> rnk;
    vector<long long> siz;
    UnionFind(int N): par(N), rnk(N), siz(N){
        for(int i = 0; i < N; i++){
            par[i] = i, rnk[i] = 0, siz[i] = 1;
        }
    }
    //根
    int find(int x){
        if(par[x] == x )return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        int rx = find(x);
        int ry = find(y);
        if (rx == ry) return;
        if(rnk[rx] < rnk[ry]){
            par[rx] = ry;
            siz[ry] += siz[rx];
            siz[rx] = 0;
        }
        else{
            par[ry] = rx;
            siz[rx] += siz[ry];
            siz[ry] = 0;
            if(rnk[rx] == rnk[ry]){
                rnk[rx]++;
            }
        }
    }
    //集合が同じか
    bool same(int x, int y){
        return find(x) == find(y);
    }
    //集合の大きさ
    int size(int x){
        return siz[find(x)];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    ll res=1;
    UnionFind uf(N);
    rep(i,M){
        int u,v;
        cin>> u >> v;
        u--;v--;
        if(!uf.same(u,v)){
            res++;
            uf.unite(u,v);
        }
    }
    cout << N-res << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 4784
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

S = S()
if S == 'RRR':
    print(3)
elif S == 'RRS' or S == 'SRR':
    print(2)
elif S == 'SSS':
    print(0)
else:
    print(1)



Measured memory_bytes: 61804
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const double EPS = 1e-7;
const double INF = 1e12;
struct Vec {
    double x,y;
    Vec(){}
    Vec(double x,double y){ this->x=x,this->y=y; }
    void read(){ scanf("%lf%lf",&x,&y); }
    void prt() {printf("%.9f %.9f\n",x,y); }
    double len(){ return sqrt(x*x+y*y); }
    double len2(){ return x*x+y*y; }
    
    Vec operator+(const Vec&o)const{ return Vec(x+o.x,y+o.y); }
    Vec operator-(const Vec&o)const{ return Vec(x-o.x,y-o.y); }
    Vec operator*(const double&k)const{ return Vec(k*x,k*y); }
    double operator*(const Vec&o)const {return x*o.x+y*o.y; }
    double operator^(const Vec&o)const {return x*o.y-y*o.x; }
    Vec rotate(double ang){ return Vec(x*cos(ang)-y*sin(ang), x*sin(ang)+y*cos(ang)); }
    Vec change(double l){ if(len()<EPS) return *this; return (*this)*(l/len()); }
    double disToLine(Vec A, Vec B) {
        return abs((A-*this)^(B-*this))/(B-A).len();
    }
};

Vec Lineintersect(Vec A1,Vec A2,Vec B1,Vec B2) {
    if (abs((A2-A1)^(B2-B1)) < EPS) return Vec(INF,INF);
    return A1 + (A2 - A1) * ((abs((A2-A1)^(B2-B1)) - abs((A2-B1)^(B2-B1)) ) / abs((A2-A1)^(B2-B1)));
}

Vec Segintersect(Vec A1,Vec A2,Vec B1,Vec B2) {
    Vec P = Lineintersect(A1,A2,B1,B2);
    if ((P-A1)*(P-A2)<=0 && (P-B1)*(P-B2)<=0) return P; 
    return Vec(INF,INF);
}

Vec p1,p2;
int main(){
    p1.read(); p2.read();
    int q; scanf("%d",&q);
    while(q--){
        Vec p; p.read();
        if(((p2-p1)^(p-p1))>0)
            printf("COUNTER_CLOCKWISE\n");
        else if(((p2-p1)^(p-p1))<0)
            printf("CLOCKWISE\n");
        else {
            if((p-p1)*(p-p2)<=0)
                printf("ON_SEGMENT\n");
            else if((p-p1).len() < (p-p2).len())
                printf("ONLINE_BACK\n");
            else 
                printf("ONLINE_FRONT\n");
        }
    }
}


Measured memory_bytes: 3236
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll n,c;cin>>n>>c;
    vvl d(c,vl(c));
    rep(i,c)rep(j,c)cin>>d[i][j];
    vvl a(n,vl(n));
    rep(i,n)rep(j,n)cin>>a[i][j],--a[i][j];

    vvl cand(3);
    rep(i,3){
        vp t;
        rep(j,c){
            ll tmp=0;
            rep(s,n)rep(t,n){
                if((s+t)%3!=i)continue;
                tmp+=d[a[s][t]][j];
            }
            t.emplace_back(tmp,j);
        }
        sort(all(t));
        rep(j,3)cand[i].push_back(t[j].second);
    }

    ll ans=LINF;
    for(ll i:cand[0])for(ll j:cand[1])for(ll k:cand[2]){
        if(i==j||j==k||k==i)continue;
        vl b={i,j,k};
        ll tmp=0;
        rep(s,n)rep(t,n){
            tmp+=d[a[s][t]][b[(s+t)%3]];
        }
        chmin(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>

int main(){
	//入力機構
	int A,B,C;
	std::cin>>A>>B>>C;
	//解答
	//2桁+1桁にしかならないので、(A,B,Cのどれか)*10+(残った２つの和)が計算結果になる。10倍するのを最大整数にすれば結果も最大になる
	const int maximum=std::max<int>({A,B,C});
	const int ans=A+B+C+maximum*9;

	//結果出力
	std::cout<<ans<<std::endl;

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    string ans = "";

    int n = N % 10;
    if (n == 3) {
        ans = "bon";
    }
    else if(n == 0 || n == 1 || n == 6 || n == 8) {
        ans = "pon";
    }
    else {
        ans = "hon";
    }

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

Measured memory_bytes: 3600
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i,e;
    static int n[26];
    char st,al[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    
    do{
        e = scanf("%c", &st);
        
        for(i=0;i<52;i++)
            if(al[i] == st){
                n[ i%26 ]++;
            }
        
    }while(e != EOF);
    
    for(i=0;i<26;i++)
        printf("%c : %d\n", al[i] , n[i]);
    
    return 0;
}


Measured memory_bytes: 2036
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; 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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int a, b, c;

int main() {
  cin >> a >> b >> c;
  if (a == b) {
    cout << c;
  } else if (b == c) {
    cout << a;
  } else {
    cout << b;
  }
}


Measured memory_bytes: 3616
n, a, b = map(int, input().split(' '))

if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
    blue = (n // (a + b)) * a
    amari = n % (a+b)
    if amari > a:
        blue += a
    else:
        blue += amari

    print(blue)


Measured memory_bytes: 3060
/***
coded by adarsh
***/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef vector<ll> vec; 
typedef vector<vector<ll>> vec2;
typedef pair<ll,ll> pair1;
typedef pair<string,ll> pair2;
typedef pair<ll,string> pair3;
typedef pair<string,string> pair4;
#define fl(i,a,b) for(i=a;i<b;i++)
#define rfl(i,a,b) for(i=b-1;i>=a;i--)
#define f first
#define s second

int main() 
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n,m,i;cin>>n>>m;
    map<ll,ll> b;
    set<ll> a;ll c=0;
    fl(i,0,m)
    {
        ll p;string s;
        cin>>p>>s;
        if(a.count(p)==0&&s=="WA")
        {
            b[p]++;
        }
        else if(a.count(p)==0&&s=="AC")
        {
            c+=b[p];
            a.insert(p);
        }
    }
    cout<<a.size()<<" "<<c;
    return 0;
}


Measured memory_bytes: 14544
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            int wa = a + b;
            int sa = a - b;
            int seki = a * b;

            int[] ans = { wa, sa, seki };
            int max = -100;

            for (int i =0; i < ans.Length; i++)
            {
                if (ans[i] > max)
                {
                    max = ans[i];
                    
                }

               
            }
            Console.WriteLine(max);
        }
        
    }
}


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

int main()
{
	int stu[30];

	int i, n;

	for (i = 0; i < 30; i++){
		stu[i] = 0;
	}

	for (i = 0; i < 28; i++){
		cin >> n;
		stu[n-1] = 1;
	}

	for (i = 0; i < 30; i++){
		if (stu[i] == 0){
			cout << i+1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160