akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this;}
  mint& operator++() { x += 1; return *this;}
  mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
  mint& operator--() { x -= 1; return *this;}
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res+=a; }
  mint operator-(const mint a) const { mint res(*this); return res-=a; }
  mint operator*(const mint a) const { mint res(*this); return res*=a; }
  bool operator==(const int n) const { mint a(n); return this->x == a.x; }
  bool operator==(const ll n) const { mint a(n); return this->x == a.x; }
  bool operator!=(const int n) const { mint a(n); return this->x != a.x; }
  bool operator!=(const ll n) const { mint a(n); return this->x != a.x; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { mint res(*this); return res/=a; }
};
istream& operator>>(istream& is,const mint& m) { return is >> m.x; }
ostream& operator<<(ostream& os,const mint& m) { return os << m.x; }

mint dp[2010][2010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vi s(n),t(m);
    cin >> s >> t;
    rep(i,2010) {
        dp[0][i] = 1;
        dp[i][0] = 1;
    }
    rep(i,n) rep(j,m) {
        dp[i+1][j+1] += dp[i][j];
        dp[i+1][j+1] += dp[i+1][j]-dp[i][j];
        dp[i+1][j+1] += dp[i][j+1]-dp[i][j];
        if(s[i] == t[j]) dp[i+1][j+1] += dp[i][j];
    }
    cout << dp[n][m] << endl;
}


Measured memory_bytes: 31872
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int K, X;
    cin >> K >> X;
    
    int left_limit= -1000000, right_limit = 1000000;
    
    int minimum = X-K+1;
    if (minimum < left_limit) {
        minimum = left_limit;
    }
    
    int maximum = X+K-1;
    if (right_limit < maximum) {
        maximum = right_limit;
    }
    
    for (int i = minimum; i <= maximum; i++) {
        cout << i << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include<map>
#include<set>


using namespace std;
const long long INF = (long long) (1e18)+1;


int main() {
  int k;
  cin >> k;
  vector<long long> nums;
  if (k<=12) {
    cout << k << endl;
    return 0;
  }
  for (int i=1; i<=9; ++i) {
    nums.push_back(i);
  }

  int i = 0;
  while (1) {
    // cout << "i: " << i << endl;
    // for (auto& n : nums) {
    //   cout << n << " ";
    // }
    // cout << endl;
    if (k <= nums.size()) {
      cout << nums[k-1] << endl;
      return 0;
    }
    if (nums[i] % 10 != 0) nums.push_back(10*nums[i] + (nums[i]%10) - 1);
    nums.push_back(10*nums[i] + (nums[i]%10));
    if (nums[i] % 10 != 9) nums.push_back(10*nums[i] + (nums[i]%10) + 1);
    ++i;
  }
  return 0;
}

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

int main(){
  int K,S;
  cin >> K >> S;
  
  int cnt =0,s=S;
  for(int i=0;i<=K;i++){
    S=s;
    if(S>3*K){
      break;
    }
    S -=i;
    if(S>2*K){
      continue;
    }
    if(S>K){
      cnt +=2*K-S+1;
    }
    if(S<=K && S>=0){
      cnt +=S+1;
    }
  }
  cout << cnt <<endl;
}


Measured memory_bytes: 3572
#include<iostream>
#include<fstream>

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1154&lang=jp


using namespace std;


ifstream fin;
ofstream fout;

int main(){

	fin.open("input.txt");
	fout.open("output.txt");

	int n;			//input
	int a[2];		//?????????????´??????°
	int b[30] = {};		//?????°?¨???¶
	int j = 0;
	bool isPrime = true;


	while (true){
		cin >> n;

		//?????????
		a[0] = 6;
		a[1] = 8;
		b[0] = 7;
		j = 0;

		if (n == 1)break;
		
		cout << n << ':';
		fout << n << ':';

		while (a[0] <= n / 6){
			for (int k = 0; k < 2; k++){

				isPrime = true;

				if (n%a[k] == 0){
					for (int m = 0; m < j; m++)
						if (a[k] % b[m] == 0)isPrime = false;
					if (isPrime == true){
						cout << ' ' << a[k];
						fout << ' ' << a[k];
						b[j] = a[k];
//						cout << " b[" << j << "]= " << b[j] << endl;
						j++;
					}
				}
				a[k] += 7;
			}
		}

		if (b[0] == 7){
			cout << ' ' << n;
			fout << ' ' << n;
		}
		cout << endl;
		fout << endl;
	}

	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define sez(a) a.size()
const int maxn=2e5+100;
const int MOD=1e9+7;
const ll INF=1e18;
const ld PI=3.141592653589793;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    cout<<((s.substr(0,4)=="YAKI")?"Yes":"No");
}


Measured memory_bytes: 256
a = list(map(int, input().split()))
k = int(input())

cnt=0

for i in range(7):
    if a[0] >= a[1]:
        a[1] *= 2
        cnt += 1
    else:
        break

for j in range(7):
    if a[1] >= a[2]:
        a[2] *= 2
        cnt += 1
    else:
        break

if cnt <= k:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61876
N, K = map(int, input().split())
A = list(map(lambda a: int(a) - 1, input().split()))
 
T = [A]
for _ in range(59):
    prev = T[-1]
    T.append([prev[a] for a in prev])
 
now = 0
for d, P in enumerate(T):
    if ((1 << d) & K) > 0:
        now = P[now]
print(now + 1)

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N + 1);
  int tmp;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    A.at(tmp)++;
  }
  
  sort(A.begin(), A.end());
  int ans = 0;
  for (int i = 0; i < N + 1; i++) {
    if (A.at(i) == 0) {
      continue;
    }
    if (N + 1 - i <= K) {
      cout << ans << endl;
      break;
    } else {
      ans += A.at(i);
    }
  }
}


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

int main() {
  string N;
  cin >> N;
  if ( N.at(1) == '9' || N.at(0) == '9' ){
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" << endl;
  }
}
 


Measured memory_bytes: 256
h,w = map(int,input().split())
s = [input() for _ in range(h)]
f = True
for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      l = [(i+1,j),(i-1,j),(i,j+1),(i,j-1)]
      t = []
      g = False
      for p,q in l:
        if p >= 0 and p < h and q >= 0 and q < w:
          if s[p][q] == "#":
            g = True
      if g is False:
        f = False
        break
  if f is False:
    break
if f:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 39792
N = int(input())
A = list(map(int,input().split()))
 
def gcd(a, b):
  if b > a:
    a, b = b, a
  r = a % b
  if r == 0:
    return b
  return gcd(b, r)

from_left = [1] * N
from_left[0] = A[0]
from_right = [1] * N
from_right[N-1] = A[N-1]

for i in range(1, N):
  from_left[i] = gcd(from_left[i-1], A[i])
  from_right[N-i-1] = gcd(from_right[N-i], A[N-i-1])

#print(from_left)
#print(from_right)
res = 0
for i in range(N):
  if i == 0:
    res = max(res, from_right[1])
  elif i == N-1:
    res = max(res, from_left[N-2])
  else:
	  res = max(res, gcd(from_left[i-1], from_right[i+1]))

print(res)

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

int main() {
    int n;
    ll s;
    cin >> n >> s;

    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];


    int r = 0;
    ll sum = 0;
    int shortness = INT_MAX;
    for (int l = 0; l < n; l++) {
        while (sum < s && r < n) {
            sum += numbers[r];
            r++;
        }
        if (sum < s) continue;
        cmin(shortness, r - l);
        sum -= numbers[l];
    }

    if (shortness == INT_MAX) shortness = 0;
    cout << shortness << endl;

}



Measured memory_bytes: 3624
import math
A, B = map(int,input().split())

A1 = math.ceil((A*100)/8)
A2 = 0
if ((A+1)*100)%8 == 0:
  A2 = (((A+1)*100)//8)-1
else:
  A2 = ((A+1)*100)//8

B1 = B*10
B2 = ((B+1)*10)-1

if A1 <= B1:
    if B1 > A2:
      print(-1)
      exit()
    else:
      print(B1)

else:
    if A1 > B2:
      print(-1)
      exit()
    else:
      print(A1)
      exit()
    

Measured memory_bytes: 38484
n = int(input())
s = input()

# s[i]地点までで東と西を向いている数の累積和
w = [0] * (n + 1)
e = [0] * (n + 1)
for i in range(n):
    w[i + 1] += w[i]
    if s[i] == 'W':
        w[i + 1] += 1
    e[i + 1] += e[i]
    if s[i] == 'E':
        e[i + 1] += 1

ans = 10**9
for i in range(n):
    temp = (w[i] - w[0]) + (e[n] - e[i+1])
    ans = min(ans, temp)

print(ans)


Measured memory_bytes: 29004
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  char s[5];
  cin>>s;
  int cnt=0;
  for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
      if(s[i]==s[j])cnt++;
    }
  }
  if(cnt==8)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for(int i=L;i<R;++i)
#define FE(i,L,R) for(int i=L;i<=R;++i)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define qq cout<<"QQ\n";
#define pb emplace_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define ll long long
#define INF 2000000000
vector<pii> adj[100005];
map<pii,int> ans;
map<int,pii> id;
int n;
void dfs(int now,int fa,int faColor){
        int color=0;
        F(i,0,adj[now].size()) if(adj[now][i].f!=fa){
                color++;
                if(color==faColor) color++;
                adj[now][i].s=color;
                //debug(now);
                //debug(i.f);
                //debug(adj[now][i.f].s);
                dfs(adj[now][i].f,now,color);
        }
}
void buildAns(){
        FE(i,1,n)
                F(j,0,adj[i].size()) ans[mp(i,adj[i][j].f)]=adj[i][j].s;
}
int main(){
        while(~getI(n)){
                FE(i,1,n) adj[i].clear();
                ans.clear();
                F(i,0,n-1){
                        VgetII(u,v);
                        id[i]=mp(u,v);
                        adj[u].pb(mp(v,0));
                        adj[v].pb(mp(u,0));
                }
                int maxSz=0;
                FE(i,1,n) if(adj[i].size()>maxSz) maxSz=adj[i].size();
                printf("%d\n",maxSz);
                dfs(1,0,0);
                buildAns();
                /*FE(i,1,n){
                        printf("%d: ",i);
                        F(j,0,adj[i].size()) printf("%d=%d ",adj[i][j].f,adj[i][j].s);
                        puts("");
                }*/
                F(i,0,n-1) printf("%d\n",ans[id[i]]);
        }
}


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


int main() {
  string s; cin >> s;
  int l; l = s.size();
  int count; count = 0;
  
  if(l%2 == 0){
    for(int i=0; i < l/2; i++){
      if(s.at(i) != s.at(l-i-1)){
        count++;
      }
    }
  }
  else{
    for(int i=0; i < l/2; i++){
      if(s.at(i) != s.at(l-i-1)){
        count++;
      }
    }
  }  
    cout << count << endl;
  
}
        
    

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

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

#define fr first
#define sc second

int main(){
	static int n;
	static int a[100010];
	scanf("%d",&n);
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&a[i]);
	}
	
	int x = 0;
	for(int i = 0 ; i < n ; i ++){
		x = max( x , a[i] );
	}
	int y = 0;
	for(int i = 0 ; i < n ; i ++){
		if(min(y,x-y) < min(a[i],x-a[i])){
			y = a[i];
		}
	}
	cout << x << " " << y << endl;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=1e5+100;
const LL inf=99999999999999;
int a[maxn];
int n,k;

int main()
{
    //freopen("1.txt","r",stdin);
    while (scanf("%d%d",&n,&k)!=EOF)
    {
        for (int i=0;i<n;i++) scanf("%d",&a[i]);
        LL ans=inf;
        for (int i=0;i<n-k+1;i++)
        {
            if (a[i]<0 && a[i+k-1]>0) ans=min(ans,min(-a[i]*2LL+a[i+k-1],-a[i]+a[i+k-1]*2LL));
            else if (a[i]>=0) ans=min(ans,1LL*a[i+k-1]);
            else if (a[i+k-1]<=0) ans=min(ans,abs(a[i])*1LL);
        }
        printf("%lld",ans);
    }
    return 0;
}




Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int test[200001];
int main() {
	long long n; string s; cin >> s;
	if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
		cout << "Yes" << endl;
	}
	else if (s[0] == s[2] && s[1] == s[3] && s[1] != s[2]) {
		cout << "Yes" << endl;
	}
	else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t L = 2;
  int64_t LL = 1;
  int64_t xL = 1;
  for(int i = 0; i < N - 1; i++){
    xL = LL;
    LL = L + LL;
    L = xL;
  }
  cout << LL << endl;
}
  
 

Measured memory_bytes: 256
#include <iostream>
#include <string>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    std::string S;
    std::cin >> S;
    if (S <= "2019/04/30") std::cout << "Heisei" << std::endl;
    else std::cout << "TBD" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define INF 1e9
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
using namespace std;


int main(){
    int h,w;  
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans = 0;
    rep(si,h)rep(sj,w){  //start i, start j
        if(s[si][sj] == '#') continue;
        vector<vector<int>> dist(h,vector<int>(w,INF)); //startからの距離
        queue<P> q;
        auto update = [&](int i,int j,int l){
            if(dist[i][j] != INF) return; //既到達ならなにもしない
            dist[i][j] = l;  
            q.push(P(i,j));  //.emplace(i,j)
        };
        update(si,sj,0); //初期値入力
        while(!q.empty()){  //qが空になるまで
            //qから新しい場所を更新
            int i = q.front().first;
            int j = q.front().second; 
            q.pop();
            //4方向試す
            rep(dir,4){
                int ni = i+di[dir], nj = j+dj[dir];
                if(ni<0||ni>=h||nj<0||nj>=w) continue;
                if(s[ni][nj]=='#') continue;
                update(ni,nj,dist[i][j]+1);                       
            }
        }
        rep(i,h)rep(j,w){
            if(dist[i][j] == INF) continue;
            ans = max(ans, dist[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* In the name of Allah */

#include<bits/stdc++.h>

using namespace std;
const int MAXN = 1e5 +10;
int arr[MAXN];
int main(){
 
 	int n;
 	cin >> n;
 	long long sum = 0;
 	for(int i = 0; i < n; i++){
 		int a;
 		cin >> a;
 		sum += a;
 		arr[a]++;
	 }
	 int q;
	 cin >> q;
	 while(q--){
	 	int a, b;
	 	cin >> a >> b;
	 	arr[b] += arr[a];
	 	sum += (arr[a] * (b - a));
	 	cout << sum << endl;
	 	arr[a] = 0;
	 }
	return 0;
}

Measured memory_bytes: 3976
#include<bits/stdc++.h>
using namespace std;
string a,b,c;
int ai,bi;
int main(){
	cin>>a>>b>>ai>>bi>>c;
	if(a==c){
		cout<<ai-1<<' '<<bi<<endl;
	}
	else {
		cout<<ai<<' '<<bi-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
sx, sy, tx, ty = list(map(int,input().split()))

ans=[]
#1
ans+='R'*(tx-sx)
ans+='U'*(ty-sy)

#2
ans+='L'*(tx-sx)
ans+='D'*(ty-sy)

#3
ans+='D'
ans+='R'*(tx-sx+1)
ans+='U'*(ty-sy+1)
ans+='L'

#4
ans+='U'
ans+='L'*(tx-sx+1)
ans+='D'*(ty-sy+1)
ans+='R'


print(''.join(ans))

Measured memory_bytes: 3188
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        b: chars
    }
    let ans = match b[0] {
        'A' => 'T',
        'T' => 'A',
        'C' => 'G',
        'G' => 'C',
        _ => ' '
    };
    println!("{}", ans);
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

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

template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}

template <typename T> void print(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void print(const T &value, const Args&... args){std::cout << value << " ";print(args...);}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int X , Y;

  while(cin >> X >> Y){
    bool ok = false;

    FORE(i,0,1000){
      FORE(j,0,1000){
        if(i + j == X and 2 * i + 4 * j == Y) ok = true;
      }
    }


    print(ok ? "Yes" : "No");

    
  }
  

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const int maxn = 567890, maxm = 1<<20, mod = 1000000007;
int mul(long long a, long long b){
	return a * b % mod;
}
int q0[maxn];
int a[maxn];
vector<int> where[maxm];
int main(){
	int n; scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", a + i);
	for(int i = 1; i <= n; i++) a[i] ^= a[i - 1];
	int cnt0 = 0;
	vector<int> could;
	for(int i = 1; i <= n; i++){
		if(a[i] == 0) cnt0++;
		q0[i] = cnt0;
		could.push_back(a[i]);
	}
	sort(could.begin(), could.end());
	could.erase(unique(could.begin(), could.end()), could.end());
	for(int i = n; i >= 1; i--) where[a[i]].push_back(i);
	int ans = 0;
	for(int i: could){
		if(i == 0){
			int now = a[n] == 0;
			for(int j = where[i].size(); j > 1; j--){
				ans += now;
				if(ans >= mod) ans -= mod;
				now = now + now;
				if(now >= mod) now -= mod;
			}
			ans += a[n] == 0;
			if(ans >= mod) ans -= mod;
			continue;
		}
		int normal = a[n] == i, adapt = mul(normal, q0[n]);
		if(a[n] == i){
			ans += 1;
			if(ans >= mod) ans -= mod;
		} 
		for(int j : where[i]){
			if(j == n) continue;
			int gap = adapt + mod - mul(normal, q0[j]);
			if(gap >= mod) gap -= mod;
			gap += (a[n] == 0);
			if(gap >= mod) gap -= mod;
			ans += gap;
			if(ans >= mod) ans -= mod;
			normal += gap;
			if(normal >= mod) normal -= mod;
			adapt += mul(gap, q0[j]);
			if(adapt >= mod) adapt -= mod;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 40560
#include<bits/stdc++.h>
using namespace std;
const int maxn=200100;
int a[maxn],b[maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	long long sum1=0,sum2=0;
	for(int i=1;i<=n;i++){
		if(a[i]>b[i]) sum2+=a[i]-b[i];
		else sum1+=(b[i]-a[i])/2;
	}
	if(sum2<=sum1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    if(n%2==0)cout<<n<<"\n";
    else
        cout<<2*n<<"\n";
    return 0;
}
/**

**/


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

int main() {
    int n, m, ans = 0;
    cin >> n >> m;
    vector<pair<int, bool>> box(n, make_pair(1, false));
    box[0] = make_pair(1, true);
    for (auto i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        box[y].first += 1;
        box[x].first -= 1;
        box[y].second |= box[x].second;
        if (box[x].first == 0) box[x].second = false;
        // for (auto j = 0; j < n; j++) {
        //     cout << box[j].first << " " << box[j].second
        //          << endl;
        // }
    }
    for (auto i = 0; i < n; i++)
        ans += (box[i].second ? 1 : 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4060
N = int(input())
A = sorted([int(i) for i in input().split()])
B = [int(i) for i in input().split()]
C = sorted([int(i)-1 for i in input().split()])

def bis(x,y):
    low = 0
    high = N
    while low < high:
        mid = (low + high) // 2
        if x[mid] < y:
            low = mid + 1
        else:
            high = mid
    return low

total = 0
for b in B:
    total += bis(A,b) * (N - bis(C,b))

print(total)


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

int a[5]={0};
int b[4]={0};
int hit=0,blow=0;

int main()
{
    for(int i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
    }

    sort(a,a+5);
    for(int i=4;i>=0;i--)
    {
        printf("%d",a[i]);
        if(i!=0)
        {
            printf(" ");
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
 string s; cin >> s;
  if (s.length() == 2) cout << s << endl;
  else {
    cout << s[2] << s[1] << s[0] << endl;
  }
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
r = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500 + b*100 + c*50 == X:
                r += 1
print(r)


Measured memory_bytes: 9188
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(int[][] g) {

    for (int i = 0; i <= 100; i++) {
        int a1 = i;

        int b1 = g[0][0] - a1;
        int b2 = g[0][1] - a1;
        int b3 = g[0][2] - a1;
        int a2 = g[1][0] - b1;
        int a3 = g[2][0] - b1;

        auto as = [a1, a2, a3];
        auto bs = [b1, b2, b3];
        bool ok = true;
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                int x = as[j] + bs[k];
                if (x < 0 || x > 100 || x != g[j][k]) {
                    ok = false;
                }
            }
        }
        if (ok) return true;
    }

    return false;
}

void main() {
    auto g = new int[][](3, 3);

    for (int i = 0; i < 3; i++) {
        auto xs = readints;
        for (int j = 0; j < 3; j++) {
            g[i][j] = xs[j];
        }
    }
    writeln(calc(g) ? "Yes" : "No");
}

Measured memory_bytes: 256
def is_good_obs(num,obs_height,linked_num):
  for e in linked_num[num-1]: 
    if(obs_height[i-1] <= obs_height[e]):
      return False
  return True
      

N,M = (int(x) for x in input().split())
obs_height = [int(x) for x in input().split()]
linked_num = [[] for i in range(N)]
good_obs_num = 0

for i in range(M):
  a,b = (int(x) for x in input().split())
  linked_num[a-1].append(b-1)
  linked_num[b-1].append(a-1)
  
for i in range(N):
    if(is_good_obs(i,obs_height,linked_num)):
      good_obs_num += 1
  
print(good_obs_num)

Measured memory_bytes: 29416
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define lowbit(x) ((x)&-(x))
using namespace std;

const int maxn = 300010, maxe = 1000010;
const int C = ~(1 << 31), M = (1 << 16) - 1;
struct node {int x, y, z;};
struct qry {int id, t, x, y, val;} q[maxe];
int f[maxe], g[maxn], ct[maxe];
node d[maxn];
int n, m, A, B, clk;

bool cmp(const node &a, const node &b)
{
    if (a.x != b.x) return a.x < b.x;
    if (a.y != b.y) return a.y > b.y;
    return a.z > b.z;
}

bool cmp1(const qry &a, const qry &b)
{
    if (a.x == b.x) return a.t > b.t;
    else return a.x < b.x;
}

void update(int u, int x)
{
    for (int i = u; i < maxe; i += lowbit(i))
        if (ct[i] != clk)
        {
            ct[i] = clk;
            f[i] = x;
        }
        else
            f[i] = max(x, f[i]);
}

int query(int u)
{
    int ans = 0;
    for (int i = u; i; i -= lowbit(i))
        if (ct[i] == clk)
            ans = max(ans, f[i]);
    return ans;
}

int r()
{
    A = 36969 * (A & M) + (A >> 16);
    B = 18000 * (B & M) + (B >> 16);
    return (C & ((A << 16) + B)) % 1000000;
}

void solve(int l, int r)
{
    if (l == r)
    {
        g[l] = max(1, g[l]);
        return;
    }
    int mid = (l + r) >> 1, cnt = 0;
    solve(l, mid);
    for (int i = l; i <= mid; ++i)
        q[cnt++] = (qry) {i, 0, d[i].y, d[i].z, g[i]};
    for (int i = mid + 1; i <= r; ++i)
        q[cnt++] = (qry) {i, 1, d[i].y, d[i].z, 0};
    sort(q, q + cnt, cmp1);
    ++clk;
    for (int i = 0; i < cnt; ++i)
    {
        if (!q[i].t) update(q[i].y, q[i].val);
        else g[q[i].id] = max(g[q[i].id], query(q[i].y - 1) + 1);
    }
    solve(mid + 1, r);
}

int main()
{
    ios::sync_with_stdio(false);
    while (cin >> n >> m >> A >> B && n + m)
    {
        for (int i = 1; i <= n; ++i)
            cin >> d[i].x >> d[i].y >> d[i].z;
        for (int i = n + 1; i <= n + m; ++i)
            d[i].x = r(), d[i].y = r(), d[i].z = r();
        for (int i = 1; i <= n + m; ++i)
            ++d[i].x, ++d[i].y, ++d[i].z;
        sort(d + 1, d + n + m + 1, cmp);
        memset(f, 0, sizeof(f));
        memset(g, 0, sizeof(g));
        memset(ct, 0, sizeof(ct));
        clk = 0;
        solve(1, n + m);
        cout << *max_element(g + 1, g + 1 + n + m) << endl;
    }
}

Measured memory_bytes: 19648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _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 all(x) (x).begin(),(x).end()


int main(){
    queue<ll> q;
    int n; cin>>n;
    rep(i, 1, 10) {
        q.push(i);
    }
    int ctr = 0;
    while(true) {
        ll f = q.front();
        q.pop();
        if (++ctr == n) {
            cout<<f<<endl;
            exit(0);
        }
        if (f % 10 == 0) {
            q.push(f * 10 + 0);
            q.push(f * 10 + 1);
        }
        else if (f % 10 == 9) {
            q.push(f * 10 + 8);
            q.push(f * 10 + 9);
        }
        else {
            q.push(f * 10 + f % 10 - 1);
            q.push(f * 10 + f % 10);
            q.push(f * 10 + f % 10 + 1);
        }
    }
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());

        for (int i = 0; i <= 20000; i++) {
            float a = (float) i * 0.08f;
            float b = (float) i * 0.1f;
            if (((int) a) == A && ((int) b) == B) {
                System.out.println(i);
                return;
            }
        }

        System.out.println(-1);
    }

}



Measured memory_bytes: 23892
use std::collections::VecDeque;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let mut graph: Vec<Vec<(usize, usize)>> = (0..n).map(|_| Vec::new()).collect();
    for _ in 0..(n - 1) {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        let c = sc.read::<usize>();
        graph[a].push((b, c));
        graph[b].push((a, c));
    }

    let q: usize = sc.read();
    let k: usize = sc.read::<usize>() - 1;

    let mut dist = vec![std::usize::MAX; n];
    dist[k] = 0;

    let mut queue = VecDeque::new();
    queue.push_back(k);
    while !queue.is_empty() {
        let v = queue.pop_front().unwrap();
        for e in &graph[v] {
            let (to, cost) = *e;
            if dist[to] <= dist[v] + cost { continue; }
            dist[to] = dist[v] + cost;
            queue.push_back(to);
        }
    }

    for _ in 0..q {
        let x = sc.read::<usize>() - 1;
        let y = sc.read::<usize>() - 1;
        println!("{}", dist[x] + dist[y]);
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



Measured memory_bytes: 19708
package main

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

func min(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m > v {
			m = v
		}
	}
	return m
}

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - City Savers
	var N int
	fmt.Scanf("%d", &N)

	sc.Split(bufio.ScanWords)
	A := make([]int, N+1)
	B := make([]int, N)

	for i := 0; i < N+1; i++ {
		A[i] = nextInt()
	}

	for i := 0; i < N; i++ {
		B[i] = nextInt()
	}

	var ans int
	var temp int = 0
	for i := 0; i < N; i++ {
		if A[i]-temp >= 0 {
			A[i] = A[i] - temp
			ans += temp
		} else {
			ans += A[i]
			A[i] = 0
		}
		ans += min(A[i], B[i])
		temp = max(B[i]-A[i], 0)
	}

	if temp != 0 {
		if A[N]-temp >= 0 {
			ans += temp
		} else {
			ans += A[N]
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5944
#include <stdio.h>
#include <string.h>

int main() {
  char W[3][7] = {"Sunny", "Cloudy", "Rainy"};
  char S[7];
  scanf("%s", S);
  for (int i = 0; i < 3; i++) {
    if (strcmp(&S[0], &W[i][0]) == 0) {
      int tmp = (i+1)%3;
      printf("%s\n", &W[tmp][0]);
    }
  }
  return 0;
}

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

int main()
{   long long h,w,x,y;
    scanf("%lld%lld%lld%lld",&w,&h,&x,&y);
    
    printf("%.10lf",(double)h/2.0*(double)w);
    if(h%2==0&&w%2==0&&x==w/2&&y==h/2)printf(" 1");
    else printf(" 0");

    return 0;
}


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

int main(){
    int n, k;cin >> n >> k;
    int now = 1;
    for (int i = 0; i < k - 1; i++){
        now += 2;
    }if (n >= now){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define pb push_back

int main(){
    map<int,bool> a;
    int N;
    cin >> N;
    int count=0;
    rep(i,N){
        int b;
        cin >> b;
        if(a.find(b)==a.end() || !a[b]) {
            a[b]=true;
            count++;
        }else{
            a[b]=false;
            count--;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 4864
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int X,A,B;
int main(int argc, char const *argv[])
{
cin>>X>>A>>B;
cout<<(X-A)%B<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

bool check(int N){
    vint a(5);
    REP(i,5){
        a[i]=N%10; N/=10;
    }
    return (a[0]==a[4] and a[1]==a[3]);
}

signed main()
{
    int A,B; cin>>A>>B;

    int ans=0;
    for(int i=A;i<=B;i++){
        if(check(i)) ans++;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        a,b=map(lambda x:int(x)-1,input().split())
        E[a].append(b)

    # bfs
    def bfs(sv):
        prev=[-1]*n
        flag=False
        from collections import deque
        Q=deque([sv])
        while(Q):
            v=Q.popleft()
            for nv in E[v]:
                if(nv==sv):
                    flag=True
                    break
                elif(prev[nv]==-1):
                    prev[nv]=v
                    Q.append(nv)
            if(flag): break
        if(not flag):
            return [0]*(n+1)
        else:
            loop=[]
            while(v!=-1):
                loop.append(v)
                v=prev[v]
            loop.reverse()
            return loop

    # calculate
    ans=[0]*(n+1)
    for i in range(n):
        loop=bfs(i)
        if(len(loop)<len(ans)):
            ans=loop
    if(len(ans)==n+1):
        print(-1)
    else:
        print(len(ans))
        for v in ans: print(v+1)
resolve()

Measured memory_bytes: 44268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lopj(n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

main()
{
    ll ans=0,flag=0;
    string s,k;
    k="SSR";
    cin>>s;
    if(s==k)
    {
        cout<<1;
        return 0;
    }
    lop0(s.size()-1)
    {
       if(s[i]==s[i+1] and s[i]=='R') ans+=1;
       if(s[i]=='R') flag=1;
    }

    if(flag) ans+=1;
    cout<<ans;
}



Measured memory_bytes: 3620
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int H, W;
  cin >> H >> W;
  int c[10][10];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> c[i][j];
    }
  }

  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }

  long long ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int A;
      cin >> A;
      if (A >= 0) ans += c[A][1];
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



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

int main() {
  string s;
  cin >> s;
  
  int i = 0, ans = 0;
  for(i=0;i<3;i++){
    if(s.substr(i, 1) == "1") {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;

template<class X> X gcd(X a, X b) {return b ? gcd(b,a%b):a;}

int main() {
    int N;
    cin >> N;
    vector<ll> X(N);
    for (int i = 0; i < N; i++)cin >> X[i];
    vector<ll> copy(N);
    for (int i = 0; i < N; i++) copy[i] = X[i];
    sort(all(copy));
    ll median1 = copy[N / 2 - 1];
    ll median2 = copy[N / 2];

    for (int i = 0; i < N; i++) {
        if (X[i] <= median1) cout << median2 << endl;
        else cout << median1 << endl;
    }
}

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

int main() {
  int N, D, A;
  cin >> N >> D >> A;
  vector<pair<int, int>> V(N);
  for (int i = 0, x, h; cin >> x >> h; i++) V.at(i) = {x, h};
  sort(V.begin(), V.end());
  vector<int> X(N), H(N);
  for (int i = 0; i < N; i++) {
    X.at(i) = V.at(i).first;
    H.at(i) = V.at(i).second;
  }
  vector<long> imos(N + 1);
  long ans = 0;
  for (int i = 0; i < N; i++) {
    long range = (long) X.at(i) + D + D;
    auto it = upper_bound(X.begin(), X.end(), range) - X.begin();
    long cnt = (H.at(i) + A - 1) / A;
    cnt -= imos.at(i);
    cnt = max(0L, cnt);
    ans += cnt;
    imos.at(i) += cnt;
    imos.at(it) -= cnt;
    imos.at(i + 1) += imos.at(i); 
  }
  cout << ans << "\n";
}

Measured memory_bytes: 7980
#include <cstdio>
#include <algorithm>
using namespace std;

int pi[233333];

int main()
{
	int n,k; scanf("%d%d",&n,&k);
	for(int i=1; i<=n; i++) scanf("%d",&pi[i]);
	sort(pi+1,pi+1+n);
	long long sum=0;
	for(int i=n-k; i>0; i--) sum+=pi[i];
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
long long ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    vector<int> CS(N+1);
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        CS[i+1] = CS[i]+--a;
        CS[i+1] %= K;
    }
    map<int, int> M;
    int i = 0;
    for (; i < min(K, N+1); ++i) {
        ++M[CS[i]];
    }
    for (auto m : M) {
        ans += (long long)m.second*(m.second-1)/2;
    }
    for (; i < N+1; ++i) {
        --M[CS[i-K]];
        ans += M[CS[i]]++;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 11264
def solve(N):
    print(0, flush=True)
    answer = input()[0]
    if answer == "V":
        return
    st = 0
    stc = answer
    ed = N
    edc = answer
    for i in range(20):
        x = (st + ed) // 2
        print(x, flush=True)
        answer = input()[0]
        if answer == "V":
            return
        if (x - st) % 2 == 0 and stc != answer:
            ed = x
            edc = answer
            continue
        if (x - st) % 2 == 1 and stc == answer:
            ed = x
            edc = answer
            continue
        if (ed - x) % 2 == 0 and edc != answer:
            st = x
            stc = answer
            continue
        if (ed - x) % 2 == 1 and edc == answer:
            st = x
            stc = answer
            continue

    return 0

if __name__ == "__main__":
    N = int(input())
    solve(N)



Measured memory_bytes: 3660
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1LL << 60
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i, m) for (int i = 0; i < m; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int mn = 1000000;
  REP(i, s.size()-1){
    if(s[i] != s[i+1]){
      mn = min(mn, max(i+1, n-1-i));
    }
  }
  if(mn == 1000000) cout << n << endl;
  else cout << mn << endl;
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main(){
	int n,a[200005],i,j,min=-100000,ans=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	min=a[0];
	for(i=1;i<n;i++){
		if(a[i]<=min){
			ans+=1;
			min=a[i];
		}
	
	}
	printf("%d",ans);
	
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
bool b = 0,c = 0,d = 0;
int n = s.length();
string t ;cin>>t;
int m = t.length();
char x[n+1];
char y[m+1];
strcpy(x,s.c_str());
strcpy(y,t.c_str());
for(int i=0;i<n;i++)
    if(x[i]>=65 || x[i]<=90)
        b = 1;
for(int i=0;i<m;i++)
    if(y[i]>=65 || y[i]<=90)
        c = 1;
if(b==1&&c==1&&n>=1&&n<=10&&m==n+1)
    for(int i=0;i<n;i++)
        if(x[i]!=y[i])
            d = 1;
if(d==0)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;

return 0;}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int odd = count_if(all(a), [](int num) {
    return num % 2;
  });

  string ans = odd % 2 == 0 ? "YES" : "NO";

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 1005;
const ll mod = 1e9+7;

int prime[maxn];

void findPrime(int n){
	for(int i = 2; i<=n ;i++){
		prime[i] = 1;
	}
	prime[1] = 0;
	for(int i = 2; i*i<= n; i++){
		if(prime[i]){
			for(int j = 2; j<= n/i;j++){
				prime[j * i] = 0;
			}
		}
	}
}

int findexp(int n, int m){
	int sum = 0;
	int num = m;
	while(num <= n){
		sum+=(n/num);
		num *= m;
	}
	return sum;
}

int main(){
	int n;
	cin >> n;
	ll ans = 1;
	findPrime(n);
	for(int i = 2; i <= n; i++){
		if(prime[i] == 1){
			ans = (ans*(findexp(n, i)+1)) % mod;
		}
	}
	cout << ans;
} 

Measured memory_bytes: 3616