akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn main() {
  input! {
    s: chars,
  }
  let mut good = true;
  for i in 0 .. 3 {
    if s[i] == s[i+1] {
      good = false;
    }
  }
  if good {
    println!("Good");
  } else {
    println!("Bad");
  }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ans = 1;
		for(int i = 1 ; i <= n ; i++) {
			ans = ans * i % 1000000007;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;

int main(){
	int a,b,ans;
	cin >> a >> b;
	ans = (a-1)/(b*2+1)+1;
	cout << ans << endl;
}


Measured memory_bytes: 256
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  const mx=1_000_00+5;
  auto isPrime=new bool[](mx);
  auto sub=new int[](mx);

  isPrime[2]=true;
  for(int i=3; i<=1_000_00; i+=2){
    for(int j=3; j*j<=i; j+=2){
      if(i%j==0) goto hell;
    }
    isPrime[i]=true;
    if(isPrime[(i+1)/2]) sub[i]=1;
    hell:;
  }

  int[] a;
  for(int i=3; i<=1_000_00; i++)if(sub[i]) a~=i;
  int q; rd(q);
  while(q--){
    int l, r; rd(l, r);
    int cnt=0;
    foreach(e; a){
      if(l<=e && e<=r) cnt++;
    }
    writeln(cnt);
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,k; cin >> n >> k;
    set<int> people;
    FOR(i,k){
        int d; cin >> d;
        FOR(j,d){
            int a; cin >> a;
            people.insert(a);
        }
    }
    cout << n-people.size() << endl;
    return 0;
}



Measured memory_bytes: 3616
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String S = sc.nextLine();
    if(N%2 == 1){
      System.out.println("No");
      return;
    }
    
    String S1 = S.substring(0,N/2);
    String S2 = S.substring(N/2, N);
    if(S1.equals(S2)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
  
  char A[1210];
  char B[1210];
  int N[100]={0};
  int i;
  
  
  //fgets(A,sizeof(A),stdin);
  //printf("%s",A);
  
  while(scanf("%s",B) != EOF) strcat(A,B);
  
  for(i=0;i<strlen(A);i++){
    A[i] = tolower(A[i]);
    //printf("%c",A[i]);
    N[A[i]-'a'] += 1; 
  }
  
  for(i=0;i<26;i++){
  	printf("%c : %d\n",'a'+i,N[i]);
  }
  return 0;

  
}


Measured memory_bytes: 2056
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

bool dp[8010][40020];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int x, y;
    cin >> x >> y;
    dp[0][20000] = dp[1][20000] = true;
    vector<int> v;
    reverse(S.begin(), S.end());
    while(S.length()) {
        if(S.back() == 'T') {
            S.pop_back();
            break;
        }
        S.pop_back();
        x--;
    }
    int len = 0;
    while(S.length()) {
        if(S.back() == 'T') {
            v.push_back(len);
            len = 0;
        } else {
            len++;
        }
        S.pop_back();
    }
    if(len) v.push_back(len);
    rep(i, v.size()) {
        //if(v[i] == 0) continue;
        //cerr << i + 2 << " " << v[i] << endl;
        REP(j, -9000, 9000) {
            dp[i + 2][j + 20000 + v[i]] |= dp[i][j + 20000];
            dp[i + 2][j + 20000 - v[i]] |= dp[i][j + 20000];
        }
    }
    int n = v.size();
    //cerr << n << endl;
    if(n % 2 == 1) {
        if(dp[n][x + 20000] && dp[n + 1][y + 20000]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if(dp[n + 1][x + 20000] && dp[n][y + 20000]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

  
    return 0;
}
// TFF

Measured memory_bytes: 174796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (1e5) + 5;
const int MOD = 1e9 + 7;
vector<int> adj[N];
int memo[N][2];
int n;

int DP(int u, int color, int p) {
	int &ret = memo[u][color];
	if (ret != -1) return ret;
	ret = 1;
	int sz = adj[u].size();
	if (color == 0) {
		for (int i = 0; i < sz; ++i) {
			int v = adj[u][i];//
			if (v != p) {
				ret = (1LL * ret * ((DP(v, 0, u) + DP(v, 1, u)) % MOD)) % MOD;
			}
		}
	} else {
		for (int i = 0; i < sz; ++i) {
			int v = adj[u][i];//
			if (v != p) {
				ret = (1LL * ret * DP(v, 0, u)) % MOD;
			}
		}
	}
	return ret;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n - 1; ++i) {
		int u, v; scanf("%d %d", &u, &v);
		--u; --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	memset(memo, -1, sizeof memo);
	int ans = (DP(0, 0, -1) + DP(0, 1, -1)) % MOD;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 14848
#include <bits/stdc++.h>
using namespace std;
int main(){
 int a,b;
  cin>>a>>b;
  if(a==b){
  	for(int i=1;i<=a;i++){
    cout<<a;
    }
  }
  else if(a<b){
  for(int i=1;i<=b;i++){
  cout<<a;
  }
  }
  else{
  for(int i=1;i<=a;i++){
  cout<<b;
  }
  }
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define mp make_pair
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 61  //check the limits, man
const ll INF = 1e18;
ll dp[N][2][2];
int bit[N];
ll fun(int i,int mod,int ok)
{
    if(i==N)
        return ((!mod)&ok);
    if(dp[i][mod][ok]>=0)
        return dp[i][mod][ok];
    dp[i][mod][ok]=0;
    int a,b;
    rep(a,2)
    {
        rep(b,a+1)
        {
            int cur=((a+b+mod)&1);
            int nmod=(a+b+mod)/2;
            int nok=ok;
            if(bit[i]<cur)nok=0;
            if(bit[i]>cur)nok=1;
            dp[i][mod][ok]+=fun(i+1,nmod,nok);
        }
    }
    dp[i][mod][ok]%=M;
    return dp[i][mod][ok];
}
int main()
{
    ll n;
    cin >> n;
    int i;
    rep(i,N)
        bit[i]=(n&1),n/=2;
    rep(i,N)
        dp[i][0][0]=-1,dp[i][0][1]=-1,dp[i][1][0]=-1,dp[i][1][1]=-1;
    llout(fun(0,0,1));
}



Measured memory_bytes: 256
n=int(input())
#n,m=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import fractions
#gcd=fractions.gcd(a,b)#最大公約数

left=[0 for i in range(n)]
right=[0 for i in range(n)]
left[0]=al[0]
right[n-1]=al[n-1]

for i in range(1,n):
    left[i]=(fractions.gcd(al[i],left[i-1]))

for i in range(n-2,-1,-1):
    right[i]=fractions.gcd(al[i],right[i+1])
    
ansl=[]
#左端の値
ansl.append(right[1])
#右端の値
ansl.append(left[n-2])

for i in range(1,n-1):
    ansl.append(fractions.gcd(left[i-1],right[i+1]))
print(max(ansl))


Measured memory_bytes: 14428
package main

import (
	"fmt"
	"sort"
)

type restaurant struct {
	s     string
	p     int
	index int
}

type lessFunc func(r1, r2 *restaurant) bool

type multiSorter struct {
	restaurants []restaurant
	less        []lessFunc
}

func (ms *multiSorter) Sort(restaurants []restaurant) {
	ms.restaurants = restaurants
	sort.Sort(ms)
}

func orderedBy(less ...lessFunc) *multiSorter {
	return &multiSorter{
		less: less,
	}
}

func (ms *multiSorter) Len() int { return len(ms.restaurants) }
func (ms *multiSorter) Swap(i, j int) {
	ms.restaurants[i], ms.restaurants[j] = ms.restaurants[j], ms.restaurants[i]
}
func (ms *multiSorter) Less(i, j int) bool {
	p, q := &ms.restaurants[i], &ms.restaurants[j]
	var k int
	for k = 0; k < len(ms.less)-1; k++ {
		less := ms.less[k]
		switch {
		case less(p, q):
			return true
		case less(q, p):
			return false
		}
	}
	return ms.less[k](p, q)
}

func main() {
	city := func(r1, r2 *restaurant) bool {
		return r1.s < r2.s
	}
	point := func(r1, r2 *restaurant) bool {
		return r2.p < r1.p
	}

	var n int
	fmt.Scan(&n)

	restaurants := make([]restaurant, n)
	for i := range restaurants {
		fmt.Scan(&restaurants[i].s, &restaurants[i].p)
		restaurants[i].index = i + 1
	}

	orderedBy(city, point).Sort(restaurants)

	for _, r := range restaurants {
		fmt.Println(r.index)
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<string>
using namespace std;

struct Edge{
    int a,b,d;
    bool operator<(const Edge a)const{
        return d<a.d;
    }
};

int par[100],rank_[100];

void init(int n){
    for(int i=0;i<n;i++) par[i] = i, rank_[i] = 1;
}

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

bool unite(int _a,int _b){
    int a = find(_a), b = find(_b);
    if(a==b) return false;
    if(rank_[a]>rank_[b]) par[b] = a;
    else{
        par[a] = b;
        if(rank_[a]==rank_[b]) rank_[b]++;
    }
    return true;
}

int main(){
    int N,M;
    while(cin>>N,N){
        init(N);
        cin>>M;
        Edge e[10000];
        for(int i=0;i<M;i++) scanf("%d,%d,%d",&e[i].a,&e[i].b,&e[i].d);
        sort(e,e+M);
        int ans = 0;
        for(int i=0;i<M;i++){
            if(unite(e[i].a,e[i].b)){
                ans += e[i].d/100-1;
            }
        }
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 1312
until(s=gets.gsub(/\d+/){|k|?1*k.hex})[?#]
n=1+s.index(?/)
eval"s[n*c-n+e-1]=?1;s[n*g-n+i-1]=?bdfh".tr('c-i',gets)
$><<s.gsub(/1+/,&:size)
end

Measured memory_bytes: 8772
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define N 100005
#define inf 1e18
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll mod = 1e9+7;

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return (temp*temp)%mod;
    else
        return (((x*temp)%mod)*temp)%mod;
}


/* nCr % mod
ll fact[6*N];
ll inv[6*N],invfac[6*N];
ll mod = 998244353;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}*/

vector<ll> primes;

void Sieve(int n)
{
    vector<bool> prime(n+1,true);
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primes.push_back(p);
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 1e6 + 6;

bool done[Nmax];

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    string str;
    cin >> str;
    int r=0,w=0;
    for(int i=0;i<n;i++)
    {
        if(str[i] == 'R')
            r++;
        else 
            w++;
    }
    int ans = 0;
    for(int i=0;i<r;i++)
    {
        if(str[i] == 'W')
            ans++;
    }
    cout << ans;
}


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

using namespace std;

int larger(int x, int y){
	if(x > y){
		return x;
	}
	return y;
}

int main(){
	int Q;
	cin >> Q;
	for(int i = 0; i < Q; i++){
		string X, Y;
		cin >> X >> Y;
		int lenX = X.size();
		int lenY = Y.size();
		int dp[lenX+1][lenY+1];
		for(int j = 0; j <= lenX; j++){
			for(int k = 0; k <= lenY; k++){
				dp[j][k] = 0;
			}
		}
		for(int j = 0; j < lenX; j++){
			for(int k = 0; k < lenY; k++){
				if(X[j] == Y[k]){
					dp[j+1][k+1] = dp[j][k] + 1;
				}
				else{
					dp[j+1][k+1] = larger(dp[j+1][k], dp[j][k+1]);
				}
			}
		}
		cout << dp[lenX][lenY] << "\n";
	}
}



Measured memory_bytes: 7068
#include <iostream>
#include <vector>
#include <numeric>
#include <functional>

using namespace std;

void DFS(int start, const vector<vector<int>>& g, int& count, vector<bool>& visited){
    visited[start] = true;
    if (accumulate(visited.begin(), visited.end(), 1, multiplies<int>())){
        count += 1;
    }
    else{
        for (int i = 0; i < g.size(); ++i){
            if (g[start][i] == 1 && !visited[i]){
                visited[i] = true;
                DFS(i, g, count, visited);
                visited[i] = false;
            }   
        }
    }

    return;
}

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

    int N, M, a, b;
    cin >> N >> M;
    
    vector<vector<int>> g(N, vector<int>(N, 0));
    for (int i = 0; i < M; ++i){
        cin >> a >> b;
        g[a-1][b-1] = 1;
        g[b-1][a-1] = 1;
    }

    int count = 0;
    vector<bool> visited(N, false);

    DFS(0, g, count, visited);

    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, t) for(ll i = 0; i < t; i++)

using namespace std;
using ll = long long;
using P = std::pair<ll, ll>;

int main() {
    string s, t;
    cin >> s >> t;
    
    forin(i, s.size()) {
        bool match = true;
        forin(j, s.size()) {
            auto n = (j + i) % s.size();
            if (s[j] != t[n]) {
                match = false;
                break;
            }
        }
        if (match) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    
}



Measured memory_bytes: 256
n = int(input())

s = []

ans = 0

both = 0
a_a = 0
b_a = 0

for i in range(n):
	ss = input()
	ans += ss.count("AB")
	if(ss[0] == "B" and ss[len(ss)-1] == "A"):
		both += 1
	elif(ss[0] == "B"):
		b_a += 1
	elif(ss[len(ss)-1] == "A"):
		a_a += 1
		
if(both == 0):
	ans += min(a_a,b_a)
elif(a_a + b_a > 0):
	ans += (both + min(a_a,b_a))
elif(a_a + b_a == 0):
	ans += (both -1)

print(ans)


Measured memory_bytes: 3064
while line = gets
  (a, b, c, d, e, f) = line.split().map(&:to_f)
  z = a*e - b*d
  x = (c*e - b*f) == 0 ? 0.0 : (c*e - b*f) / z
  y = (a*f - c*d) == 0 ? 0.0 : (a*f - c*d) / z
  puts sprintf("%.3f %.3f", x.to_s, y.to_s)
end

Measured memory_bytes: 4956
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int N, x;
	int a[100005];
	cin >> N >> x;
	REP(i, N) {
		cin >> a[i];
	}

	ll ans = 0;
	for (int i = 0;i < N - 1;i++) {
		if (a[i] + a[i + 1] > x) {
			int diff = a[i] + a[i + 1] - x;
			ans += diff;
			a[i + 1] -= diff;
			if (a[i + 1] < 0) {
				a[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
	}

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

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <algorithm>

using namespace std;

int a[2010],r,n;

int main()
{
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    for (int i=1;i<n-1;i++)
        for (int j=i+1;j<n;j++)
            {
                int st=j+1,dr=n;
                while (st<=dr)
                {
                    int m=(st+dr)/2;
                    if (a[m]>=a[i]+a[j])
                        dr=m-1;
                    else st=m+1;
                }
                r+=dr-j;
            }
    cout<<r;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll N, A, B;

int main() {
	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int r, c, n, count = 0, calc = 0;;
	scanf("%d", &r);
	scanf("%d", &c);
	scanf("%d", &n);
	
	while(calc < n) {
		if(r < c) {
			calc += c;
		} else {
			calc += r;
		}
		count++;
	}
	printf("%d", count);
	
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int d;
    while(cin >> d){
        int sum=0;
        for(int i=d;i<=600;i+=d){
            sum += d*(i-d)*(i-d);
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
package main

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

type Node struct {
	left  *Node
	val   int
	right *Node
}

func main() {
	var nOps int
	fmt.Scan(&nOps)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	var node *Node
	for i := 0; i < nOps; i++ {
		sc.Scan()
		switch sc.Text() {
		case "insert":
			sc.Scan()
			val, _ := strconv.Atoi(sc.Text())
			node = insert(node, val)
		case "find":
			sc.Scan()
			val, _ := strconv.Atoi(sc.Text())
			if contains(node, val) {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		case "delete":
			sc.Scan()
			val, _ := strconv.Atoi(sc.Text())
			remove(node, val)
		case "print":
			printValues(listByInOrder(node, []int{}))
			printValues(listByPreOrder(node, []int{}))
		}
	}
}

func printValues(vs []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range vs {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

func listByInOrder(node *Node, vs []int) []int {
	if node != nil {
		vs = listByInOrder(node.left, vs)
		vs = append(vs, node.val)
		vs = listByInOrder(node.right, vs)
	}
	return vs
}

func listByPreOrder(node *Node, vs []int) []int {
	if node != nil {
		vs = append(vs, node.val)
		vs = listByPreOrder(node.left, vs)
		vs = listByPreOrder(node.right, vs)
	}
	return vs
}

func insert(node *Node, val int) *Node {
	if node == nil {
		return &Node{nil, val, nil}
	}

	var parent *Node
	nd := node
	for nd != nil {
		parent = nd
		if nd.val > val {
			nd = nd.left
		} else {
			nd = nd.right
		}
	}

	if parent.val > val {
		parent.left = &Node{nil, val, nil}
	} else {
		parent.right = &Node{nil, val, nil}
	}

	return node
}

func contains(node *Node, val int) bool {
	switch {
	case node == nil:
		return false
	case node.val == val:
		return true
	case node.val > val:
		return contains(node.left, val)
	default:
		return contains(node.right, val)
	}
}

// 削除対象のノード z が子を持たない、もしくは1つだけ持つ場合は特に難しくない。
// ポイントは子を2つ持つ場合で、その場合は「中間順巡回で z の次に来る点」(次節点)
// の値を z の位置に持ってくるようにする。この次節点はつまり「z の右側の木の中で
// 最小の値」であるから、こいつを持ってくるようにすれば「あるノードの値はその
// 右側の木内のどの値よりも小さい」という二分木のルールを保てる。
func remove(node *Node, val int) {
	parent := &Node{nil, -1, node}

	// Find the target node.
	for node != nil {
		if node.val == val {
			break
		} else {
			parent = node
			if node.val < val {
				node = node.right
			} else {
				node = node.left
			}
		}
	}

	// If the node has two children, we replace the node value with
	// the minimum value of its right trree and remove the minimum node.
	if node.left != nil && node.right != nil {
		min, minParent := findMinNext(node)
		node.val = min.val
		node, parent = min, minParent
	}

	if node.left == nil && node.right == nil {
		if parent.left == node {
			parent.left = nil
		} else {
			parent.right = nil
		}
	} else {
		next := node.right
		if next == nil {
			next = node.left
		}
		if parent.left == node {
			parent.left = next
		} else {
			parent.right = next
		}
	}
}

func findMinNext(node *Node) (*Node, *Node) {
	parent := node
	min := node.right
	for min.left != nil {
		parent = min
		min = min.left
	}
	return min, parent
}


Measured memory_bytes: 37756
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
#define vecout(v,n) for(int i=0; i<n; i++)cout<<v[i]<<" "; cout<<endl;

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}




signed main() {
	int x, y, a, b, c,t=0;
	cin >> x >> y >> a >> b >> c;
	vector<int>vec1(a), vec2(b), vec3(c), vec4;
	vecin(vec1);
	vecin(vec2);
	vecin(vec3);
	sort(all(vec1));
	reverse(all(vec1));
	sort(all(vec2));
	reverse(all(vec2));
	sort(all(vec3));
	reverse(all(vec3));
	rep(i, x) {
		vec4.push_back(vec1[i]);
	}
	rep(i, y) {
		vec4.push_back(vec2[i]);
	}
	rep(i, c) {
		vec4.push_back(vec3[i]);
	}
	sort(all(vec4));
	reverse(all(vec4));
	rep(i, x + y) {
		t += vec4[i];
	}
	cout << t << endl;
}




Measured memory_bytes: 8560
// its_mind_changer_
//                         _don't_under_estimate_
#include<bits/stdc++.h>
using namespace std;
#define int long long 


signed main()
{
    string a;cin>>a;
    int x=0;
    for(int i=0;i<3;i++) if(a[i]=='A') x++;
    if(x and x!=3) cout<<"Yes\n";
    else cout<<"No\n";
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    ll a, b, c;
    cin >> a >> b >> c;
    cout << b + min(a + b + 1, c) << endl;
}


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

int main(){
	int n;
	cin >> n;
	vector <int> v(n);
	vector <int> c(n);
	int sigma=0;
	for(int i=0;i<n;i++){
		cin >> v.at(i);
	}
	for(int i=0;i<n;i++){
		cin >> c.at(i);
	}
	for(int i=0;i<n;i++){
		if(v.at(i)>=c.at(i)){
			sigma += v.at(i) - c.at(i);
		}else{
			sigma = sigma;
		}
	}
	cout << sigma << endl;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
bool visited[MAX]; // 訪問状況

int n, m; // 変数
ll k;
int a[MAX];

int main() {
// input
    cin >> n >> k;
    rep(i, n+1) {
        if (i > 0) cin >> a[i];
    }
// solve
    int cnt = 1; // ループに突入するテレポート回数
    int start = 1;
    visited[start] = true;
    int next = a[start];
    while (not visited[next]) {
        cnt++;
        visited[next] = true;
        next = a[next];
    }
    int loop_start = next; // ループの始点
    // printf("ループに突入するテレポート回数%d\n", cnt);
    // printf("ループの始点%d\n", next);
    int ans;
    if (cnt < k) {
        next = 1;
        int d = 0; // ループ始点までに訪問する都市の数
        while (next != loop_start) {
            d++;
            next = a[next];
        }
        int loop_size = cnt - d;
        // printf("ループの大きさ%d\n", loop_size);
        int pos = 1;
        rep(i, d) {
            pos = a[pos];
        }
        // if (loop_size == 0) {
        //     ans = pos;
        // } else {
            rep(i, (k-d)%loop_size) {
                pos = a[pos];
            }
            ans = pos;
        // }
    } else {
        int pos = 1;
        rep(i, k) {
            pos = a[pos];
        }
        ans = pos;
    }
// output
    cout << ans << "\n";
}

Measured memory_bytes: 4580
package main

import "fmt"

func main() {
	days := map[string]int{"SUN": 0, "MON": 1, "TUE": 2, "WED": 3, "THU": 4, "FRI": 5, "SAT": 6}
	var s string
	fmt.Scan(&s)
	fmt.Println(7 - days[s])
}

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

int n;

int main()
{
    cin >> n;
    vector<int> s(n);
    for (int i = 0; i < n; i++)
    {
        char a;
        cin >> a;
        if (a == 'E')
            s[i] = 1;
        else
            s[i] = 0;
    }

    vector<int> eastsum(n, 0);
    eastsum[0] = s[0];

    for (int i = 1; i < n; i++)
    {
        eastsum[i] = eastsum[i-1] + s[i];
    }

    int ans = eastsum[n-1]-eastsum[0];
    for (int i = 1; i < n; i++)
    {
        ans = min(ans, i - eastsum[i - 1] + eastsum[n - 1] - eastsum[i]);
    }
    cout << ans << endl;
    return 0;
}

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

#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;
int t;
int a[200000];
main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  //  freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        int x;
        cin >> x;
        a[x]++;
    }
    for (int i = 1; i <= 100000; i++){
        while(a[i] > 2) a[i] -= 2;
        if (a[i] == 2) t++;
        if (a[i] != 0) ans++;
    }
    if (t % 2 == 1) ans--;
    cout << ans;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>

#define INF 1 << 30
#define MOD 1000000007
#define PI 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v) for (auto i : v)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
#define fi first
#define se second
#define setp(x) setprecision(x)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

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

#define int ll

int getDigit(int n) {
        string s = to_string(n);
        int len = s.size();
        return len;
}

signed main() { 
        int n;
        cin >> n;
        int ans = INF;
        for (int i = 1; i * i <= n; i++) {
                if (n % i == 0) {
                        int other = n / i;
                        amin(ans, max(getDigit(i), getDigit(other)));
                }
        }
        D(ans);
        return 0;
}



Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

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

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main()
{
	bool flag = true;
	while(1){
		int a, b;
		char op;
		cin >> a >> op >> b;
		switch (op)
		{
		case '+':
			cout << a + b << endl;
			break;
		case '-':
			cout << a - b << endl;
			break;
		case '*':
			cout << a * b << endl;
			break;
		case '/':
			cout << a / b << endl;
			break;
		case '?':
			flag = false;
			break;
		default:
			break;
		}
		if(flag == false){
			break;
		}
	}
}

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



Measured memory_bytes: 3216
#include <stdio.h>
#include <limits.h>

#define MAX 2000000000

typedef struct{
  int x;
  char c;
}card;

card M[100000];

int Partition(int, int);
void Quicksort(int, int);
void merge(int, int, int,card[]);
void mergeSort(int, int, card[]);

int main(){
  int i, p, n;
  char c;
  card N[100000];

  scanf("%d%c", &n, &c);

  for(i = 0; i < n; i++){
    scanf("%c%d%c", &N[i].c, &N[i].x, &c);
    M[i] = N[i];
  }

  p = 0;
  mergeSort(0, n, N);
  Quicksort(0, n-1);

  for(i = 0; i < n; i++){
    if(N[i].c != M[i].c){
      printf("Not stable\n");
      break;
    }
    if(i == (n - 1))
      printf("Stable\n");
  }
  
  for(i = 0; i < n; i++){
    printf("%c %d\n", M[i].c, M[i].x);
    }
  
  return 0;
}

int Partition(int e, int s){
  card tmp;
  int i, j, x;
  x = M[s].x;
  i = e - 1;

  for(j = e; j < s; j++){
    if (M[j].x <= x){
      i++;
      tmp = M[i];
      M[i] = M[j];
      M[j] = tmp;
    } 
  }
  tmp = M[i + 1];
  M[i + 1] = M[s];
  M[s] = tmp;
  return (i + 1);
}
  
void Quicksort(int e, int s){
  int w;
  if(e < s){
     w = Partition(e, s);
     Quicksort(e, w-1);
     Quicksort(w+1, s);
  }
}
  
void merge(int left, int mid, int right, card K[]){
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  card L[100001], R[100001];

  for(i = 0; i < n1; i++){
    L[i] = K[left + i];
  }
  for(i = 0; i < n2; i++){
    R[i] = K[mid+i];
  }
  L[n1].x = MAX;
  R[n2].x = MAX;

  i = 0;
  j = 0;
  for(k = left; k < right; k++){
    if(L[i].x <= R[j].x)
      K[k]=L[i++];
    else
      K[k]=R[j++];
  }
}
 
void mergeSort(int left, int right, card K[]){
  if((left + 1) < right){
    int mid = (left + right) / 2;
    mergeSort(left, mid, K);
    mergeSort(mid, right, K);
    merge(left, mid, right, K);
  }
}

Measured memory_bytes: 2960
long c;main(long a,long b){a-1?~scanf("%ld%ld",&a,&b)&&(main(0,0),
//c=(a+c-1)/b*b+b-a
c+=(b-(a+c)%b)%b
):(main(~scanf("%d",&a),0),printf("%ld",c));}

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

const int MAXN = 17;
const int MAXM = 17;

int N, M;
long double dp[1<<MAXM][MAXN];
long double P[MAXM][MAXN];

long double rec(int i, int j) {
  long double &res = dp[i][j];
  if(res != -1.0) return res;
  res = 0.0;
  for(int k = 0; k < M; ++k) {
    if(i & (1<<k)) continue;
    int ni = (i | (1<<k));
    long double np = 1.0;
    long double sum = 0.0;
    for(int nj = j; nj < N; ++nj) {
      sum += rec(ni, nj) * np * (1.0 - P[k][nj]);
      np *= P[k][nj];
    }
    sum += np;
    res = max(res, sum);
  }
  return res;
}

int main() {
  while(cin >> M >> N) {
    for(int i = 0; i < M; ++i) {
      for(int j = 0; j < N; ++j) {
        cin >> P[i][j];
      }
    }
    fill(dp[0], dp[1<<MAXM], -1.0);
    printf("%.10Lf\n", rec(0,0));
    continue;


    dp[0][0] = 1.0;
    long double res = 0.0;
    for(int j = 0; j < N; ++j) {
      for(int i = 0; i < (1<<M); ++i) {
        if(dp[i][j] == 0.0) continue;
        for(int k = 0; k < M; ++k) {
          if(i & (1<<k)) continue;
          int ni = (i | (1<<k));
          long double np = 1.0;
          for(int nj = j; nj < N; ++nj) {
            dp[ni][nj] = max(dp[ni][nj], dp[i][j] * np * (1.0 - P[k][nj]));
            np *= P[k][nj];
          }
          res += dp[i][j] * np;
          //          dp[ni][N] = max(dp[ni][N], dp[i][j] * np);
        }
      }
    }
    /*
    for(int i = 0; i < (1<<M); ++i) {
      res += dp[i][N];
    }
    */
    printf("%.10Lf\n", res);
  }
  return 0;
}

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

#define ll      long long
#define MAX     505
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);

int main ()
{
    ll n;
    ll ara[MAX][5];

    scanf("%lld",&n);

    for(ll i=1;i<n;i++)
        scanf("%lld %lld %lld",&ara[i][1],&ara[i][2],&ara[i][3]);

    for(int i=1;i<=n;i++)
    {
        ll j= i,tm = 0;
        while(j!=n)
        {
            if(tm<ara[j][2])
            {
                tm = ara[j][2];
                tm += ara[j][1];
            }
            else
            {
                if((tm-ara[j][2])%ara[j][3])
                {
                    ll temp = (tm - ara[j][2])%ara[j][3];
                    temp = ara[j][3] - temp;
                    tm += (temp);
                }
                tm += ara[j][1];
            }
            j++;
        }
        printf("%lld\n",tm);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	int n,i;
	cin>>n;
	for(i=1;i<10;i++)
		if(n%i==0&&n/i>0&&n/i<10)
		{
			cout<<"Yes";
			return 0;
		}
	cout<<"No";
	return 0;
}

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

int main() {
  long N;
  cin >> N;
  
  unsigned long sum = N * (1 + N) / 2;
  unsigned long N3 = N / 3;
  unsigned long N5 = N / 5;
  unsigned long N15 = N / 15;
  
  unsigned long ans = sum - N3 * (1 + N3) / 2 * 3 - N5 * (1 + N5) / 2 * 5 + N15 * (1 + N15) / 2 * 15;
  cout << ans << endl;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)
#define free(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%lld", &n)
#define sff(a,b) scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define pfn(n) printf("%lld\n", n)
#define pfs(n) printf("%lld ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define f find
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define in insert
#define bs binary_search
#define le length()
const ll max_i=1e16+7;
#define np(s) next_permutation(s.begin(),s.end())
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
//it gives the lexicographically smallest string//

void solve()
{
	int t=1;
	//cin>>t;
	while(t--)
    {
    	int n,r=0,w=0,count=0;
    	cin>>n;
    	char arr[n];
    	for(int i=0;i<n;i++)
    	{
       cin>>arr[i];
       if(arr[i]=='W') w++;
       else r++;
        }
        for(int i=0;i<r;i++)
        {
        	if(arr[i]=='W') count++;
        }
        cout<<count;
       // ll k,n=1,x=0,p=0;
       // cin>>k;
       // while(x<max_i)
       // {
       //     x+=n*7;
       //     p++;
       //     if(x%k==0)
       //     {
       //     	cout<<p;
       //     	return ;
       //     }
       //     n=n*10;
       // }
       // cout<<-1;
	}
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	solve();
	return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vdouble = vector<double>;

int gcd(int a, int b) {
    if (b==0) return a;
   	else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}



int main(){
	ll N,sum=0;
	cin>>N;
	vll P(N),Q(N);
	REP(i,N) cin>>P[i];
	Q[0]=P[0];
	REP(i,N-1){
		Q[i+1]=min(P[i+1],Q[i]);
	}
	
	REP(i,N){
		if(Q[i]>=P[i]) sum++;
	}
	cout<<sum<<endl;
	
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;

int counter(int x){
  if(x==0) return 0;
  return counter(x>>1) + (x&1);
}
int main() {

int n;
cin >> n;
int a[20];
int x[20][20];
int y[20][20];
for(int i=1;i<=n;i++) {
 cin >> a[i];
 for(int j=1;j<=a[i];j++) {
  cin >> x[i][j] >> y[i][j];
 }
}
int ans=0;
for(int bits = 1;bits < (1<<n);bits++) {
  bool ok=true;
  for(int i = 1;i<=n;i++) {
    if(!(bits&(1<<(i-1)))) continue;
    for(int j=1;j<=a[i];j++) {
      if(((bits >> x[i][j]-1)&1)^y[i][j]) ok = false;
    }
  }
  if(ok) {
    ans = max(ans,counter(bits));
  }
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main() {
    string s;
    cin>>s;
    int a,z;
    for(int i=0;i<s.length();i++){
      if(s[i]=='A'){
        a=i;
        break;
      }
    }for(int i=s.length()-1;i>0;i--){
      if(s[i]=='Z'){
        z=i;
        break;
      }
    }
    cout<<z-a+1<<endl;
    return 0;
}


Measured memory_bytes: 640
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A,B = map(int,read().split())

def test(n):
    x = n * 8 // 100
    y = n * 10 // 100
    return (x == A) and (y == B)

answer = -1
for n in range(20000):
    if test(n):
        answer = n
        break
print(answer)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
int compare(const void *a,const void *b){
    return *(int*)b-*(int*)a;
}
int main(void){
    int n,i,r=0,t=1;
    int arr[999];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&arr[i]);
    qsort(arr,n,4,compare);
    for(i=0;i<n;i++){
        r+=t*arr[i];
        t=-t;
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <climits>
#include <cfloat>

using namespace std;

//start of 0uts1de's library

int cin_int_arr(vector<int>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_int_arr(vector<int>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_double_arr(vector<double>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_double_arr(vector<double>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cin >> arr.at(i);
    }
    return 0;
}


int cout_int_arr(vector<int>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_int_arr(vector<int>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_double_arr(vector<double>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_double_arr(vector<double>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}


int max_int_arr(std::vector<int>& arr){    //data mode
    int maxVal = INT_MIN;       //min of int
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            maxVal = arr.at(i);
        }
    }
    return maxVal;
}

int max_int_arr(std::vector<int>& arr, int mode){    //overload index mode
    int maxVal = INT_MIN;       //min of int
    int maxIndex = 0;
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            maxVal = arr.at(i);
            maxIndex = i;
        }
    }
    return maxIndex;
}

double max_double_arr(std::vector<double>& arr){    //data mode
    double maxVal = -DBL_MAX;       //min of double
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            maxVal = arr.at(i);
        }
    }
    return maxVal;
}

int max_double_arr(std::vector<double>& arr, int mode){    //overload index mode
    double maxVal = -DBL_MAX;       //min of double
    int maxIndex = 0;
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            maxVal = arr.at(i);
            maxIndex = i;
        }
    }
    return maxIndex;
}

//end of 0uts1de's library

int main(){
    vector<int> a(3), b(3), town(4, 0);
    string ans = "YES";
    for (int i = 0; i < 3; ++i){
        cin >> a.at(i) >> b.at(i);
    }
    for (int i = 0; i < 4; ++i){
        for (int j = 0; j < 3; ++j){
            if (a.at(j) == i + 1 || b.at(j) == i + 1){
                ++town.at(i);
            }
        }
        if (town.at(i) > 2){
            ans = "NO";
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {

	int a, b;
	cin >> a >> b;
	if (a == 2 || b == 2)cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256