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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

#define deb(x) cout << '>' << #x << ':' << x << endl;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define END '\n'
#define inf 9e18
#define ff first
#define ss second
#define pb push_back

void solve(){
    int a, b;
    char c;
    cin >> a >> c >> b;
    cout << (c == '+' ? (a + b) : (a - b));

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

Measured memory_bytes: 3616
unittest
{
	assert( [ "1214", "4" ].parse.expand.solve == '2' );
	assert( [ "3", "157" ].parse.expand.solve == '3' );
	assert( [ "299792458", "9460730472580800" ].parse.expand.solve == '2' );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.strip;
	input.popFront;
	auto k = input.front.strip.to!( long );
	
	return tuple( s, k );
}

auto solve( in string s, in long k )
{
	foreach( i; 0 .. k + 1 )
	{
		if( '1' == s[ i ] )
		{
			if( k - 1 <= i ) return s[ i ];
		}
		else
		{
			return s[ i ];
		}
	}
	
	assert( false );		// 制約上ここには来ない
}


Measured memory_bytes: 256
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
#import math

def main():
    n = int(input())
    if n%2 == 0:print(int(n/2)) 
    else: print(int(n/2)+1)


    
if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,ans;
    cin >> n >> m;
    vector<vector<int>> ks(m);
    for(int i=0;i<m;i++){
        int k;
        cin >>k;
        ks[i].resize(k);
        for(int j=0;j<k;j++){
            cin >> ks[i][j];
            ks[i][j]--;
        }
    }
    
    vector<int> p(m);
    for(int i=0;i<m;i++) cin >> p[i];
    
    for (int i=0;i<(1<<n);i++) {
        bool ok = true;
        for (int j=0;j<m;j++){
            int count=0;
            for(int num : ks[j]){
                if((i>>num)&1) count++;
            }
            count%=2;
            if(count!=p[j]) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n; cin >> n;
    ll ans=0;
    rep(i,n){
        ll a; cin >> a;
        while(a%2==0){
            a/=2;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

class Union_find():
    
    def __init__(self,n):
        self.n=n
        self.root=[-1]*(n+1)
        self.rank=[0]*(n+1)

    def find_root(self,x):# 頂点xのroot(根)頂点を見つける
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.find_root(self.root[x])
            return self.root[x]

    def unite(self,x,y):#頂点xと頂点yを繋ぐ辺を追加
        x=self.find_root(x)
        y=self.find_root(y)

        if x==y:
            return 
        elif self.rank[x]>self.rank[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def same(self,x,y):#頂点xと頂点yが連結であるか判定
        return self.find_root(x)==self.find_root(y)

    def count(self,x):#頂点xが属する木のサイズ
        return -self.root[self.find_root(x)]

n,m=map(int,input().split())
gragh=Union_find(n+1)
for i in range(m):
    a,b=map(int,input().split())
    gragh.unite(a,b)
q=int(input())
for i in range(q):
    s,t=map(int,input().split())
    print("yes" if gragh.same(s,t) else "no")


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

int main(void){
  long long int n, m;
  long long int a;
  scanf("%lld %lld", &n, &m);
  a = m/n;
  long long int i;
  for(i=a;i>0;i--){
    if(m%i==0){
      printf("%lld\n", i);
      i=0;
    }
  }

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
  int N, W, w[201];
  long long dp[10001] = {};
  int sum = 0;

  cin >> N >> W;
  for(int i = 0; i < N; i++){
    cin >> w[i];
    sum += w[i];
  }
  sort( w, w + N, greater< int >());

  dp[0] = 1LL;
  /* えっ困惑 */
  long long ret = 0LL;
  long long mod = 1000000007LL;
  if(sum <= W) ret = 1LL;
  for(int i = 0; i < N; i++){
    sum -= w[i];
    for(int j = max( 0, W - sum - w[i] + 1); j <= W - sum; j++ ){
      ret = (ret + dp[j]) % mod;
    }
    for(int j = W - w[i]; j >= 0; j--){
      dp[j + w[i]] = (dp[j + w[i]] + dp[j]) % mod;
    }
  }

  cout << ret << endl;
}

Measured memory_bytes: 1256
#include <stdio.h>

int main(void) {
    int A, B;
    A = B = 0;

    scanf("%d", &A);
    scanf("%d", &B);

    if (A < 9 && B < 9) {
        printf("Yay!");
    } else {
        printf(":(");
    }

    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int mincnt = 1000000;
  //cout << s1;
  for(char i ='a';i<='z';i++){
    int cnt = 0;
    string s1 = s;
    string s2;
    while(true){
      bool flag = true;
      rep(j,s1.size()-1){
        if(s1.at(j) != i || s1.at(j+1) != i){
          flag = false;
        }
      }
      if(flag){
        break;
      }else{
        cnt++;
      }
      rep(j,s1.size()-1){
        if(s1.at(j)==i || s1.at(j+1)==i){
          s2.push_back(i);
        }else{
          s2.push_back('X');
        }
      }
      //cout << s2 << endl;
      s1 = s2;
      s2.clear();
    }
    if(cnt < mincnt){
      mincnt = cnt;
    }
  }
  cout << mincnt << endl;
 
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;
#[allow(dead_code)]
const MOD: i32 = 1000_000_007;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    #[allow(dead_code)]
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    #[allow(dead_code)]
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    #[allow(dead_code)]
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let mut is_prime: Vec<bool> = vec![true; 100001];
    is_prime[0] = false; is_prime[1] = false;
    for i in 0..is_prime.len() {
        if is_prime[i] {
            let mut j = i * 2;
            while j < is_prime.len() {
                is_prime[j] = false;
                j += i;
            }
        }
    }
    let mut acc_sum: Vec<i32> = vec![0; 100001];
    for i in 3..is_prime.len() {
        if is_prime[i] && is_prime[(i + 1) / 2] {
            acc_sum[i] += 1;
        }
        acc_sum[i] += acc_sum[i - 1];
    }

    let q: i32 = sc.read();
    for _i in 0..q {
        let l: usize = sc.read();
        let r: usize = sc.read();
        println!("{}", acc_sum[r] - acc_sum[l - 1]);
    }
}

Measured memory_bytes: 4732
a=int(input())
moji=input()
r=set()
g=set()
b=set()
for i in range(a):
    if moji[i]=="R":
        r.add(i)
    elif moji[i]=="G":
        g.add(i)
    else:
        b.add(i)
res=len(r)*len(g)*len(b)
if len(r)==0 or len(g)==0 or len(b)==0:
    print(0)
else:
    min_len={0:r,1:g,2:b}
    a1=[]
    for i in range(3):
        a1.append(min_len[i])
    for i in a1[0]:
      for j in a1[1]:
        if -abs(i-j)+min(i,j) in a1[2]:
          res-=1
        if abs(i-j)+max(i,j) in a1[2]:
          res-=1
        if abs(i-j)%2==0 and  int(abs(i-j)/2)+min(i,j) in a1[2]:
          res-=1
    print(res)
                
    


Measured memory_bytes: 9472
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int st, ed;
char s[200010];

int main()
{
    scanf("%s", s);
    int len = strlen(s);
    for(int i = 0; i < len; ++i)
        if(s[i] == 'A')
        {
            st = i;
            break;
        }
    for(int i = len - 1; i >= 0; --i)
        if(s[i] == 'Z')
        {
            ed = i;
            break;
        }
    cout << ed - st + 1;
    return 0;
}


Measured memory_bytes: 384
read n
read -a a
s=$((`echo ${a[@]} | tr ' ' '+'`))
md=$((s>a[0]*n?s-a[0]*n:a[0]*n-s))
mi=0
for i in `seq $((n-1))`
do
    v=${a[i]}
    d=$((s>v*n?s-v*n:v*n-s))
    if((d<md))
    then
        md=$d
        mi=$i
    fi
done
echo $mi


Measured memory_bytes: 3760
N, K = map(int, input().split())
A = list(map(int, input().split()))

mx = sum(map(lambda a: max(a, 0), A))

M = sum(map(lambda a: max(a, 0), A[:K]))
S = sum(A[:K])

ans = mx - M + max(0, S)

for l, r in zip(A, A[K:]):
    M -= max(l, 0)
    M += max(r, 0)
    S -= l
    S += r

    ans = max(ans, mx - M + max(S, 0))

print(ans)


Measured memory_bytes: 14388
def partition(A, p, r):
    x = A[r]
    i = p-1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i],A[j] = A[j],A[i]
    A[i+1],A[r] = A[r],A[i+1]
    return i+1


n = int(input())
A = list(map(int, input().split()))
index = partition(A, 0, n-1)
A[index] = f"[{A[index]}]"
print(*A)


Measured memory_bytes: 16404
#include <iostream>

int main(int argc, const char * argv[]) {
    int rooms[4][3][10] = {};
    int n;
    std::cin >> n;
    int b, f, r, v;
    for (int i = 0; i < n && std::cin >> b >> f >> r >> v; i++) {
        rooms[b - 1][f - 1][r - 1] += v;
    }
    for (b = 0; b < 4; b++) {
        for (f = 0; f < 3; f++) {
            for (r = 0; r < 10; r++) {
                std::cout << " " << rooms[b][f][r];
            }
            std::cout << std::endl;
        }
        if (b < 3) {
            std::cout << "####################" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#define shiharai 1000
using namespace std;
int main(){
    while(1){
        const int Zeni[6] = {500,100,50,10,5,1};
        int daikin = 0;
        int otsuri = 0;
        int Ozeni = 0;
        int i = 0;
        cin >> daikin;
        if(daikin == 0){
            break;
        }
        otsuri = shiharai - daikin;
        while(i < 6){
            while(otsuri >= Zeni[i]){
                Ozeni++;
                otsuri-=Zeni[i];
            }
            i++;
        }
        cout << Ozeni << endl;
    }
    return 0;
}

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

int main(){
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	long long ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a.at(i);
		if(a.at(i) > x){
			ans += a.at(i) - x;
			a.at(i) = x;
		}
	}
	for(int i = 1; i < n; i++){
		if(a.at(i - 1) + a.at(i) < x){
			continue;
		}
		else if(a.at(i) == x){
			ans += a.at(i - 1);
			a.at(i) -= a.at(i - 1);
		}
		else{
			if(a.at(i - 1) == x){
				ans += a.at(i);
				a.at(i) = 0;
			}
			else{
				ans += a.at(i - 1) + a.at(i) - x;
				a.at(i) = x - a.at(i - 1);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2] && s[2] == s[3]) return !(cout << "No");
  if(s[0] == s[1] && s[2] == s[3]) cout << "Yes";
  else if(s[0] == s[2] && s[1] == s[3]) cout << "Yes";
  else if(s[0] == s[3] && s[1] == s[2]) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
const int MAXN=100000+5;
bool similar[MAXN];int pfxsum[MAXN];
bool IsPrime(int x)
{
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0) return 0;
	return 1;
}
void Init()
{
	for(int i=3;i<=100000;i+=2)
	{
		if(IsPrime(i)&&IsPrime((i+1)/2)) similar[i]=1;
//		if(i<=7) printf("%d",similar[i]);
	}
	for(int i=1;i<=100000;i++)
		pfxsum[i]=pfxsum[i-1]+similar[i];
}
int main()
{
	Init();
	int n,x,y;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&x,&y);
		printf("%d\n",pfxsum[y]-pfxsum[x-1]);
	}
	return 0;
}


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

int main(){
	int mountain[10], first=0, second=0, third=0;
	for(int j=0; j<10; j++){
		mountain[j]=0;
	}

	for(int i=0; i<10; i++){
		cin >> mountain[i];
		if(first <= mountain[i]){
			third = second;
			second = first;			
			first = mountain[i];
		}
		else if(mountain[i]<=first && mountain[i]>=second){
			third = second;
			second = mountain[i];
		}
		else if(mountain[i]<=second && mountain[i]>=third){
			third = mountain[i];
		}
	}
	cout << first << "\n" << second << "\n" << third << endl;

	return 0;
}

Measured memory_bytes: 1164
/*input
2 10
20 20
*/
#include <bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long a[1000005],n;

int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	long long q,m,k,h,ans=0,sum=0,p,x,y;
	cin>>n>>x;
	for(int i=1;i<=n;++i){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		x -= a[i];
		if(x>=0) ans = i;
	}
	if(ans == n) ans -= (x!=0);
	cout<<ans;
}

Measured memory_bytes: 256
""" AtCoder """

W, H, N = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(N)]

w = 0
h = 0

for i in range(N):
    if xya[i][2] == 1:
        if w < xya[i][0]:
            w = xya[i][0]
    elif xya[i][2] == 2:
        if W > xya[i][0]:
            W = xya[i][0]
    elif xya[i][2] == 3:
        if h < xya[i][1]:
            h = xya[i][1]
    else:
        if H > xya[i][1]:
            H = xya[i][1]

ans = (H - h) * (W - w)

if H - h < 0 or W - w < 0:
    print(0)
else:
    print(ans)


Measured memory_bytes: 3064
// 単一始点最短経路 ( ダイクストラ法 )
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

static const int MAX = 100;
static const int INFTY = (1 <<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int Dijkstra()
{
    int u, minv;
    int d[MAX], p[MAX], color[MAX];

    for(int i = 0; i < n; i++)
    {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    // 初期値の設定
    d[0] = 0;
    color[0] = GRAY;

    while(1)
    {
        minv = INFTY;
        // 次に移動するべき頂点
        u = -1;

        for(int i = 0; i < n; i++)
        {
            if( minv > d[i] && color[i] != BLACK )
            {
                // 未訪問の頂点の中で, 最小のコストを持つ辺を探索する
                u = i;
                minv = d[i];
            }
        }

        if( u == -1 )
        {
            // 最初全域木が完成した
            break;
        }

        color[u] = BLACK;

        for(int v = 0; v < n; v++)
        {
            if( color[v] != BLACK && M[u][v] != INFTY )
            {
                // u → v の辺の中で, 最小コストの辺のコストを記録する
                if( d[v] > d[u] + M[u][v] )
                {
                    // コストの記録
                    d[v] = d[u] + M[u][v];
                    // 頂点 v の親を記録する
                    p[v] = u;
                    // 訪問状態の記録
                    color[v] = GRAY;
                }
            }
        }
    }

    /*
    int sum = 0;

    for(int i = 0; i < n; i++)
    {
        if( p[i] != -1 )
        {
            // 最小コストの辺の和を求める
            sum += M[i][p[i]];
        }
    }
    */

    for(int i = 0; i < n; i++)
    {
        cout << i << " " << ( d[i] == INFTY ? -1 : d[i] ) << endl;
    }

    return 0;
}

int main(void)
{

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            // 配列の初期化
            M[i][j] = INFTY;
        }
    }

    int k, c, u, v;

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

        for(int j = 0; j < k; j++)
        {
            cin >> v >> c;

            M[u][v] = c;
        }
    }

    Dijkstra();

    return 0;

}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=200010;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,k;
int a[N],ans;
int main()
{
	int x;
	file();
	read(n),read(k);
	For(i,1,n)read(x),a[x]++;
	sort(a+1,a+n+1);
	For(i,1,n-k)ans+=a[i];
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int getSum(int X) {
    int res = 0;
    while (X) {
        res += X % 10;
        X /= 10;
    }
    return res;
}

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

    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    for (int n = 1; n <= N; ++n) {
        int x = getSum(n);
        if (A <= x && x <= B) {
            ans += n;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define scan(a,n) for(long int index=0;index<n;index++) cin>>a[index];
#define print(a,n) for(long int index=0;index<n;index++) cout<<a[index]<<" ";cout<<endl;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define vli vector<long long int>
#define vlli vector<pair<long long int,long long int>>
#define vsi vector<string>
#define vci vector<char>


 
int main() {
   #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    fast;
    string s;
    cin>>s;
    ll n=s.length();
    ll i,ans=0,x;
    for(i=0;i<n;i++){
      x=s[i]-48;
      ans+=x;
    }
    if(ans%9==0) cout<<"Yes";
    else cout<<"No";

return 0;    
 }  

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint a, b, c, d; cin >> a >> b >> c >> d;
  lint e = c * d / __gcd(c, d);
  auto fn = [&](lint x) -> lint {
    return x - x / c - x / d + x / e;
  };
  cout << fn(b) - fn(a - 1) << '\n';
}

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Set<String> gift = new HashSet<>();

		int N=scan.nextInt();

		for(int i = 0;i < N;i++) {
			gift.add(scan.next());
		}

		System.out.println(gift.size());

	}
}


Measured memory_bytes: 66968
n = str(input())

apple = []



for i in n:
    if i == "1":
        i = "9"
        apple.append(i)
    elif i == "9":
        i = "1"
        apple.append(i)
    else:
        apple.append(i)

count = 0
m = 0
for i in apple:
    i = int(i)
    if count == 0:
        i *= 100
        m += i
        count += 1
    elif count == 1:
        i *= 10
        m += i
        count += 1
    elif count == 2:
        m += i

print(m)

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF INT_MAX/3
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cout<<#x<<":"<<x<<endl
#define debug2(x,y) cout<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& vec){
    os << "[";
    for(const auto& v : vec){
        os << v << ",";
    }
    os << "]";
    return os;
}

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define MAX_N 200002

const ll MOD = 1e9+7;
ll fact[MAX_N];
ll fact_inv[MAX_N];

ll mod_pow(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;
}

ll invp(ll x,ll mod){
    return mod_pow(x,mod-2,mod);
}

ll nCr(ll n,ll r,ll mod){
    ll ret = fact[n];
    ret = (ret * fact_inv[r]) % mod;
    ret = (ret * fact_inv[n-r]) % mod;
    return ret;
}

void init(){
    fact[0]=1;
    for(int i=1;i<MAX_N;i++) fact[i]=(fact[i-1]*i)%MOD;
    for(int i=0;i<MAX_N;i++) fact_inv[i]=invp(fact[i],MOD);
}
int main(){
    ll H,W,A,B;
    cin>>H>>W>>A>>B;

    init();

    ll ans = 0;
    for(int i=B+1;i<=W;i++){
        int le = i-1;
        int hi = H-A-1;
        ll tmp1 = nCr(le+hi,hi,MOD);
        int ri = W-i;
        int un = A-1;
        ll tmp2 = nCr(ri+un,un,MOD);
        ll tmp = (tmp1 * tmp2) % MOD;
        ans = (ans+tmp) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;

struct UnionFind {
    static constexpr int M = 1 << 30;
    UnionFind(int n) : p(n, -1), r(n) {}
    int root(int u) {
        if (p[u] < 0) return u;
        int v = p[u] & ~M, m = p[u] & M;
        return p[u] = root(v) ^ m;
    }
    bool same(int u, int v) {
        return ((root(u) ^ root(v)) & ~M) == 0;
    }
    void unite(int u, int v) {
        u = root(u);
        v = root(v);
        if (((u ^ v) & ~M) == 0) {
            if (u == v) p[u & ~M] = -2; // 二部グラフでない
            return;
        }
        int m = (u & M) ^ (v & M) ^ M;
        u &= ~M; v &= ~M;
        if (r[u] > r[v]) swap(u, v);
        p[v] = min(p[u], p[v]);
        p[u] = v ^ m;
        r[v] += (r[u] == r[v]);
    }
    vector<int> p, r;
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--; v--;
        uf.unite(u, v);
    }

    int64_t k[3] = {};
    for (int i = 0; i < n; i++) {
        if (uf.p[i] < 0) k[(uf.r[i] > 0) + (uf.p[i] != -1)]++;
    }

    k[2] += k[1];
    int64_t r = k[0] * (n * 2 - k[0]) + k[2] * k[2] + k[1] * k[1];

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
using namespace std;

int main() {
	
	long long int A, B, C;
	cin >> A >> B >> C;
	
	int K;
	cin >> K;
	
	int ans = A + B + C;
	int maxi = max(max(A, B), C);
	ans -= maxi;
	
	for(int i = 0; i < K; i++){
		maxi *= 2;
	}
	
	cout << ans + maxi << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vi P(N);
	REP(i, N)cin >> P[i];
	int ans = 0;
	REP(i, N - 1) {
		if (i + 1 == P[i]) {
			swap(P[i], P[i + 1]);
			ans++;
		}
	}
	if (P[N - 1] == N)ans++;
	cout << ans << endl;
	PAU;
	return 0;
}


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

using namespace std;

int main(void) {

	int w, a, b;

	cin >> w >> a >> b;

	if (a > b)swap(a, b);

	cout << max(b - (a + w), 0) << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;
  int flag=0;
  if(S.at(0)==S.at(1) && S.at(2)==S.at(3) && S.at(0)!=S.at(2))flag++;
  else if(S.at(0)==S.at(2) && S.at(1)==S.at(3) && S.at(0)!=S.at(1))flag++;
  else if(S.at(0)==S.at(3) && S.at(1)==S.at(2) && S.at(0)!=S.at(1))flag++;
  
  if(flag==0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

#define INF 999999999

int main(){
	
	double ans[100001], dp[2][12], p[2][12];
	memset( ans, 0, sizeof(ans) );
	
	for(int i=0; i<=10; i++){
		p[1][i] = 1.0 / pow( 2, i );
		p[0][i] = 1.0 - p[1][i];
	}
	
	memset( dp, 0, sizeof(dp) );
	dp[1][1] = 1.0;
	
	for(int j = 1; j <= 100000; j++){
		//calc. ans
		ans[j] = ans[j-1];
		for(int z = 1; z <= 11; z++){
			ans[j] += dp[1][z];
		}
		//swap
		for(int x = 0; x <= 11; x++){
			dp[0][x] = dp[1][x];
			dp[1][x] = 0.0;
		}
		//dp
		for(int y = 0; y <= 10; y++){
			dp[1][0] += dp[0][y] * p[0][y];
			dp[1][y+1]+=dp[0][y] * p[1][y];
		}
		
	}
	
	int n;
	while(cin >> n, n){
		printf("%.3f\n", ans[n]);
	}
	
	return 0;
}

Measured memory_bytes: 2016
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


const int MAX_N=200010;
int n,dat[4*MAX_N-1];
int Seg_init(int n_){
    n=1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;++i)dat[i]=0;
    return n;
}
int Seg_calc(int a,int b){
    return (a+b)%3;
}
void Seg_update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=Seg_calc(dat[2*k+1],dat[2*k+2]);
    }
}
/*
int Seg_query(int a,int b,int k,int l,int r){
    cout << a MM b MM k MM l MM r << endl;
    //外からはSeg_query(a,b,0,0,n)で呼ぶ
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return dat[k];
    int vl=Seg_query(a,b,2*k+1,l,(l+r)/2);
    int vr=Seg_query(a,b,2*k+2,(l+r)/2,r);
    return Seg_calc(vl,vr);
}*/

int Seg_query(int a,int b){
    vector<pair<pair<int,int>,int>> G;
    G.push_back({{0,n},0});
    int R=0;
    
    while(!G.empty()){
        int l=G.back().first.first;
        int r=G.back().first.second;
        int k=G.back().second;
        //cout << l MM r MM k;
        G.pop_back();
        if(r<=a||b<=l)continue;
        if(a<=l&&r<=b){R=Seg_calc(R,dat[k]);continue;}
        G.push_back({{l,(l+r)/2},2*k+1});
        G.push_back({{(l+r)/2,r},2*k+2});
    }
    
    return R;
}
/*
int Seg_query(int a,int b){
    a += n;
    b += n;
    int R = 0;
    while(a < b){
        if(a % 2 == 1){
            R = Seg_calc(R, dat[a - 1]);
            a += 1;
        }
        a /= 2;
        if(b % 2 == 1){
            b -= 1;
            R = Seg_calc(R, dat[b - 1]);
        }
        b /= 2;
    }
    return R;
}*/

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

    string S,T;
    int Q;
    int A[114514],B[114514],C[114514],D[114514];
    int G[114514],H[114514];
    
    cin >> S >> T;
    cin >> Q;
    REP(i,Q){
        cin >> A[i] >> B[i] >> C[i] >> D[i];
        A[i]--;B[i]--;C[i]--;D[i]--;
    }
    
    //Aを1、Bを2、O(=AB)を0と扱う
    
    //Sをセグる
    Seg_init(S.size());
    REP(i,S.size()){
        Seg_update(i,(S[i]=='A'?1:2));
    }
    REP(i,Q){
        G[i]=Seg_query(A[i],B[i]+1);
    }
    //Tをセグる
    Seg_init(T.size());
    REP(i,T.size()){
        Seg_update(i,(T[i]=='A'?1:2));
    }
    REP(i,Q){
        H[i]=Seg_query(C[i],D[i]+1);
    }
    
    //REP(i,Q){cout << G[i] MM H[i] << endl;}
    
    REP(i,Q){
        if(G[i]==H[i]){
            cout << "YES" << '\n';
        }else{
            cout << "NO" << '\n';
        }
    }
    
    return 0;
}



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

int main()
{
  int x, r, y, W, H;

  cin >> W >> H >> x >> y >> r;

  if(x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H){
    cout << "Yes" << endl;
  }

  else cout << "No" << endl;

    return 0;

}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
#define print(var) cout<<var<<endl;
#define DEBUG(var) cerr<<var<<endl;
// puts("str");

const int inf = 1000000000;//10^9

int main (){
  string S;
  int K;
  cin >>S;
  cin >>K;
  rep(i,S.size()){
    if(S[i]!='a'&&('z'-S[i]+1<=K)){
      K-='z'-S[i]+1;
      S[i]='a';
    }
  }
  K=K%26;
  S[S.size()-1]+=K;
  if(S[S.size()-1]>'z'){
    S[S.size()-1]-=26;
  }
  print(S);


  return 0;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)

int const N = 2000, md = 998244353;
int dp[N + 1 << 1][N + 1 << 1];
char s[N + 1];

inline void ad(int &x, int y) { if ((x += y) >= md)x -= md; }

struct S{
	int r, b;
	S(){}
	S(int a, int y):r(a), b(y) {}
	S(char c){
		if (c == '0')r = 2, b = 0;
		else if (c == '1')r = 1, b = 1;
		else r = 0, b = 2;
	}
	S take(S const &o)const { return S(r - o.r, b - o.b); }
	void operator +=(S const &o){
		r += o.r;
		b += o.b;
	}
	bool ok(bool rd){
		if (rd)return r > 0;
		else return b > 0;
	}
}sn[N];

int main(){
	scanf("%s", s);
	int n = strlen(s);
	f(i, 0, n)sn[i] = S(s[i]);
	f(i, 1, n)sn[i] += sn[i - 1];
	dp[0][0] = 1;
	f(i, 0, n << 1 | 1)f(j, 0, n << 1 | 1)if (dp[i][j]){
		int z = min(n - 1, i + j);
		if (sn[z].take(S(i, j)).ok(true))ad(dp[i + 1][j], dp[i][j]);
		if (sn[z].take(S(i, j)).ok(false))ad(dp[i][j + 1], dp[i][j]);
	}
	int an = 0;
	n <<= 1;
	f(i, 0, n + 1)ad(an, dp[i][n - i]);
	printf("%d\n", an);
}

Measured memory_bytes: 60416
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef pair<int, int> P;
int main()
{
    ll N;
    string S;
    cin >> N >> S;
    vector<ll> alpha(26, 0);
    rep(i, N) alpha[S[i] - 'a']++;

    ll ans = 1;
    rep(i, 26) {
        ans *= alpha[i] + 1;
        ans %= MOD;
    }

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

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

s = list(input())
t = list(input())

N = len(s)
M = len(t)

s_d = sorted(s)
t_d = sorted(t, reverse=True)

ans ='No'
if N < M:
    new_t = "".join(t_d[:N])
    new_s = "".join(s_d)
    if new_t == new_s:
        ans ='Yes'

if ans == 'No':
    pos = 0
    for i in range(min(N, M)):
        if s_d[i]!=t_d[i]:
            pos = i
            break
    if s_d[pos] < t_d[pos]:
        ans ='Yes'

print(ans)

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

int main() {
    int N, M, L[100000], R[100000];
    cin >> N >> M;
    for(int i=0;i<M;i++) {
        cin >> L[i] >> R[i];
    }
    
    int l = L[0], r = R[0];
    for(int i=0;i<M;i++) {
        l = max(l, L[i]);
        r = min(r, R[i]);
    }
    
    if(r - l < 0) cout << 0 << endl;
    else cout << r - l +1 <<endl;
}

Measured memory_bytes: 1024
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 3e3;

int n;

int a[MAXN + 5];

vector<int> adj[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) a[i] = read<int>();
	for(int i = 1; i < n; ++i)
	{
		int u = read<int>(), v = read<int>();
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
}

inline int dfs(int u, int fa)
{
	for(auto v : adj[u]) if(v != fa && a[v] < a[u])
		if(dfs(v, u) == 0) return 1;
	return 0;
}

inline void solve()
{
	for(int i = 1; i <= n; ++i) if(dfs(i, 0)) printf("%d ", i);
	puts("");
}

int main()
{
#ifdef K_ON
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

class UnionFind {
public:
   ull size;
  vector<ull> par, rank;
    UnionFind() : size(0), par(vector<ull>(0)), rank(vector<ull>(0)) {};

    UnionFind(ull size) : size(size) {
	par.resize(size);
	rank.resize(size);
        for (auto i = 0; i < size; i++) {
	    par[i] = i;
	    rank[i] = 0;
        }
    }

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

    bool isSameSet(ull x, ull y) {
	return root(x) == root(y);
    }

    void join(ull x, ull y) {
	ull xRoot = root(x);
	ull yRoot = root(y);
        if (xRoot == yRoot) return;
        if (rank[xRoot] < rank[yRoot]) {
	    par[xRoot] = yRoot;
        } else {
	    par[yRoot] = xRoot;
            if (rank[xRoot] == rank[yRoot]) {
		rank[xRoot]++;
            }
        }
    }

};

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  long long L;
  scanf("%lld", &L);
  int p, q, r, s;
  UnionFind roads(N+1);
  UnionFind rails(N+1);
  for (int i = 0; i < K; i++) {
      cin >> p >> q;
      roads.join(p, q);
  }
  for (int i = 0; i < L; i++) {
      cin >> r >> s;
      rails.join(r, s);
  }
  map<pair<ull, ull>, int> combined;
  for (int i = 1; i <= N; i++) {
      combined[{roads.root(i), rails.root(i)}]++;
  }
  for (int i = 1; i <= N; i++) {
      if (i != 1) cout << " ";
      cout << combined[{roads.root(i), rails.root(i)}];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 18048
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i = 0; i < (int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[10000];
	rep(i, n) {
		cin >> a[i];
	}
	int cnt = 0;
	rep(i, n) {
		while (a[i] % 2 == 0) {
			a[i] = a[i] / 2;
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 5;
const ld pi = 3.141592653;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

int dx[9]={1, -1, 0, 0, 1, 1, -1, -1, 0};
int dy[9]={0, 0, 1, -1, 1, -1, 1, -1, 0};

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1;
        //cin>>T;
        while(T--)
        {
                string s;
                cin>>s;
                int ans=0, i, j;
                for(i=0; i<sz(s); i++){
                        if(s[i]=='R'){
                                j = i;
                                int len = 0;
                                while(j<sz(s) && s[j]=='R') j++;
                                len = j - i;
                                ans = max(ans, len);
                                i = j-1;
                        }
                }
                cout<<ans;
        }
        return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	ll N;
	cin >> N;

	if (N % 2 == 1){
		cout << 0 << endl;
		return 0;
	}
	
	ll cnt = 0;
	ll flr = 10;
	while (flr <= N) {
		cnt += (ll)N / flr;
		flr *= 5;
	}

	cout << cnt << endl;

	return 0;

}

Measured memory_bytes: 256
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void main() {
    int n;
    const N = 100;
    while (readf("%d\n", &n), n) {
        int[][] g = new int[][N];
        foreach (i; 0 .. n) {
            int a, b; readf("%d %d\n", &a, &b);
            a--; b--;
            g[a] ~= b;
            g[b] ~= a;
        }

        bool[] used = new bool[N];
        int dfs(int c) {
            int ret = 1;
            foreach (next; g[c]) {
                if (used[next]) continue;
                used[next] = true;
                ret = max(ret, dfs(next) + 1);
                used[next] = false;
            }
            return ret;
        }

        bool[] p = new bool[N];
        void initP() {
            void dfs(int c, bool[] q) { // cと連結な頂点をqにマーク
                q[c] = true;
                foreach (next; g[c]) {
                    if (q[next]) continue;
                    dfs(next, q);
                }
            }
            // 連結していないグラフそれぞれについて次数が最小の頂点をpにマーク
            bool[] used2 = new bool[N];
            foreach (i; 0 .. N) { 
                if (used2[i]) continue;
                bool[] q = new bool[N];
                dfs(i, q);
                ulong m = N;
                foreach (j; 0 .. N) {
                    if (q[j]) {
                        used2[j] = true;
                        m = min(m, g[j].length);
                    }
                }
                foreach (j; 0 .. N) {
                    if (m == g[j].length) p[j] = true;
                }
            }
        }

        initP;
        int ans = 0;
        foreach (i; 0 .. N) {
            if (p[i]) {
                used[i] = true;
                ans = max(ans, dfs(i));
                used[i] = false;
            }
        }
        ans.writeln;
    }
}

Measured memory_bytes: 1072
#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++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    string s,t; cin >> s >> t;
    ll n = s.size();
    bool flag = true;
    rep(i,n){
        if(s[i] != t[i]) flag = false;
    }
    Ans(flag);
    return 0;
}

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

int a;

int main()
{
	cin>>a;
    if(a==22)
        cout<<"Christmas Eve Eve Eve";
    else if(a==23)
        cout<<"Christmas Eve Eve";
    else if(a==24)
        cout<<"Christmas Eve";
    else
        cout<<"Christmas";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <utility>
#define maxn 100005
#define maxm 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
inline int getint(){
  char c; int sig = 1,res = 0;
  for(c = getchar();c < '0' || c > '9';c = getchar()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return sig * res;
}
int siz[maxn],par[maxn],n,m;
ll ans;
void ini(int x){
  for(int i = 1;i <= x;i++){
    par[i] = i;
    siz[i] = 1;
  }
}
int fin(int x){
  if(par[x] == x) return x;
  return par[x] = fin(par[x]);
}
void uni(int u,int v){
  u = fin(u), v = fin(v);
  if(u == v) return;
  par[u] = v;
  ans -= siz[u] * siz[v];
  siz[v] += siz[u];
  siz[u] = 0;
}
int u[maxm],v[maxm];
ll res[maxm];
int main(){
  n = getint(), m = getint();
  for(int i = 1;i <= m;i++){
    u[i] = getint(), v[i] = getint();
  }
  ans = (ll)n * (n - 1) >> 1;
  ini(n);
  for(int i = m;i >= 1;i--){
    res[i] = ans;
    uni(u[i],v[i]);
  }
  for(int i = 1;i <= m;i++){
    printf("%lld\n",res[i]);
  }
  return 0;
}

Measured memory_bytes: 3712
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b; cin >> a >> b;
  if (b == 1) {
    cout << 0 << '\n';
    return 0;
  }
  int kuchi = a, ans = 1;
  while (kuchi < b) {
    kuchi += a - 1;
    ++ans;
  }
  cout << ans << '\n';
  return 0;
}


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

bool isSquare(ll x){
	long double sq = sqrt(x*1.0);
	return (sq - floor(sq))==0;
}

int main(){
	IO;
	ll n,d,ans=0,cnt;
	cin>>n>>d;
	ll x [n][d];
	forn(i,n){
		forn(j,d){
			cin>>x[i][j];
		}
		forn(j,i){
			cnt = 0;
			forn(k,d){
				cnt+= pow(abs(x[i][k] - x[j][k]),2);
			}
			if(isSquare(cnt))ans++;
		}
	}
	cout<<ans<<"\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


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

int main(){
  int n;
  cin>>n;
  long long ans=1;
  vector<long> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
    if(v[i]==0){
      cout<<0;
      return 0;
    }
  }
  for(int i=0;i<n;i++){
    if(ans<=1000000000000000000/v[i]){
      ans*=v[i];
    }else{
      cout<<-1;
      return 0;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 4060