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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

class UnionFind {
public:
    vector<int> par;

    UnionFind(int N):par(N){
        for(int i=0;i<N;i++)par[i]=i;
    }

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

    void unite(int x,int y){
        int rx=root(x);
        int ry=root(y);
        if (rx==ry) return;
        par[rx]=ry;
    }

    bool same(int x,int y){
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
};

int N,M;
int f[200005];

signed main(){
    cin>>N>>M;
    UnionFind uf(N);
    for(int i=0;i<M;++i){
        int a,b;
        cin>>a>>b;
        a--,b--;
        uf.unite(a,b);
    }
    for(int i=0;i<N;++i)f[uf.root(i)]++;
    sort(f,f+N);
    cout<<f[N-1]<<endl;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int M; cin >> M;
    cout << 48-M << endl;
    return 0;
}

Measured memory_bytes: 3580
a = int(input())
if (a%2==1 and (a!=25 and a!=27 and a!=9 and a!=21)) or a==2:
    print(1)
elif a==32:
    print(51)
elif a==24:
    print(15)
elif a==16:
    print(14)
elif a==28 or a==30:
    print(4)
elif (a!=4 and a%4==0) or a==18 or a==27:
    print(5)
else:
    print(2)

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int H, W, N;
    cin >> H >> W >> N;
    set<pii> P;
    vector<vector<int>> P2(H + 1);

    for (int i = 0; i < N; i++) {
        int y, x;
        cin >> y >> x;
        y--, x--;
        P2[y].push_back(x);
        P.insert({y, x});
    }
    
    int w = 0;
    for (int i = 0; i < H; i++) {
        for(int j = 0; j < P2[i + 1].size(); j++) {
            if (P2[i + 1][j] <= w) {
                cout << i + 1 << endl;
                return;
            }
        }
        if (P.find({i + 1, w + 1}) == P.end()) w++;
    }
    cout << H << endl;
    
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 20608
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


S = ST()
Q = I()

switch = True
prefix = ""
suffix = ""
for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        if switch:
            switch = False
        else:
            switch = True
    else:
        if switch:
            if query[1] == "1":
                prefix = query[2] + prefix
            else:
                suffix = suffix + query[2]
        else:
            if query[1] == "1":
                suffix = suffix + query[2]
            else:
                prefix = query[2] + prefix

ans = prefix + S + suffix
if switch:
    print(ans)
else:
    print(ans[::-1])


Measured memory_bytes: 10356
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define F first
#define S second

using namespace std;
using ll = long long;
using namespace __gnu_pbds;

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 3e5 + 10 , inf = 2e9 + 7;
const ll INF = 1e18 ,   mod = 1e9+7 , P = 6547;

pair<int,int> cntx[N] , cnty[N];
unordered_map<ll, bool> u;

void solve() {
    int h , w , m;
    cin >> h >> w >> m;
    for(int i = 1; i <= m; i ++) {
        int x , y;
        cin >> x >> y;
        cntx[x].F ++;
        cnty[y].F ++;
        u[1ll*x*h+y] = 1;
    }
    for(int i = 1; i < N; i ++) {
        cntx[i].S = i;
        cnty[i].S = i;
    }
    sort(cntx + 1 , cntx + h + 1);
    sort(cnty + 1 , cnty + w + 1);
    reverse(cntx + 1 , cntx + h + 1);
    reverse(cnty + 1 , cnty + w + 1);
    int ans = 0;
    for(int j = 1; j <= w; j ++) {
        ans = max(ans , cntx[1].F + cnty[j].F - u[1ll*cntx[1].S*h+cnty[j].S]);
    }
    for(int j = 1; j <= h; j ++) {
        ans = max(ans , cntx[j].F + cnty[1].F - u[1ll*cntx[j].S*h+cnty[1].S]);
    }
    cout << ans;
}
/*
*/
main() {
    ios;
    int tt = 1;
    //cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 44132
#a,b, c = map(int,input().split())
#if a==b and b==c and c == a:
    #print(0)
#else:
L = list(map(int,input().split()))
L.sort()
a = L[0]
b = L[1]
c = L[2]
x = c//2
y = c - x
df = abs((a*b*x) - (a*b*y))

print(df)

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

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

  int ans = 0;
  int a, b, c;
  for (int i=0; i<N; ++i) {
    cin >> c;
    if (1<i) {
      if ((a < b and b < c) or (a > b and b > c)) ++ans;
    }
    a = b;
    b = c;
  }
  cout << ans << "\n";
}


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

int main() {
  long long int x=100,z,count=0;
  cin>>z;
 	int i=1;
while(i)
{ count++;
    x+=x*0.01;
    if(x>=z)
    i=0;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=50,MAX_M=50;
int N;
int a[MAX_N],b[MAX_N];

int G[MAX_M+1][MAX_M+1];

void war(){
	REP(i,MAX_M+1)REP(j,MAX_M+1)REP(k,MAX_M+1) G[i][j]|=G[i][k]*G[k][j];
}

int main(){
	vector<int> vec;
	cin>>N;
	REP(i,N){
		cin>>a[i];
	}
	REP(i,N){
		cin>>b[i];
	}
	bool f=false;
	REP(i,N){
		if (a[i]!=b[i] && a[i]<=2*b[i]){
			f=true;
		}
	}
	if (f){
		cout<<-1<<endl;
		return 0;
	}
	for(int k=MAX_M;k>0;k--){
		memset(G,0,sizeof(G));
		REP(i,MAX_M+1){
			G[i][i]=1;
		}
		for(auto ite:vec){
			REP(i,MAX_M+1){
				G[i][i%ite]=1;
			}
		}
		FOR(i,1,k){
			REP(j,MAX_M+1){
				G[j][j%i]=1;
			}
		}
		war();
		bool flg=true;
		REP(i,N){
			if (!G[a[i]][b[i]]){
				flg=false;
			}
		}
		if (!flg){
			vec.push_back(k);
		}
	}
	ll ans=0;
	for(auto ite:vec){
		ans+=1ll<<ite;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
# coding:utf-8
# a??¨b?????§?°???¢????????????

ab = raw_input().split()

a = int(ab[0])
b = int(ab[1])

if a < b:
    print  "a < b"

elif a > b:
    print  "a > b"

else:
    print  "a == b"

Measured memory_bytes: 6408
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mod ((ll)1e9+7)
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3f
#define Ninf -0x3e3e3e3f
#define Ninfl -0x3e3e3e3e3e3e3e3f
#define maxx ((ll)1e5+5)
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
ll add(ll x, ll y) { x += y; if (x >= mod) return x-mod; return x;}
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + mod; return x;}
ll mult(ll x, ll y) { return (x * y) % mod;}
ll rev(ll x) { return expm(x, mod - 2);}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[maxx]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<maxx;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncrm(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
ll inv[maxx];   // returns the modular inverse of number
void inversify( ll m){inv[1]=1;for(int i=2;i<maxx;i++){inv[i]= m- m/i*inv[m%i]%m;}}
ll ncr(ll n,ll r,ll m){int ans=1;for (int i = 0; i < r; i++){ans=ans*(n-i)%m*inv[i+1]%m;}return ans;}
*/
signed main(){
  fast;
  //test
  {
    int x;
    cin>>x;
    int m=100;
    int ans=0;
    while(m<x){
      m=m*1.01;
      ans++;
    }
    cout<<ans;
  }
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
 int a , b;
 cin >> a >> b;
 if(b % a == 0)cout << a + b << endl;
 else cout << b - a << endl;
}

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

void printSort(int A[], int N){
    cout << A[0];
    for(int i=1; i<N; i++){
        cout << " " << A[i];
    }
    cout << "" << endl;
}

void bubbleSort(int A[], int N){
    int flag, i, j, tmp, cnt;
    flag = 1;
    cnt = 0;
    while(flag){
        flag = 0;
        for(j=N-1; j+0; j--){
            if(A[j]<A[j-1]){
                tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = 1;
                cnt++;
            }
        }
    }
    printSort(A, N);
    cout << cnt << endl;
}

int main(void){
    int N, A[100];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    bubbleSort(A, N);
    return 0;
}

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

string G = "GREATER";
string L = "LESS";

string compare(string &a, string &b) {
  int la = a.size(), lb = b.size();
  if(la > lb) return G;
  if(la < lb) return L;

  for(int i = 0; i < la; i++) {
    if(a[i] > b[i]) return G;
    if(a[i] <b[i]) return L;
  }
  return "EQUAL";
}
int main () {
  string a, b;
  cin >> a >> b;
  cout << compare(a, b) << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

def next_lunlun(x):
    K = len(x)
    if len(x) == 1:
        return str(int(x) + 1)
    if x[-1] == '9':
        next =  next_lunlun(x[:-1])
        if int(next[-1]) - 1 >= 0:
            return next + str(int(next[-1]) - 1)
        else:
            return next + '0'

    if x[-2] >= x[-1]:
        return x[:-1] + str(int(x[-1]) + 1)
    else:
        next = next_lunlun(x[:-1])
        if int(next[-1]) - 1 >= 0:
            return next + str(int(next[-1]) - 1)
        else:
            return next + '0'


def solve(K: int):
    x = '0'
    for k in range(K):
        x = next_lunlun(x)
    print(x)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, Q = map(int, input().split())
lines = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    lines[a-1].append(b-1)
    lines[b-1].append(a-1)
ans = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x

def dfs(v, parent):
    for u in lines[v]:
        if u != parent:
            ans[u] += ans[v]
            dfs(u, v)

dfs(0, -1)
print (*ans)

Measured memory_bytes: 230960
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int n; cin >> n;
  ll s[n];
  REP(i,n) cin >> s[i];
  ll ans = 0;
  for(int c = 1; c<n-1; c++){
    ll dp = 0;
    for(int k = 1; k*c<n-1-c;k++){
      if((n-1-k*c)%c==0&&(n-1-k*c)/c<=k) break;
      dp += s[k*c]+s[n-1-k*c];
      ans = max(ans,dp);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
S = str(input())
#Sを分割してリスト化
l = list(S)

#各Wに対して、それより左にある黒の数を足したものが答え

ans = 0

#これまでに見つけたBの数
b=0

for i in range(len(l)):
  if l[i] == "W": #白の場合
    ans += b
  else: #黒の場合
    b += 1

print(ans)

Measured memory_bytes: 10504
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int test[123456];
int main(){
  int n, k, a, b, sum = 0, ans = 1; cin >> n >> k >> a >> b;
  if(a!=n){
   cout<<1<<endl; 
  }
  else{
   cout<<0<<endl; 
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
string s;
int ans,a[20];
int get(string t){
  int res=0,sum=0;
  r(i,t.size()){
    if(t[i]=='+'){
      sum+=res;
      res=0;
    }
    else{
      res=res*10+(t[i]-'0');
    }
    if(i==t.size()-1)sum+=res;
  }
  return sum;
}
void dfs(int d){
  if(d==s.size()-1){
    string t;
    r(i,s.size()){
      t+=s[i];
      if(a[i])t+='+';
      //ans+=get(t);
    }
    ans+=get(t);
    //cout<<ans<<endl;
    //cout<<t<<endl;
    return ;
  }
  a[d]=0;
  dfs(d+1);
  a[d]=1;
  dfs(d+1);
}
 main(){
  cin>>s;
  dfs(0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define For(i, s, e) for(int i = s;i <= e;i++)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;


int main() {
    int r;cin>>r;
    cout << r*6.283;
}


Measured memory_bytes: 3784
import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
 
 
def main():
    N,D = map(int,input().split())
    ans=0
    for i in range(N):
        x,y = map(int,input().split())
        if D+10e-7>=math.sqrt(x**2+y**2):
            ans+=1
    print(ans)

 
if __name__ == '__main__':
    main()


Measured memory_bytes: 9632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var NK = ReadLine().Split().Select(int.Parse).ToArray();
        int N = NK[0], K = NK[1];
        var p = ReadLine().Split().Select(_=>double.Parse(_)-1).ToArray();
        var d = new double[N + 1];
        for (int i = 0; i < N; i++)
        {
            d[i + 1] = d[i] + p[i];
        }
        double ans = 0;
        for (int i = 0; i < N-K+1; i++)
        {
            ans = Max(ans, K + (d[i + K] - d[i]) / 2);
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 43824
#include<bits/stdc++.h>
using namespace std;
int bns (int a[], int l, int r, int key) {
    int mid, pos = l - 1;
    while(l<=r) {
        mid=(l+r) / 2;
        if(a[mid]<key) {
            l = mid + 1;
            pos = mid;
        } else
            r = mid - 1;
    }
    return l;
}
int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int cnt=0;
    for(int i=0; i<n-2; i++) {
        for(int j=i+1; j<n-1; j++) {
            cnt += bns(a,j+1,n-1,a[i] + a[j]) - j - 1;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main (String[] args) {
   	 Scanner sc = new Scanner(System.in);
   	 int N = sc.nextInt();
   	 int Y = sc.nextInt();
   	 
   	 for(int i = 0; i <= N; i++) {
   		 for(int j = 0; j <= N - i; j++) {
   			 int k = N - i - j;
   			 int total = i*10000 + j*5000 + k*1000;
   			 if(total == Y) {
   				 System.out.println(i + " " + j + " " + k + " ");
   				 return;
   			 }
   		 }
   	 }
   	 System.out.println("-1 -1 -1");
    }
}


Measured memory_bytes: 39444
n=int(input())
a=list(map(int,input().split()))
b=[]
c=[]
s=sum(a)
t=0
for i in range(n-1):
    b.append(t+a[i])
    t=b[i]
for i in range(n-1):
    c.append(abs(2*b[i]-s))
c.sort()
print(c[0])

Measured memory_bytes: 37356
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

using vl   = vector<long long>;
using vvl  = vector<vl >;
using vvvl = vector<vvl >;

const int mod=998244353;

template<typename T>
class SegmentTree{
	using F=function<T(T,T)>;
	int n,offset;	//n:=(葉の数（2の階乗数）),offset:=(n-1).
	const T e;		//e:=(単位元).
	vector<T> node;
	const F f;		//f:=(二項演算処理).
	
	int bufsize(int n_){//木に必要なノード数を返す.
		n=1;
		while(n<n_) n<<=1;
		offset=n-1;
		return 2*n-1;
	}
	void build(int l=0,int r=-1){//木を構築する. O(N).
		if(r<0) r=n;
		l+=offset, r+=offset;
		do{
			l=(l-1)/2, r=(r-1)/2;
			for(int i=l;i<r;++i) node[i]=f(node[2*i+1],node[2*i+2]);
		}while(l>0);
	}
	
public:
	/*constructor.*/
	SegmentTree(int n_,T e_,F f_):node(bufsize(n_),e_),e(e_),f(f_){}
	SegmentTree(const vector<T> &v_,T e_,F f_):node(bufsize(v_.size()),e_),e(e_),f(f_){
		copy(ALL(v_),node.begin()+offset);//<algorithm>.
		build();
	}
		
	void init(){fill(ALL(node),e);}//初期化する.
	void update(int k,T a){//k番目の要素をaに更新する. O(log N).
		k+=offset;
		node[k]=a;
		while(k>0){
			k=(k-1)/2;//parent.
			node[k]=f(node[2*k+1],node[2*k+2]);
		}
	}
	void add(int k,T a){update(k,(node[k+offset]+a)%mod);}//k番目の要素にaを加算する. !!!
	/*[a,b)間のクエリ結果を返す. O(log N).
	（後ろの3つの引数は計算の簡単のための引数. kはノード番号,lとrはそのノードが[l,r)に対応づいているかを表す. 外からはquery(a,b,0,0,n)と呼ぶ.）*/
	T query(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0) r=n;
		if(b<=l or r<=a) return e;			//[a,b)と[l,r)が交差しなければe.
		if(a<=l and r<=b) return node[k];	//[a,b)が[l,r)を完全に含んでいれば,この節点の値.
		T vl=query(a,b,2*k+1,l,(l+r)/2);
		T vr=query(a,b,2*k+2,(l+r)/2,r);
		return f(vl,vr);					//交差する場合,2つの子をクエリ処理して比較.
	}
	
	typename vector<T>::reference operator[](int i){return node[i+offset];}
};

int main(){
	int n,k;
	cin>>n>>k;
	
	vi l(k),r(k);
	REP(i,k) cin>>l[i]>>r[i];
	
	using Type=llong;
	auto f=[](Type a,Type b)->Type{return (a+b)%mod;};
	SegmentTree<Type> tree(n+1,0LL,f);
	tree.update(1,1LL);
	
	for(int i=2;i<=n;++i){
		REP(j,k){
			if(i-l[j]<1){}
			else{
				int a=max(i-r[j],1),b=i-l[j];
				tree.add(i,tree.query(a,b+1));
			}
		}
	}
	
	cout<<tree.query(n,n+1)<<endl;
	return 0;
}

Measured memory_bytes: 7496
#include<bits/stdc++.h>
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define hi "visited\n" //sasta debugging
using namespace std;

//author::@whohet-->Het Patel

signed main()
{
	fasterthanlight;
	int n;
	cin >> n;
	if (n % 2 == 0)
	{
		cout << -1 << endl; return 0;
	}
	int n1 = 7; int m = 0;
	for (int i = 1; i <= 1e7; i++)
	{
		m = (m * (10) + (7)) % n;
		if (m == 0)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << -1;
	return 0;
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int main(){
	int i = 0;
	int j = 0;
	int n = 0;
	int d[100] = {};
	int sum = 0;
  
	scanf("%d",&n);
	
	for(i=0;i < n;i++){
		scanf("%d",&d[i]);
	}
	
	for(i=0;i < n;i++){
		for(j=0;j < n;j++){
			if(i != j){
				sum += d[i]*d[j];
			}
		}
	}
	printf("%d",sum/2);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

int lsone(int n)
{
	return (n&-n);
}

ll pow1(ll a, ll b)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2);
		x *= x;
		x %= mod;
		if (b%2)
		{
			x *= a;
			x %= mod;
		}
		return x;
	}
}

int x, y;

int main()
{
	fastio;		
	cin>>x>>y;
	int ans = 0;
	if (x == y and x == 1)
		ans = 400000;

	if (x == 3)
		ans += 100000;
	else if (x == 2)
		ans += 200000;
	else if (x == 1)
		ans += 300000;

	x = y;

	if (x == 3)
		ans += 100000;
	else if (x == 2)
		ans += 200000;
	else if (x == 1)
		ans += 300000;

	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  /*
  int n, i, j;
  cin >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  */
  int n, m, i;
  cin >> n;
  vector<int> D(n);
  rep(i, n) cin >> D[i];
  sort(D.begin(), D.end());
  n /= 2;
  cout << D[n] - D[n-1] << endl;
}


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

int main(){
    string str1,str2;
    cin>>str1>>str2;
    
    if(str1.length() != str2.length()-1){
        cout<<"No"<<endl;
        return 0;
    }
    int flag = 0;
    for(int i=0;i<str1.length();i++){
        if(str1[i]!=str2[i]){
            cout<<"No"<<endl;
            flag = 1;
            break;
        }
    }
    
    if(!flag){
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
import java.math.*;
import java.util.*;
import java.util.function.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    sc.close();

    Map<Integer, Integer> lcm = new HashMap<>();
    for (int ai : A)
      for (Map.Entry<Integer, Integer> fAi : f(ai).entrySet())
        lcm.put(fAi.getKey(), Math.max(lcm.getOrDefault(fAi.getKey(), 0), fAi.getValue()));

    BigInteger BILcm = BigInteger.ONE;
    for (Map.Entry<Integer, Integer> lcm_p : lcm.entrySet())
      BILcm = BigInteger.valueOf(lcm_p.getKey()).pow(lcm_p.getValue()).multiply(BILcm);

    BigInteger mod = BigInteger.valueOf(1000000007);
    BigInteger ans = BigInteger.ZERO;
    for (int ai : A)
      ans = BILcm.divide(BigInteger.valueOf(ai)).add(ans);

    System.out.println(ans.remainder(mod));
  }

  private static Map<Integer, Integer> f(int n) {
    Map<Integer, Integer> f = new HashMap<>();
    int m = n;
    int s = SIEVE[m - 1];
    while (s != 0) {
      f.put(s, f.getOrDefault(s, 0) + 1);
      m /= s;
      s = SIEVE[m - 1];
    }
    return f;
  }

  private static int[] SIEVE = sieve(1000000);

  private static int[] sieve(int n) {
    int [] sieve = new int[n];
    for (int i = 2; i <= n; i += 2) sieve[i - 1] = 2;
    int sqrt = (int) Math.sqrt(n);
    for (int i = 3; i <= n; i += 2) {
      if (sieve[i - 1] == 0) sieve[i - 1] = i;
      if (i <= sqrt)
        for (int j = i * i; j <= n; j += i)
          if (sieve[j - 1] == 0) sieve[j - 1] = i;
    }
    return sieve;
  }
}

Measured memory_bytes: 249892
#include <iostream>
#include <vector>
using namespace std;
 
int main () {
	int n,i,ans=0,j;
	vector<int> a(0);
	cin >> n;

	for (i=0;i<n;i++){
		int t;
		cin >> t;
		a.push_back(t);
	}

	i = 1;
	while(1){
		ans++;
		if(i != a[i-1]){
			i = a[i-1];
		}
		else{
			ans = -1;
			break;
		}
		if(i==2){
			break;
		}else if(ans > n){
			ans = -1;
			break;
		}
	}

	cout << ans << endl;



    return 0;
}

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

using namespace std;
const int maxn =  1e6 + 10;
#define ll long long
#define ios std::ios::sync_with_stdio(false)
const ll INF(0x3f3f3f3f3f3f3f3fll);
const int inf(0x3f3f3f3f);
/*


ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=1;while(n){if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}//xµÄn´Î·½mod


ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=0,v=a;while(b){if(b&1){r+=v;if(r>p)r-=p;}v<<=1;if(v>p)v-=p;b>>=1;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=1,v=a%p;while(b){if(b&1)r=mult(r,v,p);v=mult(v,v,p);b>>=1;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=1;i<=t;i++){r=mult(r,r,n);if(r==1&&z!=1&&z!=n-1)return true;z=r;}return r!=1;}
bool Miller_Rabin(ll n)
{if(n<2)return false;if(n==2)return true;if(!(n&1))return false;ll x=n-1,t=0;while(!(x&1)){x>>=1;t++;}srand(time(NULL));
ll o=8;for(ll i=0;i<o;i++){ll a=rand()%(n-1)+1;if(CH(a,n,x,t))return false;}return true;}


*/

#define int long long
#define sc(t) scanf("%lld",&t)
#define pr(ans) printf("%lld\n",ans)
ll pow_mod(ll x,ll n,ll mod){ll res=1;while(n){if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}//xµÄn´Î·½mod
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-48;isdigit(ch=getchar());res=(res<<1)+(res<<3)+ch - 48);flag&&(res=-res);}
typedef unsigned long long ULL;
const double pi = 3.1415926535897932384626;
int gcd(int a,int b){return !b?a:gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
#define debug(x) cout << #x << " : " << x << '\n';
#define sb cout << "sb\n";
#define fi first
#define se second
#define pb(a) push_back(a)
#define cn cout << '\n'
#define mp(a , b) make_pair(a , b)
const int mod = 8011200280112002;
signed main()
{
    ios;///60 10 50
    cin.tie(0);
    int a;
    double b;
    cin >> a >> b;
    int zheng = b;
    double xiao = b - zheng;
    int bb = xiao * 1000;
    if(bb % 10 == 9){
        bb ++;
    }
    int ans = a * bb;
    cout << zheng * a + ans / 1000 << '\n';
	return 0;
}


Measured memory_bytes: 3740
N, K = map(int, input().split())
hs = list(map(int, input().split()))

costs = [1e10 for _ in range(N)]
costs[0] = 0

for i in range(N):
  for k in range(1, min(K+1, N-i)):
    costs[i+k] = min(costs[i+k], costs[i] + abs(hs[i+k] - hs[i]))

print(costs[N-1])


Measured memory_bytes: 58848
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define stop exit(0)
#define dd double
#define po pop_back
#define pb push_back
#define ub upper_bound
#define lb lower_bound
int main(){
    vector <long long> v;
    ll a,b,c=0,d=0,e=0,f=0,g=0,i,j,k=1,l=0,r=1,n,m[300001],z[400001],h[600001],p[600001];
    string s,t,x,y[200001];
    dd q,u,w;
    cin>>a;
    for(i=1;i<=a;i++){
        cin>>y[i];
    }
    sort(y+1,y+a+1);
    for(i=2;i<=a;i++){
        if(y[i]!=y[i-1]){
            k++;
        }
    }
    cout<<k;
}

Measured memory_bytes: 9884
h, w, n = map(int, input().split())
src = list(map(int,input().split()))

s = input()
t = input()
s_c, t_c = [], []
for i in ["U", "D", "L", "R"]:
    s_c.append(s.count(i))
    t_c.append(t.count(i))
if (src[0] <= s_c[0]-t_c[1]) or (h-src[0]+1<=s_c[1]-t_c[0] )or (src[1]<=s_c[2]-t_c[3] )or (w-src[1]+1<=s_c[3]-s_c[2]):
    result = "NO"
else:
    result = "YES"
    for i in range(n):
        if s[i]=="U" and src[0]<=h-src[0]+1:
            src[0] -= 1
        elif s[i]=="D" and h-src[0]+1<=src[0]:
            src[0] += 1
        elif s[i]=="L" and src[1]<=w-src[1]+1:
            src[1] -= 1
        elif s[i]=="R" and w-src[1]+1<=src[1]:
            src[1] += 1
        if src[0]<1 or src[0]>h or src[1]<1 or src[1]>w:
            result = "NO"
            break

        if t[i]=="U" and src[0]>h-src[0]+1:
            src[0] -= 1
        elif t[i]=="D" and h-src[0]+1>src[0]:
            src[0] += 1
        elif t[i]=="L" and src[1]>w-src[1]+1:
            src[1] -= 1
        elif t[i]=="R" and w-src[1]+1>src[1]:
            src[1] += 1

print(result)

Measured memory_bytes: 3896
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [](auto& i)
#define compare(i, j) [](auto& i, auto& j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int r, g, b;
  int ans = 0;

  cin >> r >> g >> b;
  // vi v(n);
  // REP(i, n) {
  //   cin >> v[i];
  // }

  cout << ((g * 10 + b) % 4 == 0 ? "YES" : "NO") << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


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

typedef long long ll;

ll X,Y,Z,K;

int main(){
    cin>>X>>Y>>Z>>K;
    vector<ll>A(X);
    vector<ll>B(Y);
    vector<ll>C(Z);
    for(int i=0;i<X;i++){
        cin>>A[i];
    }
    for(int i=0;i<Y;i++){
        cin>>B[i];
    }
    for(int i=0;i<Z;i++){
        cin>>C[i];
    }
    vector<ll>AB;
    for(int i=0;i<X;i++){
        for(int j=0;j<Y;j++){
            AB.push_back(A[i]+B[j]);
        }
    }
    sort(AB.begin(),AB.end());
    reverse(AB.begin(),AB.end());
    vector<ll>ans;
    for(int i=0;i<min(X*Y,K);i++){
        for(int j=0;j<Z;j++){
            ans.push_back(AB[i]+C[j]);
        }
    }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    for(int i=0;i<K;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 43112
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<bitset>
#include<functional>
#include<climits>
using namespace std;
typedef pair<int,int>pii;
const int INF=1e9;
const int dx[]={0,-1,0,1},dy[]={-1,0,1,0};

int main(){
    char str[32];
    scanf("%s",str);
    bool s,d,u,l;
    s=d=u=l=false;
    if(strlen(str)>=6)s=true;
    for(int i=0;i<str[i];i++){
        if(isdigit(str[i]))d=true;
        else if(isupper(str[i]))u=true;
        else if(islower(str[i]))l=true;
    }
    if(s&&d&&u&&l)puts("VALID");
    else puts("INVALID");
    return 0;
}

Measured memory_bytes: 1112
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int id;
typedef long long ll;
vector <int> g[100004];
int a[100004];
int val[100004];
void dfs(int pos,int no){
	val[pos]=a[id--];
	for (int i=0;i<g[pos].size();i++) if(g[pos][i]!=no) dfs(g[pos][i],pos);
}
int main(){
	int n;cin>>n;
	for (int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);g[y].push_back(x);  
	}
	for (int i=0;i<n;i++) cin>>a[i];
	ll res=0;
	sort (a,a+n);
	for (int i=0;i<n-1;i++) res+=a[i];
	cout<<res<<"\n";
	id=n-1;
	dfs(1,-1);
	for (int i=1;i<=n;i++) cout<<val[i]<<" ";
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
    sort(ret.begin(), ret.end(), greater<int>());
	return ret;
}

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

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

    sort(A.begin(), A.end());
    
    int result0 = A[0];
    vector <int> EA0 = enum_div(A[0]);
    int j = 0;

    while(result0 > 0){
        int count = 0;
        result0 = EA0[j];
        for(int i = 0; i < N; i++){
            if (A[i] % result0 != 0) {
                count += 1;
            }
        }
        if (count <= 1) {
            break;
        }else{
            j += 1;
        }
    }

    int result1 = A[1];
    vector <int> EA = enum_div(A[1]);
    j = 0;
    while(result1 > 0){
        int count = 0;
        result1 = EA[j];
        for(int i = 0; i < N; i++){
            if (A[i] % result1 != 0) {
                count += 1;
            }
        }
        if (count <= 1) {
            break;
        }else{
            j += 1;
        }
    }

    if (result0 >= result1) {
        cout << result0 << endl;
    }else{
        cout << result1 << endl;
    }
    
    
    

    return 0;
}

Measured memory_bytes: 640
/*map,set,priority_queue,stack,queue*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define el "\n"
#define pb push_back
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
typedef vector<int> vi;
const int inf = (1e18)+7;
const int neginf = -1*((int)1e18 ) + 7 ;
const int mod = (int)1e9 + 7;
const int N = 500007;
/*int arr[N];
vector<int> adj[N];

void dfs(int x,int par)
{
    arr[x]+=par;
    arr[par] = 0;
    for(auto child:adj[x])
    {
        if(child==par)
            continue;
        dfs(child,x);
    }
}
*/

int32_t main() 
{
fastio
  
    int n;
    cin>>n;
    string s;
    cin>>s;
    char ch = s[0];
    int ct = 1;
    for(int i=1;i<n;++i)
    {
        if(s[i]==ch)
            continue;
        else
        {
            ct++;
            ch= s[i];
        }
    }
    cout<<ct;
    
    
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std ; 
int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int n ; 
	long long sum  = 0;  
	cin >> n ; 
	for(int i = 1 ; i <= n ; ++i)
	{
		if((i % 5 != 0) && (i % 3 != 0))
		{
			sum += i ; 
		}
	}
	cout << sum ; 
}



Measured memory_bytes: 3640
#include <stdio.h>

int main(void)
{
  int s;
  scanf("%d", &s);
  
  int i = 1;
  int a[1000001];
  a[0] = s;
  int ans = 0;
  int k;
  int flg = 0;
  while (i < 1000000 && flg == 0)
  {
    if (a[i - 1] % 2 == 0)
      a[i] = a[i - 1] / 2;
    else if (a[i - 1] % 2 == 1)
      a[i] = 3 * a[i - 1] + 1;
    k = 0;
    while (k < i)
    {
      if (a[k] == a[i])
      {
        ans = i + 1;
        flg = 1;
        break;
      }
      k++;
    }
    i++;
  }
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
g=gets,k=(0..1e5).map{[]};$<.map{|l|a,b=l.split.map &:to_i;k[a]<<b;k[b]<<a};q=g[j=k[i=1][0]]=1,j;q[S,0]=g[R]=R while S=[0,i+=1].find{|c|R=k[q[-c/i]].find{|x|!g[x]}};puts i,q*' '

Measured memory_bytes: 16380
#include<iostream>
#include<math.h>
 using namespace std ;
 int main()
{
short int a,b,c,d;

cin>>a;
cin>>b;
cin>>c;
cin>>d;
if((abs(c-a))<=d) cout<< "Yes";
else
 if((abs(c-b)<=d)&& ( abs(b-a)<=d) ) cout<< "Yes";
else
cout<< "No";
}


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

using namespace std;
typedef long long int ll;

void solve()
{
	string s;
	cin >> s;
	if(s =="RRS" || s == "SRR") cout << 2;
	else if(s == "RRR") cout << 3;
	else if(s == "SSS") cout << 0;
	else cout << 1;
}

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	int h,w;
	cin>>h>>w;
	vector<string> c(h+1);
	for(int i=1;i<=h;i++){
		cin>>c[i];
		c[i] = " "+c[i];
	}
	for(int i=1;i<=2*h;i++){
		for(int j=1;j<=w;j++){
			cout<<c[(i+1)/2][j];
		}
		cout<<endl;
	}
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	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;

int main() {
  string s,t;
  cin >> s >> t;

  int n = s.length();
  int ans = 0;

  rep(i,n) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3836
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	PrintWriter out = new PrintWriter(System.out);
      	int N = sc.nextInt();
      	int[] monsters = new int[N + 1];
      	int[] strength = new int[N];
      	for (int i = 0; i < N + 1; i++) {
        	monsters[i] = sc.nextInt(); 
        }
      	for (int i = 0; i < N; i++) {
        	strength[i] = sc.nextInt(); 
        }
      	long total = 0;
      	for (int i = N - 1; i >= 0; i--) {
          	int killedFirst = Math.min(monsters[i + 1], strength[i]);
          	strength[i] -= killedFirst;
          	int killedSecond = Math.min(strength[i], monsters[i]);
          	monsters[i] -= killedSecond;
          	total += (killedFirst + killedSecond);
        }
      	out.println(total);
      	out.close();
    }
}

Measured memory_bytes: 86872
#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 pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#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 S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
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) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int dp[50][500][500];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,ma,mb;
    cin >> n >> ma >> mb;
    vi a(n),b(n),c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    rep(i,50) rep(j,500) rep(k,500) dp[i][j][k] = inf;
    dp[0][0][0] = 0;
    rep(i,n) rep(j,500) rep(k,500) {
        if(dp[i][j][k] == inf) continue;
        chmin(dp[i+1][j][k],dp[i][j][k]);
        chmin(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
    }
    int ans = inf;
    int na = ma,nb = mb;
    while(na < 500 && nb < 500) {
        chmin(ans,dp[n][na][nb]);
        na += ma;
        nb += mb;
    }
    cout << (ans == inf ? -1 : ans) << endl;
}


Measured memory_bytes: 49152
n=int(input())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
for j in range(n):
    tmp=ab[j][1]
    ab[j][1]=ab[j][0]
    ab[j][0]=tmp
ans='Yes'
cnt=0
cnt1=0
ab.sort()
for k in range(n):
    cnt=ab[k][0]
    cnt1+=ab[k][1]
    if cnt1>cnt:
        ans='No'
        break
print(ans)

Measured memory_bytes: 81496
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
    int A, B, M;
    int *a, *b;

    cin >> A >> B >> M;
    int min_a=100000, min_b=100000;
    a = new int[A];
    for(int i=0; i<A; i++){
        cin >> a[i];
        min_a = min(min_a, a[i]);
    }
    b = new int[B];
    for(int i=0; i<B; i++){
        cin >> b[i];
        min_b = min(min_b, b[i]);
    }

    int tmp=min_a+min_b;
    
    int x, y, c;
    for(int i=0; i<M; i++){
        cin >> x >> y >> c;
        int tmp2;
        tmp2 = a[x-1] + b[y-1] - c;
        tmp = min(tmp, tmp2);
    }

    cout << tmp;
 	delete[] a;
  	delete[] b;

    return 0;
}

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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int);
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fastpow(ll, ll, ll);
ll slowpow(ll, ll, ll);
ll _gcd(ll, ll);
ll _lcm(ll, ll);
ll extgcd(ll, ll, ll&, ll&);
ll _inv(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    ll n = sl();

    ll res = LINF;
    for (ll i = 1; i * i <= n; ++i)
        if (n % i == 0)
            res = min(res, i + n / i - 2);
    pl(res);

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fastpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slowpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll _gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

ll _lcm(ll a, ll b)
{
    return a / _gcd(a, b) * b;
}

ll extgcd(ll a, ll b, ll& k, ll& l)
{
    if (b == 0)
    {
        k = 1; l = 0;
        return a;
    }
    ll res = extgcd(b, a % b, l, k);
    l -= a / b * k;
    return res;
}

ll _inv(ll a, ll p)
{
    return fastpow(a, p - 2, p);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = {sc.nextInt(), sc.nextInt(), sc.nextInt()};
        Arrays.sort(arr);
        System.out.println(arr[0]+arr[1]+arr[2]*10);
    }
}

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

int main() {
  int K;
  cin >> K;
  queue<ll> q;
  for (int i = 1; i < 10; i++) q.push(i);
  ll a;
  for (int i = 0; i < K; i++) {
    a = q.front(); q.pop();
    ll b = a % 10;
    ll c = a * 10;
    if (b != 0) q.push(c + b - 1);
    q.push(c + b);
    if (b != 9) q.push(c + b + 1);
  }
  cout << a << endl;
}


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

int main() {
  std::string S, T;

  std::cin >> S;
  std::cin >> T;

  int _s_o = -1, _t_o = -1, l = -1;
  int c;
  for (int t_o = 0, tmax = T.size(), smax = S.size(); t_o < tmax; t_o++) {
    for (int s_o = t_o; s_o + tmax - 1 < smax; s_o++) {
      c = 0;

      for (int i = 0; i + t_o < tmax; i++) {
        if (S[s_o + i] == T[t_o + i]) c++;
      }

      if (c > l) l = c;
    }
  }

  std::cout << (T.size() - l) << std::endl;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  cout << (s < t ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256