akhauriyash/Code-Regression huggingface dataset:
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let a = get!();
    let b = get!();
    
    let ans = std::cmp::max(
        a*b, std::cmp::max(a+b,a-b));
    println!("{}", ans);
}

Measured memory_bytes: 4352
//It is coded by ning_mew on 7.16
#include<bits/stdc++.h>
#define ls(x) (x*2)
#define rs(x) (x*2+1)
using namespace std;

const int maxn=2e5+7,inf=1e9+7;

int n,m,ans=0;
struct Opt{int l,r;}p[maxn];
struct Node{int lazy,maxx;}node[maxn*4];

bool cmp(const Opt &A,const Opt &B){return A.l<B.l;}
void pushdown(int num,int nl,int nr){
  if(!node[num].lazy)return;
  int lz=node[num].lazy; node[num].lazy=0;
  node[ls(num)].maxx+=lz;node[ls(num)].lazy+=lz;
  node[rs(num)].maxx+=lz;node[rs(num)].lazy+=lz;	
}
void update(int num){node[num].maxx=max(node[ls(num)].maxx,node[rs(num)].maxx);}
void build(int num,int nl,int nr){
  node[num].lazy=0; if(nl==nr){node[num].maxx=nr-m-1;return;}
  int mid=(nl+nr)/2;
  build(ls(num),nl,mid);build(rs(num),mid+1,nr);
  update(num);
}
void add(int num,int nl,int nr,int ql,int qr,int ad){
  if(ql<=nl&&nr<=qr){node[num].maxx+=ad;node[num].lazy+=ad;return;}
  if(nr<ql||qr<nl)return;
  int mid=(nl+nr)/2;pushdown(num,nl,nr);
  add(ls(num),nl,mid,ql,qr,ad);add(rs(num),mid+1,nr,ql,qr,ad);
  update(num);return;
}
int quary(int num,int nl,int nr,int ql,int qr){
  if(ql<=nl&&nr<=qr)return node[num].maxx;
  if(nr<ql||qr<nl)return -inf;
  int mid=(nl+nr)/2;pushdown(num,nl,nr);
  return max(quary(ls(num),nl,mid,ql,qr),quary(rs(num),mid+1,nr,ql,qr));
}
int main(){
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++)scanf("%d%d",&p[i].l,&p[i].r);
  sort(p+1,p+n+1,cmp);p[n+1].l=inf;
  build(1,0,m+1);
  for(int i=1;i<=n;i++){
    add(1,0,m+1,0,p[i].r,1);
    if(p[i].l!=p[i+1].l&&p[i].l<=m-1)ans=max(ans,quary(1,0,m+1,p[i].l+2,m+1)-p[i].l);
  }ans=max(ans,n-m);printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 7936
let () = Scanf.scanf "%d\n" @@ fun n ->
  let sum = ref 0 in
  let cnt = Array.make 100001 0 in
  for i = 0 to n - 1 do
    Scanf.scanf "%d " @@ fun a ->
    sum := !sum + a;
    cnt.(a) <- cnt.(a) + 1
  done;
  Scanf.scanf "%d\n" @@ fun q ->
    for i = 0 to q - 1 do
      Scanf.scanf "%d %d\n" @@ fun b c ->
      sum := !sum + (c - b) * cnt.(b);
      cnt.(c) <- cnt.(c) + cnt.(b);
      cnt.(b) <- 0;
      Printf.printf "%d\n" !sum
    done;

Measured memory_bytes: 6780
#include <stdio.h>
int main () {
    int n ;
    int x = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        x = i;
        if ((x % 3) == 0) printf(" %d", x);
        else {
            while (x != 0) {
                if ((x % 10) == 3) {
                    printf(" %d", i);
                    break;
                }
                x = x / 10;
            }
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2056
INF = float('inf')
d, g = map(int, input().split())
data = []
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in targets:
    score = data[i][2]
    t = (total + score - 1) // score
    if t < data[i][0] and t < result:
      result = t
  for i in range(len(targets)):
    j = targets[i]
    p, c, score, subtotal = data[j]
    t = p + f(data, total - subtotal, targets[0:i] + targets[i + 1:])
    if t < result:
      result = t
  return result
print(f(data, g, list(range(len(data)))))


Measured memory_bytes: 50652
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[200010];
long long ax[200010],ah[200010];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++){
		ax[i+1]=ax[i]^a[i];
		ah[i+1]=ah[i]+a[i];
	} 
	long long res=0;
	for(int i=0;i<n;i++){
		int l=i,r=n-1;
		while(l!=r){
			int m=l+(r-l+1)/2;
			if((ah[m+1]-ah[i])==(ax[m+1]^ax[i]))
				l=m;
			else
				r=m-1;
		}
		res+=l-i+1;
	}
	cout<<res<<endl;
	return 0;
}


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

int main() {
	int n;
	int b_s=0;
	int a_e=0;
	int b_a=0;
	cin>>n;
	long long int ans=0;
	for(int i=0;i<n;i++){
		string temp;
		cin>>temp;
		for(int j=0;j<temp.size()-1;j++){
			if(temp[j]=='A' &&temp[j+1]=='B'){
				ans++;
			}
		}
		if(temp.back()=='A' &&temp[0]=='B') b_a++;
		else{
			if(temp.back()=='A') a_e++;
			if(temp[0]=='B') b_s++;
		}

	}
	int b_a_part=0;
	int kuso=0;
	if(b_a!=0){
		if(b_s==0 &&a_e==0){
			b_a_part=0;
			
		}else if(b_s==0 ||a_e==0) b_a_part=1;
		else{
		b_a_part=min(b_s ,a_e)+1;
		}
	kuso=max(0,b_a-1);
	}else{
		b_a_part=min(b_s,a_e);
	}
	//cout<<ans<<kuso<<b_a_part<<endl;
	cout<<ans+kuso+b_a_part<<endl;
	return 0;
}

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

struct Drzefko{
    vector <long long> D;
    int wlk;
    Drzefko(int N){
        wlk = 1;
        while (wlk < N){
            wlk *= 2;
        }
        D.resize(wlk*2, 0);
    }
    void Dodaj(int poz, long long val){
        // cerr << "Dodaje na poz " << poz << " val " << val << "\n";
        poz += wlk;
        
        D[poz] = val;
        while(poz > 0){
            // cerr << poz << "\n";
            poz /= 2;
            D[poz] = max(D[poz*2], D[poz*2+1]);
        }
    }
    long long MaksZPrzedzialu(int lew, int praw, int lw, int pw, int poz){
        if (lew <= lw && praw >= pw){
            return D[poz];
        }
        else if (praw < lw || lew > pw){
            return 0;
        }
        else{
            return max( MaksZPrzedzialu(lew, praw, lw, (lw+pw)/2, poz*2), 
                        MaksZPrzedzialu(lew, praw, (lw+pw)/2+1, pw, poz*2+1));
        }
    }

    long long Przedzial(int lew, int praw){
        return MaksZPrzedzialu(lew, praw, 0, wlk-1, 1);
    }
};
int main(){
    ios_base::sync_with_stdio(0);
    int N;
    cin >> N;
    vector <long long> V(N);
    vector <long long> A(N);
    for (int i = 0; i < N; i++){
        cin >> V[i];
    }
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    Drzefko Dr(N+1);
    Dr.Dodaj(V[0], A[0]);
    for (int i = 1; i < N; i++){
        // cerr << "Moja wysokosc " << V[i] << "\n";
        long long dod = Dr.Przedzial(0, V[i]);
        // cerr << "Maks na przedziale " << dod << "\n";
        Dr.Dodaj(V[i], dod+A[i]);
    }
    cout << Dr.Przedzial(0, N);
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  int zoro = 0;
  bool b = false;
  REP(i, N) {
    int a, c;
    cin >> a >> c;
    if (a == c) {
      zoro++;
    } else {
      zoro = 0;
    }
    if (zoro >= 3) b = true;
  }
  if (b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
typedef long long ll;
int n;
int x[110];
int main()
{
	scanf("%d",&n);
	ll ans=0x7fffffffffffffff;
	for(int i=1;i<=n;i++)
		scanf("%d",x+i);
	for(int i=1;i<=100;i++)
	{
		ll temp=0;
		for(int j=1;j<=n;j++)
		{
			temp+=(i-x[j])*(i-x[j]);
		}
		ans=std::min(ans,temp);
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int dp[3005][3005];

int main()
{
	string ans = "";
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < t.size(); i++)
	{
		for (int j = 0; j < s.size(); j++)
		{
			if (t[i] == s[j])
			{
				dp[i + 1][j + 1] = dp[i][j] + 1;
			}
			else
			{
				dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}
	}
	int i = t.size(), j = s.size();
	while (i > 0 && j > 0)
	{
		if (s[j - 1] == t[i - 1])
		{
			ans += s[j - 1];
			j--;
			i--;
		}
		else if (dp[i - 1][j] >= dp[i][j - 1] && i || !j)i--;
		else j--;
	}
	for (int i = ans.size() - 1; i >= 0; i--)
		cout << ans[i];
	return 0;
}

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

int main(){
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[]args)throws IOException{
		
		BufferedReader br=
			new BufferedReader(new InputStreamReader(System.in));
		
		String str=br.readLine();

		String[] num=str.split(" ");



		int a=Integer.parseInt(num[0]);
		int b=Integer.parseInt(num[1]);
		
		if(a<b){
			System.out.println("a < b");
		}
		else if(a>b){
			System.out.println("a > b");
		}
		else{
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 24448
import Control.Applicative
import Control.Monad as M

solve :: [Int] -> [Int] -> Int
solve values costs = sum $ filter (\n -> n > 0) $ subValuesCosts values costs

subValuesCosts :: Num a => [a] -> [a] -> [a]
subValuesCosts [] ys          = map negate ys
subValuesCosts xs []          = xs
subValuesCosts (x:xs) (y:ys)  = (x-y) : subValuesCosts xs ys

main :: IO ()
main = do
  _ <- getLine
  values <- map read . words <$> getLine
  costs <- map read . words <$> getLine
  putStrLn $ show $ solve values costs




Measured memory_bytes: 636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int first = 1;
		for (int i = 0; i < n; i++) {
			if (first*2 >= first + k) {
				first += k;
			} else {
				first *=  2;
			}
		}
		System.out.println(first);
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=110;
char s[maxn][maxn];
int h,w;

int main()
{
    //freopen("1.txt","r",stdin);
    while (scanf("%d%d",&h,&w)!=EOF)
    {
        memset(s,0,sizeof(s));
        for (int i=0;i<h;i++) scanf("%s",s[i]);
        for (int i=0;i<h;i++)
        {
            if (s[i][0]=='.')
            {
                bool f=true;
                for (int j=0;j<w;j++)
                {
                    if (s[i][j]==0) continue;
                    if (s[i][j]!='.')
                    {
                        f=false;
                        break;
                    }
                }

                if (f) for (int j=0;j<w;j++) s[i][j]=0;
            }
        }

        for (int i=0;i<w;i++)
        {
            if (s[0][i]=='.' || s[0][i]==0)
            {
                bool f=true;
                for (int j=0;j<h;j++)
                {
                    if (s[j][i]==0) continue;
                    if (s[j][i]!='.')
                    {
                        f=false;
                        break;
                    }
                }

                if (f) for (int j=0;j<h;j++) s[j][i]=0;
            }
        }

        for (int i=0;i<h;i++)
        {
            bool f=false;
            for (int j=0;j<w;j++)
                if (s[i][j]!=0)
                {
                    printf("%c",s[i][j]);
                    f=true;
                }
            if (f) puts("");
        }
    }
    return 0;
}



Measured memory_bytes: 128
w,h,x,y=map(int, input().split()) 

if w == h:
    if x==w/2 and y==h/2:
        print(w*h*0.5, 1)
    else:
        print(w*h*0.5, 0)
else:
    if x==w/2 and y==h/2:
        print(w*h*0.5, 1)
    else:
        print(w*h*0.5, 0)

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

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
            int ret;
            for (ret = 0; x[0] <= x[1]; x[0] *= 2) ret++;
            Console.WriteLine(ret);
        }
    }
}

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

void bar1(int w){
    for(int i=0; i<w; i++)
        cout << '#';
    cout << endl;
}

void bar2(int w){
    cout << '#';
    for(int i=0;i<(w-2); i++)
        cout << '.';
    cout << '#' << endl;
}

int main(void){
    // Your code here!
    int H, W;
    while(true){
        cin >> H >> W;
        if(H==0 && W == 0)
            break;
        bar1(W);
        for(int i=0; i<(H-2); i++)
            bar2(W);
        bar1(W);
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                     \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
typedef long long ll;
/**
 * Uncomment the #define below if problem contains multiple test cases
 */
// #define MULTIPLE_TESTS 1

template <typename T>
inline void readArray(vector<T>& arr, int n) {
  arr.resize(n);
  for (auto& element : arr) {
    cin >> element;
  }
}

void solve() {
  int n;
  cin >> n;
  vector<int> h;
  readArray(h, n);
  vector<int> cost(n);
  cost[n - 1] = 0;
  cost[n - 2] = abs(h[n - 1] - h[n - 2]);
  for (int i = n - 3; i >= 0; --i) {
    cost[i] = cost[i + 1] + abs(h[i] - h[i + 1]);
    cost[i] = min(cost[i], cost[i + 2] + abs(h[i] - h[i + 2]));
  }
  cout << cost[0] << endl;
}

int main() {
  FAST_IO;
  int t = 1;
#ifdef MULTIPLE_TESTS
  cin >> t;
#endif

  while (t--) {
    solve();
  }

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
/*
void solver(){

}*/

int main(){

/*    int t;
    cin >> t;
    while(t--){
        solver();
    }
*/

    char a;
    cin >> a;
    if(isupper(a))
       cout << "A";
       else
        cout << "a";
    return 0;
}


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

using namespace std;

typedef long long ll;

const int mod = 1000000007;

ll fact[100010];        // 階乗(%mod)
ll ifact[100010];       // 階乗の逆元(%mod)
vector<int> edge[100005];       // 点indexから出る辺の端点
ll ans = 1;
int K;

// 繰り返し二乗法(ここでは階乗の逆元を求めるときに用いる)
ll mod_pow(ll x, int n);
// 深さ優先探索(子ノード, 親ノード)     v=根のとき、p=-1
void dfs(int v, int p = -1);
// n P k の値を返す関数
ll f(int n, int k);

int main(){
    int N;
    cin >> N >> K;
    // 0-indexed
    for(int i = 0; i < N - 1; ++i){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    
    // for(int i = 0; i < N; ++i){
    //     cout << "start=" << i << endl;
    //     for(int j = 0; j < edge[i].size(); ++j){
    //         cout << "edge[" << i << "][" << j << "]=" << edge[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    
    // 階乗とその逆元を求めたテーブルの作成
    fact[0] = 1;
    for(int i = 1; i <= K + 1; ++i){
        fact[i] = (fact[i - 1] * i) % mod;
    }
    // ifact[N] = fact[N]^mod-2
    ifact[K + 1] = mod_pow(fact[K + 1], mod - 2);
    // -1乗が逆元を表すものとすると
    // 「ifact[N] = 1^-1 * 2^-1 * ... * (N - 1)^-1 * N^-1」より、
    // 「ifact[N - 1] = ifact[N] * N = 1^-1 * 2^-1 * ... * (N - 1)^-1」
    // ∴ 順に適応していくと、ifact[i - 1] = ifact[i] * i の関係がある
    for(int i = K + 1; i >= 1; --i){
        ifact[i - 1] = (ifact[i] * i) % mod;
    }
    
    dfs(0);
    cout << ans << endl;
}

ll mod_pow(ll x, int n){
    if(n == 0)      return 1;
    ll res = 1;
    while(n > 0){
        if(n & 1)   res = res * x % mod;    // bitが立っていればresにx^(2^i)を掛ける
        x = (x * x) % mod;                  // bitが立っているかに関わらずxを順次二乗していく
        n >>= 1;
    }
    return res;
}

void dfs(int v, int p){
    for(int u : edge[v]){
        // 親に返ってしまうときはcontinue
        if(u == p)     continue;
        
        dfs(u, v);
    }
    
    // この点における場合の数(nPk)の計算(再帰の前に計算でもよい(?))
    int nk = (p == -1) ? K : K - 2;
    int c = (p == -1) ? edge[v].size() + 1 : edge[v].size() - 1;
    // nk色からc色取る順列をansに掛ける
    ans *= f(nk, c);
    ans %= mod;
    
    // cout << "fact[" << nk <<"]=" << fact[nk] << " ifact[" << c << "]=" << ifact[c] << " ";
    // cout << " f(nk,c)=";
    // cout << f(nk, c) << " ans=";
    // cout << ans << endl;
}

ll f(int n, int k){
    if(k < 0 || k > n || n < 0)       return 0;
    ll res = (fact[n] * ifact[n - k]) % mod;
    return res;
}

Measured memory_bytes: 9216
n=int(input())
a=list(map(int,input().split()))
s=[0]
for i in range(n):
    s.append(a[i]+s[i])
s.sort()
ans=0
c=1
for i in range(1,n+1):
    if s[i]==s[i-1]:
        c+=1
    else:
        ans+=c*(c-1)//2
        c=1
ans+=c*(c-1)//2
print(ans)


Measured memory_bytes: 100944
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  double n;
  cin >> n;
  printf("%.12f\n", pow(n / 3, 3));
}

Measured memory_bytes: 4160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	string s;
	cin >> s;
	long long now=0;
	long long cnt=0;
	long long tmpcnt=0;
	long long lastbig=0;
	s='0'+s;
	for(long long i=1;i<s.size();i++)
	{
		//cout << s[i-1] << " " << s[i] << endl;

		if(s[i]=='<')
		{
			now++;
			tmpcnt=0;
			lastbig=now;
		}
		else if(s[i]=='>')
		{
			now=0;
			cnt+=(tmpcnt);
			if(tmpcnt>=lastbig)
				cnt+=1;
			tmpcnt++;
		}
		cnt+=now;
		//cout << cnt << endl;
	}

	cout << cnt << endl;





}

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

long long int mod=1e9+7;

int main(){
  long long int n,k;
  cin>>n>>k;
  vector<int> a(n);
  vector<long long int> puls(n+1,0);
  long long int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
    if(a[i]>=0){
      puls[i+1]=puls[i]+a[i];
    }else{
      puls[i+1]=puls[i];
    }
  }

  long long int ans=-1e18;
  long long int tmp=0;
  for(int i=0;i<k;i++)tmp+=a[i];
  ans=max(ans,tmp+(puls[n]-puls[k]));
  for(int i=k;i<n;i++){
    tmp-=a[i-k];
    tmp+=a[i];
    ans=max(ans,tmp+(puls[n]-puls[i+1]+puls[i-k]));
    ans=max(ans,(puls[n]-puls[i]+puls[i-k]));
    //cout<<puls[n]-puls[i+1]+puls[i-k]<<endl;
    //cout<<puls[n]<<" "<<puls[i+1]<<" "<<puls[i-k]<<endl;
  }
  if(ans<0)ans=0;
  cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    long long p = 1e9+7;
    cin>>n;
    vector<int >nos(n+1,0),temp(n+1,0);
    for(int i=1;i<=n;i++){cin>>temp[i];nos[i]= (nos[i-1]+temp[i])%p;}
    int ans=0;
    for(int i=2;i<=n;i++){
        ans = (ans + ((long long)temp[i]*(long long)nos[i-1])%p)%p;
    }
    cout<<ans;
    
}

Measured memory_bytes: 4836
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;

int main(){
  double PI = acos(-1);
  double r;
  cin >> r;
  cout << fixed << setprecision(6) << PI*r*r << " " << 2*PI*r << endl;
  return 0;
}


Measured memory_bytes: 3280
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
string s;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    cin>>s;
  	if (s.size()==3) swap(s[0],s[2]);
  	cout<<s;
}

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

int gcd_func(int a, int b){
    return b? gcd_func(b, a%b) : a;
} 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n; cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    while(n--){
        string ipt; cin >> ipt;
        if(ipt.compare("AC") == 0){
            ac++;
        }
        else if(ipt.compare("WA") == 0){
            wa++;
        }
        else if(ipt.compare("TLE") == 0){
            tle++;
        }
        else if(ipt.compare("RE") == 0){
            re++;
        }
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<set>
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>

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

using namespace std;

class union_find{
	vector<int> a;
public:
	union_find(int n):a(n,-1){}
	int find(int x){
		if(a[x]<0) return x;
		return a[x]=find(a[x]);
	}
	void unite(int x,int y){
		x=find(x),y=find(y);
		if(x!=y){ a[x]+=a[y]; a[y]=x; }
	}
	int size(int x){ return -a[find(x)]; }
};

int main(){
	for(int m,n1,n2;scanf("%d%d%d",&m,&n1,&n2),m+n1+n2;){
		int n=n1+n2;
		vector< pair<int,int> > yes,no;
		rep(i,m){
			int u,v;
			char s[4]; scanf("%d%d%s",&u,&v,s); u--; v--;
			if(s[0]=='y'){
				yes.push_back(make_pair(u,v));
			}
			else{
				no.push_back(make_pair(u,v));
			}
		}

		// yes でつながる人は同じグループ
		union_find U(n);
		rep(i,yes.size()){
			int u=yes[i].first,v=yes[i].second;
			U.unite(u,v);
		}

		int N=0,id[600],sz[600];
		{
			bool used[600]={};
			rep(u,n) if(!used[U.find(u)]) {
				used[U.find(u)]=true;
				id[U.find(u)]=N;
				sz[N++]=U.size(u);
			}
		}

		// no でつながる人は違うグループ
		vector<int> G[600];
		{
			set< pair<int,int> > used;
			rep(i,no.size()){
				int u=id[U.find(no[i].first)],v=id[U.find(no[i].second)];
				if(u>v) swap(u,v);
				if(used.count(make_pair(u,v))==0){
					used.insert(make_pair(u,v));
					G[u].push_back(v);
					G[v].push_back(u);
				}
			}
		}

		vector< pair<int,int> > num; // G の各連結成分に含まれる左の頂点, 右の頂点の個数
		vector< pair< vector<int>,vector<int> > > vs; // 具体的な頂点集合
		bool vis[600]={};
		rep(u,N) if(!vis[u]) {
			vis[u]=true;

			int L=0,R=0;
			vector<int> vl,vr;

			int Q[600],head=0,tail=0;
			Q[tail++]=2*u;
			while(head<tail){
				int v=Q[head]/2,parity=Q[head]%2; head++;

				if(parity==0) L+=sz[v], vl.push_back(v);
				else          R+=sz[v], vr.push_back(v);

				rep(i,G[v].size()){
					int w=G[v][i];
					if(!vis[w]){
						vis[w]=true;
						Q[tail++]=2*w+(1-parity);
					}
				}
			}

			num.push_back(make_pair(L,R));
			vs.push_back(make_pair(vl,vr));
		}

		// 左, 右の割り当てが唯一存在するか
		// dp[i+1][j] := ( num[i] まで見たとき, 左に j 個割り当てる方法が何通りあるか )
		static int dp[601][301],pre[601][301];
		memset(dp,0,sizeof dp);
		dp[0][0]=1;
		rep(i,num.size()){
			int L=num[i].first,R=num[i].second;
			rep(j,n1-L+1){ dp[i+1][j+L]=min(dp[i+1][j+L]+dp[i][j],2); if(dp[i][j]>0) pre[i+1][j+L]=i*1000000+j*1000+0; }
			rep(j,n1-R+1){ dp[i+1][j+R]=min(dp[i+1][j+R]+dp[i][j],2); if(dp[i][j]>0) pre[i+1][j+R]=i*1000000+j*1000+1; }
		}

		if(dp[num.size()][n1]!=1){
			puts("no");
			continue;
		}

		// 割り当てを復元
		vector<int> ans;
		{
			int i=num.size(),j=n1;
			while(i>0){
				int ii=pre[i][j]/1000000;
				int jj=pre[i][j]/1000%1000;
				int parity=pre[i][j]%2;

				if(parity==0){
					rep(k,vs[i-1].first.size()){
						rep(u,n) if(id[U.find(u)]==vs[i-1].first[k]) ans.push_back(u);
					}
				}
				else{
					rep(k,vs[i-1].second.size()){
						rep(u,n) if(id[U.find(u)]==vs[i-1].second[k]) ans.push_back(u);
					}
				}

				i=ii;
				j=jj;
			}
		}

		sort(ans.begin(),ans.end());

		rep(i,ans.size()) printf("%d\n",ans[i]+1);
		puts("end");
	}

	return 0;
}

Measured memory_bytes: 1996
#include <bits/stdc++.h>
using namespace std;
// #define LOCAL // 提出時はコメントアウト

typedef long long ll;
const double EPS = 1e-9;
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;

template<typename T, typename U>
using mapv = map<T,vector<U>>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define contains(S,x) find(ALL(S),x) != S.end()
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

///// For Debug

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#define DEBUG_

#ifndef LOCAL
#undef DEBUG_
#endif

#ifdef DEBUG_

#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)

#endif

//////////

int main() {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif

    ll N,W;
    cin >> N >> W;

    vecl w(N),v(N);
    rep(i,N) {
        cin>>w[i]>>v[i];
    }

    vector<vecl> dp(N+10,vecl(W+10,0));

    REP(i,1,N+1) {
        rep(j,W+1) {
            chmax(dp[i][j],dp[i-1][j]);
            if (0<=j-w[i-1]) chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }

    dump(dp);

    ll ans = 0;
    rep(j,W+1) {
        chmax(ans,dp[N][j]);
    }

    cout << ans << endl;

    return 0;
}


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

string s;
int K;

int main(){
  
  cin >> s >> K;
  
  int ans = 1;
  for(int i = 0; i < K; i++){
    if(s[i] != '1') {
      ans = s[i] - '0';
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rg register
using namespace std;
const int MAXN=4e5+10;
struct gao{   int u,v,w;   }Edge[MAXN<<1];
int n,Qs,Es,Bel[MAXN],Minv[MAXN];
ll Ans;
inline int Read()
{   rg int a=0,c=1;   rg char b=getchar();
	while(b!='-'&&(b<'0'||b>'9'))b=getchar();
	if(b=='-')c=-1,b=getchar();
	while(b>='0'&&b<='9')a=a*10+b-48,b=getchar();
	return a*c;
}
inline int Min(rg int A,rg int B){   return A<B?A:B;   }
inline int Max(rg int A,rg int B){   return A>B?A:B;   }
inline bool cmp(rg gao A,rg gao B){   return A.w<B.w;   }
inline int Find(rg int S){   return Bel[S]==S?S:Bel[S]=Find(Bel[S]);   }
inline void Merge(rg int A,rg int B){   A=Find(A),B=Find(B),Bel[A]=B;   }
int main()
{   memset(Minv,0X3f,sizeof(Minv));
	n=Read(),Qs=Read();
	for(rg int i=1,A,B,C;i<=Qs;i++)
		A=Read(),B=Read(),C=Read(),Minv[A]=Min(Minv[A],C+1),Minv[B]=Min(Minv[B],C+2),Edge[++Es]=(gao){A,B,C};
	for(rg int i=1;i<=2*n;i++) Minv[(i+1)%n]=Min(Minv[(i+1)%n],Minv[i%n]+2);
	for(rg int i=0;i<n;i++) Edge[++Es]=(gao){i,(i+1)%n,Minv[i]},Bel[i]=i;
	sort(Edge+1,Edge+Es+1,cmp);
	for(rg int i=1,A,B;i<=Es;i++) A=Find(Edge[i].u),B=Find(Edge[i].v),Ans+=Edge[i].w*(A!=B),Merge(A,B);
	printf("%lld\n",Ans);
}


Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
ll func(ll n)
{
    ll cnt=0;
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
            cnt++;
    }
    if(cnt>0)
        return func(n+1);
    if(cnt==0)
        return n;
}
int main()
{
     ll t;
     cin>>t;
     cout<<func(t)<<endl;
}




Measured memory_bytes: 256
N = int(input())
Alist = list(map(int,input().split()))
Answer = [0]*(N+1)
M = 0
for i in range(1,len(Alist)+1):
    A = Alist[-i]
    n = (N+1)-i
    if sum(Answer[n::n])%2 != A:
        Answer[-i] = 1
        M += 1
print(M)
Ans = []
for k in range(len(Answer)):
    if Answer[k] == 1:
        Ans.append(k)
print(*Ans[0:],end="\t")    

Measured memory_bytes: 20408
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
int lcm(int a, int b){
  return a / gcd(a,b) * b;
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n,m; cin >> n >> m;
  if(n==m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	char buf[99];
	int id, day, trade_last[10000]={0}, trade_this[10000]={0};
	while(fgets(buf, 99, stdin), buf[0] != '\n') {
		sscanf(buf, "%d,%d", &id, &day);
		trade_last[id] ++;
	}
	while(scanf("%d,%d", &id, &day)>0) {
		if(trade_last[id])
			trade_this[id] ++;
	}
	for(id=0; id<10000; id++) {
		if(trade_this[id])
			printf("%d %d\n", id, trade_last[id]+trade_this[id]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    int Max[maxn][30], lg[maxn];
    void solve() {
        int n, k, c;
        string s;
        cin >> n >> k >> c >> s;
        vector<int> p;
        int pos = 0;
        while (p.size() != k) {
            if (s[pos] == 'o') {
                p.push_back(pos);
                pos += c + 1;
            } else {
                pos++;
            }
        }
        lg[2] = 1;
        for (int i = 3; i < maxn; ++i)
            lg[i] = lg[i / 2] + 1;
        for (int i = 0; i < n; ++i) {
            if (s[i] == 'x')
                Max[i][0] = -1;
            else
                Max[i][0] = i;
        }
        for (int i = 1; i <= 20; ++i) {
            for (int j = 0; j + (1 << i) - 1 < n; ++j) {
                Max[j][i] = max(Max[j][i - 1], Max[j + (1 << (i - 1))][i - 1]);
            }
        }
        auto rmq = [&](int l, int r) {
            int s = lg[r - l + 1];
            return max(Max[l][s], Max[r + 1 - (1 << s)][s]);
        };
        vector<int> R(k), ans;
        R[k - 1] = rmq(p[k - 1], n - 1);
        if (R[k - 1] == p[k - 1])
            ans.push_back(p[k - 1]);
        for (int i = k - 2; i >= 0; --i) {
            R[i] = rmq(p[i], R[i + 1] - c - 1);
            if (R[i] == p[i])
                ans.push_back(p[i]);
        }
        sort(ans.begin(), ans.end());
        for (int i : ans)
            cout << i + 1 << " ";
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 28428
use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        c: Chars,
    }
    let mut rc = 0;
    for &ch in &c {
        if ch == 'R' {
            rc += 1;
        }
    }
    let mut cou = 0;
    for i in 0..rc {
        if c[i] == 'R' {
            cou += 1;
        }
    }
    println!("{}", rc - cou);
}


Measured memory_bytes: 3004
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;

#define rep(i,n,m) for(int i=n; i<=m; i++)
#define per(i,n,m) for(int i=n; i>=m; i--)
#define print(x) printf("%d ", x);
#define println(x) printf("%d\n", x);
#define printarray(a,n) for(int i=0; i<n-1; i++){printf("%d ", a[i]);} printf("%d\n", a[n-1]);
#define scan(x) scanf("%d", &x);
#define scanarray(a,n) for(int i=0; i<n; i++){scanf("%d", &a[i]);}

typedef struct {
    string name;
    int time;
} process;

int main() {
    int n, quantum;
    scan(n); scan(quantum);
    
    
    queue<process> p;
    rep(i,0,n-1) {
    	process a;
        cin >> a.name >> a.time;
    	p.push(a);
    }
    
    int nowtime = 0;
    while(p.size() != 0) {
        process a;
        a.name = p.front().name;
        a.time = p.front().time;
        p.pop();
        if(a.time <= quantum) {
            nowtime += a.time;
            cout << a.name << " " << nowtime << endl;
        } else {
            nowtime += quantum;
            a.time -= quantum;
            p.push(a);
        }
        
    }
	
    
    
    
    return 0;
}


Measured memory_bytes: 6376
MOD = 10**9 + 7
MAX = 2000 + 5
fac = [1 for _ in range(MAX)]
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD

def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return (fac[n] * pow(fac[k], MOD-2, MOD) % MOD) * pow(fac[n-k], MOD-2, MOD) % MOD

n, k = map(int, input().split())

for i in range(1, k+1):
    ans = comb(k-1, i-1) * comb(n-k+1, i) % MOD
    print(ans)


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

int main()
{
	#define int long long
	int n;
	cin>>n;
	int x;
	int temp=99999999999999;
	int cnt=0;
	for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x<=temp)
        {
        cnt++;
        temp=x;
        }
    }

    cout<<cnt;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
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;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

struct Dinic{
	struct Edge{int to,cap,rev;};
	vector<vector<Edge>>G;
	vector<int>level,iter;
	void addEdge(int from,int to,int cap){
		G[from].push_back({to,cap,len(G[to])});
		G[to].push_back({from,0,len(G[from])-1});
	}
	void bfs(int s){
		fill(all(level),-1);
		level[s]=0;
		queue<P>que;que.push({0,s});
		while(len(que)){
			P p=que.front();que.pop();
			if(level[p.second]<p.first)continue;
			for(Edge e:G[p.second]){
				if(e.cap>0&&level[e.to]==-1){
					level[e.to]=p.first+1;
					que.push({level[e.to],e.to});
				}
			}
		}
	}
	int dfs(int v,int t,int f){
		if(v==t)return f;
		for(int &i=iter[v];i<len(G[v]);i++){
			Edge &e=G[v][i];
			if(e.cap>0&&level[e.to]>level[v]){
				int d=dfs(e.to,t,min(f,e.cap));
				if(d>0){
					e.cap-=d;
					G[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	int maxFlow(int s,int t){
		int flow=0;
		while(1){
			bfs(s);
			if(level[t]<0)return flow;
			fill(all(iter),0);
			int f=0;
			while((f=dfs(s,t,mod))>0){
				flow+=f;
			}
		}
	}
	Dinic(int N):G(N),level(N),iter(N){}
};

int H,W;
char c[105][105];
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
char ans[105][105];
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>H>>W;
	Dinic F(H*W+2);
	rep(i,H)rep(j,W){
		cin>>c[i][j];ans[i][j]=c[i][j];
		if((i+j)%2)F.addEdge(H*W,i*W+j,1);
		else F.addEdge(i*W+j,H*W+1,1);
	}
	rep(i,H)rep(j,W)if((i+j)%2&&c[i][j]=='.')rep(k,4){
		int nx=i+dx[k],ny=j+dy[k];
		if(nx<0||ny<0||nx>=H||ny>=W||c[nx][ny]=='#')continue;
		F.addEdge(i*W+j,nx*W+ny,1);
	}
	cout<<F.maxFlow(H*W,H*W+1)<<"\n";
	rep(i,H){
		rep(j,W){
			if(c[i][j]=='#'||(i+j)%2==0)continue;
			for(auto e:F.G[i*W+j])if(e.cap==0&&e.to/W<H){
				if(e.to/W==i-1){ans[i][j]='^';ans[i-1][j]='v';}
				else if(e.to/W==i+1){ans[i][j]='v';ans[i+1][j]='^';}
				else if(e.to%W==j-1){ans[i][j]='<';ans[i][j-1]='>';}
				else {ans[i][j]='>';ans[i][j+1]='<';}
				break;
			}
		}
	}
	rep(i,H){rep(j,W)cout<<ans[i][j];cout<<"\n";}
}

Measured memory_bytes: 4844
#include<stdio.h>

int main(){
  int a,b,c,k,sum=0,max=0,i;
  scanf("%d %d %d",&a,&b,&c);
  scanf("%d",&k);
  sum=a+b+c;
  max=a;
  if(max<b) max=b;
  if(max<c) max=c;
  sum-=max;
  for(i=0;i<k;i++) max*=2;
  printf("%d\n",sum+max);
}

Measured memory_bytes: 128
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define endl "\n"
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    cini(a);
    cini(b);

    int ans=0;
    int s=1;
    while(s<b) {
        s+=(a-1);
        ans++;
    }

    cout<<ans<<endl;

}



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

using namespace std;

int main() {
  int H, W;
  
  cin >> H >> W;
  
  vector<vector<int>> matrix(H, vector<int>(W, 0));
  
  for (int i = 0; i < H; i++) {
    string S;
    
    cin >> S;
    
    for (int j = 0; j < W; j++) {
      matrix[i][j] = (S[j] == '#' ? 1 : 0);
    }
  }
  
  vector<vector<int>> U(H, vector<int>(W, 0));
  vector<vector<int>> D(H, vector<int>(W, 0));
  vector<vector<int>> L(H, vector<int>(W, 0));
  vector<vector<int>> R(H, vector<int>(W, 0));
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (matrix[i][j] == 1) {
        U[i][j] = 0;
        L[i][j] = 0;
        
        continue;
      }
      
      if (j == 0) {
        L[i][j] = 1;
      } else {
        L[i][j] = L[i][j - 1] + 1;
      }
      
      if (i == 0) {
        U[i][j] = 1;
      } else {
        U[i][j] = U[i - 1][j] + 1;
      }
    }
  }
  
  for (int i = H - 1; i >= 0; i--) {
    for (int j = W - 1; j >= 0; j--) {
      if (matrix[i][j] == 1) {
        D[i][j] = 0;
        R[i][j] = 0;
        
        continue;
      }
      
      if (j == W - 1) {
        R[i][j] = 1;
      } else {
        R[i][j] = R[i][j + 1] + 1;
      }
      
      if (i == H - 1) {
        D[i][j] = 1;
      } else {
        D[i][j] = D[i + 1][j] + 1;
      }
    }
  }
  
  int ans = -1;
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long n, long long m, std::vector<long long> p, std::vector<std::string> s){
    int clear=0,penalty=0;
    Vi ac(n,0),wa(n,0);
    REP(i,0,m){
        p[i]--;
//        cout<<p[i]<<" "<<s[i]<<" "<<ac[i]<<"   ";
        if(s[i]=="AC"){
            if(ac[p[i]]==0){
                ac[p[i]]++;
                clear++;
                penalty+=wa[p[i]];
            }
        }else if(s[i]=="WA"){
            if(ac[p[i]]==0){
                wa[p[i]]++;
            }
        }
    }
    cout<<clear<<" "<<penalty<<endl;
}

// 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)
signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}


Measured memory_bytes: 8064
# encoding: utf-8
L = int(input())

# length
for l_max in range(1, 21):
    if 2 ** l_max > L: break

# encode L - 2 ** (l_max - 1)
bits_sub = [None] * l_max
L_temp = L - 2 ** (l_max - 1)
for l in range(l_max):
    bits_sub[l] = L_temp % 2
    L_temp = L_temp // 2

# result
N = l_max
M = 2 * (l_max - 1) + sum(bits_sub)
print(N, M) # oh...

# main path
for i in range(l_max - 1):
    for j in range(2):
        print(i + 1, i + 2, j * (2 ** i))

# sub path
maxlen = 2 ** (l_max - 1)
for i, bit in enumerate(bits_sub):
    if bit == 0: continue
    for j in range(bit):
        print(i + 1, l_max, maxlen)
        maxlen += 2 ** i

Measured memory_bytes: 3064
/*{{{*/
#include <bits/stdc++.h>
#ifdef _GLIBCXX_DEBUG
int c_;
#define cout (c_?cerr:cout)
#define dbg(...) {if(!c_)cerr<<"\033[96;1m"; \
++c_; __VA_ARGS__; --c_; \
if (!c_)cerr<<<"\033[0m";}
#else
#define dbg(...)
#endif
#define st first
#define nd second
#define dprt(...) dbg(prt(__VA_ARGS__))
#define dmp(...) dprt(#__VA_ARGS__, __VA_ARGS__)
#define drprt(...) dbg(rprt(__VA_ARGS__))
#define rdmp(...) dbg(cerr<<#__VA_ARGS__<<": ";drprt(__VA_ARGS__))
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using ll = long long; using namespace std;
template< typename... t > using V = vector< t... >;
template< typename t > void prt(const t& a){cout<<a<<'\n';}
template< typename t, typename... v > void prt(const t& a, v&&... b)
{cout << a << ' '; prt(b...);}
template< typename t > void rprt(t a, const t& b)
{while(a!=b)cout<<(*a++)<<' ';cout << '\n';}
/*}}}*/



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

    int n; string s, t;
    cin >> n >> s >> t;

    for (int i = 0; i <= n; ++i)
        if (s.substr(i) == t.substr(0, n - i))
            return prt(2 * n - (n - i)), 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace _20190324
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = new Dictionary<char, char>
            {
                { 'A', 'T' },
                { 'T', 'A' },
                { 'C', 'G' },
                { 'G', 'C' }
            };
            var b = Console.ReadLine();
            Console.WriteLine(a[b[0]]);
        }
    }
}


Measured memory_bytes: 13152
#include<stdio.h>

int main()
{
    int n,swap,i,min,j,cont=0;
    int index=0;
    int arr[101];
    scanf("%d",&n);
    for(i=0;i<n;i++)
                    scanf("%d",&arr[i]);
    
    for(i=0;i<n;i++)
    {
                    min = i;
                    index = 0;
                    for(j=i;j<n;j++)
                    {
                                      if(arr[j] < arr[min])
                                      {
                                         min = j;  
                                         index=1;     
                                      }
                    }
                    if(index == 1)
                    cont = cont+1;
                    swap = arr[min];
                    arr[min] = arr[i];
                    arr[i] = swap;
    }
                    
    for(i=0;i<n;i++)
    {
                    if(i<n-1)
                    printf("%d ",arr[i]);
                    else
                    printf("%d\n",arr[i]);
    }
    printf("%d\n",cont);
    return 0;
}
    
    
    

Measured memory_bytes: 600
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    long a, b;
    scan(a, b);

    long d = b - a;
    long ha = (d - 1) * d / 2;
    writeln(ha - a);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
    int n; 
    double x, money = 0;
    char kind[5];
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        scanf("%lf%s[^\n]", &x, &kind);
        if(strcmp(kind, "JPY") == 0){
            money += x;
        }else{
            money += x * 380000.0;
        }
    }
    printf("%f\n", money);
    return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N = int(sys.stdin.readline())
P = list(map(int, sys.stdin.readline().split()))
P.insert(0, -1)

ans = 0
for i in range(len(P)):
    if i == P[i]:
        if i + 1 < len(P):
            P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)


Measured memory_bytes: 52892
import sys
from collections import defaultdict
input = sys.stdin.readline
N, M = map(int, input().split())
g = defaultdict(list)
for i in range(M):
  a, b = map(int, input().split())
  g[a].append(b)
  g[b].append(a)
que = [1]
ans = [0 for _ in range(N+1)]
while len(que)>0:
  current = que.pop(0)
  for next in g[current]:
    if ans[next] == 0:
      que.append(next)
      ans[next] = current
print('Yes')
for i in range(2,N+1):
  print(ans[i])
  

Measured memory_bytes: 38196