akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
vector<int>G[10010];
vector<int>c(10010,0);
int num[10010];
bool used[10010];
int now_c=0;
int dfs(int s){
    if(used[s]){
        return 0;
    }else{
        used[s]=true;
    }

    num[s]=c[now_c];
    now_c++;

    for(int i=0; i<G[s].size(); i++){
        dfs(G[s][i]);
    }
    return 0;
}


int main() {
    string L; cin >> L;

    lli a[100010], b[100010];
    a[0]=2;
    b[0]=1;

    for(int i=1; (size_t)i<L.size(); i++){
        if(L[i]=='1'){
            a[i]=(2*a[i-1])%MOD;
            b[i]=(3*b[i-1]+a[i-1])%MOD;
        }else{
            a[i]=a[i-1];
            b[i]=(3*b[i-1])%MOD;
        }
    }

    cout << (a[L.size()-1]+ b[L.size()-1])%MOD <<endl;
    return 0;
}

Measured memory_bytes: 2368
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
#include<algorithm>
using namespace std;

#define debug(x) cout << #x << " = " << x << endl
#define lowbit(x) (x & (-x))

typedef long long LL;
typedef pair<int, int>PII;
const int maxn = 1e5 + 10;

int n;
int main(){
	cin >> n ;
	if(n < 1200) cout << "ABC" << endl;
	else if(n < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
	return 0;
}

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

#define MAX_N 200000

ll lst_a[MAX_N];
int lst_count[MAX_N];

int main() {
  int N;
  cin >> N;
  rep(i, N) cin >> lst_a[i];
  rep(i, N) lst_count[i] = 0;

  ll ans = 0;
  rep(i, N) {
    ll sub, add;
    sub = ll(i) - lst_a[i];
    add = ll(i) + lst_a[i];

    if (sub > 0) ans += lst_count[int(sub)];
    if (add < N) lst_count[int(add)]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5968
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#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 read(v,n) for(h=0;h<n;h++)in(v[h]);
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define cf(n) printf("%I64d\n",n)
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,n) for(h=0;h<n;h++)pr(v[h]); lin
#define ck printf("continue\n")
#define ii pair<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 all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#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 N 1005
typedef long long int ll;
int main()
{
    int i,n,k;
    double d=0;
    cout << setprecision(12) << fixed;
    in2(n,k);
    double a;
    int p=1;
    for(i=n;i>0;i--)
    {
        a=k;
        a/=i;
        while(p<a)
            p*=2;
        a=1,a/=p;
        d+=a;
    }
    d/=n;
    cout << d << endl;
}


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

int main() {
    int a[3];
    for (int i = 0; i < 3; i++)
        cin >> a[i];
    int sum = 0;
    for (int i = 0; i < 3; i++) 
        sum += a[i];
    if (sum >= 22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
using namespace std;

int main(){

  while(1){
    int n;
    cin >> n;
    if(n == 0) break;

    vector <string> str;
    string a;
    char ch;
    scanf("%c",&ch);
    for(int i=0;i<n;i++){

      assert(ch != ' '); 
      while(1){
	scanf("%c",&ch);
	
	if(ch == ' ') {
	  str.push_back(a);
	  a="";
	  continue;
	}
	if(ch == '\n') {
	  str.push_back(a);
	  a="";
	  break;
	}
	a += ch;
      }

    }
    cin >>a;
    vector <pair<int,string> > b;
    sort(str.begin(),str.end());
    for(int i=0;i<str.size();i++){
      if(a[0] == str[i][0]) {
	int cnt = 1;
	while(1) {
	  if(i+1 == str.size()) break;
	  if(str[i] == str[i+1])cnt++,i++;
	  else break;
	}
	pair <int,string> t;
	t.first = -cnt;
	t.second = str[i];
	  b.push_back(t);
      }
    }
    
    sort(b.begin(),b.end());
    for(int i=0;i<b.size();i++){
      if(i == 5) break;
      cout << b[i].second;
      if(i != b.size()-1) cout <<" ";
    }
    if(b.size() == 0) cout << "NA";
    cout << endl;
    
    
  }
  return 0;
}

Measured memory_bytes: 1296
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, x) = (v[0] as usize, v[1]);
    let mut a = read_vec::<i64>();
    let mut ans = 0;
    if a[0] > x {
        ans += a[0] - x;
        a[0] = x;
    }
    for i in 1..n {
        if a[i - 1] + a[i] > x {
            ans += a[i - 1] + a[i] - x;
            a[i] = x - a[i - 1];
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 8444
import scala.util.control.Breaks
object Main extends App {
  val pat = readLine

  var cnt = 0

  val b = new Breaks
  b.breakable {
    while (true) {
      val line = readLine

      if (line == "END_OF_TEXT") {
        b.break()
      } else {
        cnt += line.toLowerCase.split(' ').count(_ == pat)
      }
    }
  }
  println(cnt)
}


Measured memory_bytes: 43828
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=5005;
const int MAXM=5005;
struct edge{int x,y,c,next;}a[MAXM];int len,last[MAXN];
void ins(int x,int y,int c){len++;a[len].x=x;a[len].y=y;a[len].c=c;a[len].next=last[x];last[x]=len;}
int n,m,P,vi[MAXN];LL d[MAXN];
bool v[MAXN];
queue<int> li;
bool yes[MAXN],yes1[MAXN];
vector<int> nxt[MAXN];
void init()
{
	li.push(n);
	while(!li.empty())
	{
		int x=li.front();li.pop();yes[x]=1;
		for(int k=0;k<nxt[x].size();k++)
		{
			int y=nxt[x][k];
			if(!yes[y])yes[y]=1,li.push(y);
		}
	}
	li.push(1);
	while(!li.empty())
	{
		int x=li.front();li.pop();yes1[x]=1;
		for(int k=last[x];k;k=a[k].next)
		{
			int y=a[k].y;
			if(!yes1[y])yes1[y]=1,li.push(y);
		}
	}
}
bool bellman()
{
	memset(d,-60,sizeof(d));d[1]=0;
	for(int i=1;i<=n-1;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(d[a[j].y]<d[a[j].x]+a[j].c)d[a[j].y]=d[a[j].x]+a[j].c;
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(d[a[i].y]<d[a[i].x]+a[i].c&&(yes[a[i].y]||yes[a[i].x])&&(yes1[a[i].y]||yes1[a[i].x]))
		{
			return true;
		}
	}
	return false;
}
int main()
{
//	freopen("e.in","r",stdin);
	n=read();m=read();P=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read(),c=read();
		ins(x,y,c-P);nxt[y].push_back(x);
	}
	init();
	if(bellman())return pr2(-1),0;
	else pr2(d[n]>=0?d[n]:0);
//	pr2(spfa(1));
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,H,W,C=0;
  cin >> N >> H >> W;
  rep(i,N){
    ll A,B;
    cin >> A >> B;
    if(A>=H  && B>=W){
      C++;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
const int mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n,k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));

    auto count = [&](ll x){
        ll res = 0;
        rep(i,n){
            if(a[i] < 0){
                int l = -1, r = n;
                while(r - l > 1){
                    int m = (l+r)/2;
                    if(a[i] * a[m] < x) r = m;
                    else l = m;
                }
                res += n-r;
            }
            else{
                int l = -1, r = n;
                while(r - l > 1){
                    int m = (l+r)/2;
                    if(a[i] * a[m] < x) l = m;
                    else r = m;
                }
                res += r;
            }
            if(a[i]*a[i] < x) res--;
        }
        return res / 2;
    };

    ll l = ll(-1e18)-1, r = ll(1e18)+1;
    while(r - l > 1){
        ll m = (l+r)/2;
        if(count(m) >= k) r = m;
        else l = m;
    }
    cout << l << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a,b,c;
signed main(){
	cin>>a>>b>>c;
	cout<<a+b+c-max({a,b,c})<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;

int main() {
	double W, H;
double x, y;
	cin >> W >> H >> x >> y;
	W / 2 == x && H / 2 == y ? cout <<W * H / 2 << " " << 1: cout << W * H / 2 << " " << 0;



}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
aa,bb,cc = a,b,c

ans = 0
while True:  
  if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    break
  else:
    ans += 1
    a,b,c = b / 2 + c / 2 , a / 2 + c / 2 , a / 2 + b / 2
    
  if a == aa and b == bb and c == cc:
    ans = -1
    break
    
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100
#define MO 1000000007
using namespace std;
typedef long long LL;
int a[MAXN+5],n;
LL f[MAXN+5][MAXN+5][MAXN+5];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n);
	f[n][1][0]=1;
	//初始状态中，小于等于b[n]的有1个，大于b[n]的有0个（虽然稍微有些违背定义，但是暂且先这样定义吧）
	LL t;
	for(int i=n;i>1;i--)
	{
		int al=(a[i-1]!=a[i]),ar=(a[2*n-i+1]!=+a[2*n-i]);
		//这里是向两边进行扩展，也就是运用性质1进行扩展
		//因为相同的数进行的扩展是没有意义的，所以说需要这样进行能否进行有效的扩展的判断
		for(int l=0;l<=2*n-1;l++)
			for(int r=0;l+r<=2*n-1;r++)
				if(f[i][l][r])
				{
					t=f[i][l][r];
					for(int dl=1;dl<=l+al;dl++)//选择小于b[i]的元素
					{
						f[i-1][l+al-dl+1][r+ar+(dl>1)]+=t;
						//+al是进行对于L的拓展
						//-dl是删去选了的元素与b[i]之间的元素
						//+1是因为删多了一个，那就是已经选取的b[i-1]，所以说要加回来
						//右边+(dl>1)是因为：
						//当dl==1的时候，选取的就是b[i]这个元素，那就是什么都不会改变的
						//当dl>1的时候，选取的就是<b[i]中的一个元素，那么b[i]就会成为>b[i-1]中的一个元素，又因为可以取整，所以说要加上去
						f[i-1][l+al-dl+1][r+ar+(dl>1)]%=MO;
					}
					for(int dr=1;dr<=r+ar;dr++)//选择大于等于b[i+1]的元素
					{
						f[i-1][l+al+1][r+ar-dr]+=t;
						//左边+1是因为加入b[i-1]这个可选元素，与上面的比较类似
						//右边就是正常的转移，这还比较简单
						f[i-1][l+al+1][r+ar-dr]%=MO;
					}
				}
	}
	LL ans=0;
	for(int l=0;l<=2*n-1;l++)
		for(int r=0;l+r<=2*n-1;r++)
			ans=(1LL*ans+1LL*f[1][l][r])%MO;//对于每一个可能的情况都需要计算答案
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3944
if __name__ == '__main__':

	n = int(input())
	for _ in range(n):
		n,m,s = map(int,input().split())
		if n*n == m*m + s*s or m*m == n*n + s*s or s*s == m*m + n*n:
			print("YES")
		else:
			print("NO")



Measured memory_bytes: 5600
#include<stdio.h>
#define H 1000000
int A[H];
int left(int);
int right(int);
int parent(int);
int maxHeapify(int,int);
void buildMaxHeap(int);
int main(){
  int i,n;
  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap(n);
  for(i = 1;i <= n;i++){
    if(i)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}
int left(int i){
  return 2 * i;
}
int right(int i){
  return 2 * i + 1;
}
int parent(int i){
  if(i%2 == 1)return A[i/2];
  else return A[i/2-1];
}
int maxHeapify(int i,int size){
  int swap;
  int largest,r,l;
  r = right(i);
  if(r > size){
    A[r] = -2000000001;
  }
  l = left(i);
  if(l <= size && A[l] > A[i]){
    largest = l;
  }
    else{
    largest = i;
  }
  if(r <= size && A[r] > A[largest]){
    largest = r;
  }
  if(largest != i){
    swap = A[i];
    A[i] = A[largest];
    A[largest] = swap;
    maxHeapify(largest,size);
  }
}
void buildMaxHeap(int size){
  int i;
    for(i = size/2;i > 0;i--){
    maxHeapify(i,size);
  }
}


Measured memory_bytes: 5640
#include <iostream>
#include <vector>
 
using namespace std;
int n, m, k, l, dp[3002][3002], tab[150], tab2[105];
long double xd[100000];
string slowo1, slowo2;
char a[3002], b[3002];
vector<char> wektor;
int main()
{
    ios_base::sync_with_stdio(false);
        cin>>slowo1>>slowo2;
        n=slowo1.size();
        m=slowo2.size();
        for(int i=1; i<=n; i++){
            a[i]=slowo1[i-1];
            dp[i][0]=0;
            tab[int(slowo1[i-1]-'a')]++;
        }
        for(int i=1; i<=m; i++){
            b[i]=slowo2[i-1];
            dp[0][i]=0;
            tab2[int(slowo2[i-1]-'a')]++;
        }
 
 
        for(int i=1; i<=n; i++){
            for(int j=1; j<=m; j++){
                if(a[i]==b[j]){
                    dp[i][j]=dp[i-1][j-1]+1;
                }else{
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
 
 
 
        while((n>0)||(m>0)){
            if((dp[n][m]==dp[n-1][m])&&(dp[n-1][m]>0)){
 
            n--;
            }else  if((dp[n][m]==dp[n][m-1])&&(dp[n][m-1]>0)){
 
            m--;
            }else if((dp[n][m]-1==dp[n-1][m-1])&&(dp[n-1][m-1]>0)){
                wektor.push_back(a[n]);
                n--;
                m--;
            }else{
            break;
            }
        }
        //cout<<a[m]<<" "<<b[m]<<'\n';
 
        if(wektor.size()==0){
          for(int i=0; i<26; i++){
            //cout<<tab[i]<<" "<<tab2[i]<<'\n';
            if((tab[i]>0)&&(tab2[i]>0)){
              cout<<char(i+'a');
              break;
            }
          }
        //else{
          //cout<<" ";
        //}
        }else{
          cout<<b[m];
          for(int i=wektor.size()-1; i>=0; i--){
            cout<<wektor[i];
        }
      }
    return 0;
}

Measured memory_bytes: 35456
#include <cstdio>
#include <stdio.h>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <iostream>
using namespace std;

int main() {
    int X, A, B;

    cin >> X;
    cin >> A;
    cin >> B;

    printf("%d\n", (X - A) % B);
    return 0;
}

Measured memory_bytes: 256
/*
* ID: juryc
* PROG: racoon vs monster
* LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int h,n,a; 
int sum=0;
cin>>h; cin>>n;
for(int i=0;i<n;i++)  { cin>>a; sum+=a;}
if(sum>=h) cout<<"Yes"<<"\n"; 
else cout<<"No"<<"\n"; 
return 0;
}

Measured memory_bytes: 3632
n=int(input())
import queue
q=queue.Queue()
for i in range(1,10):
    q.put(i)
while n!=1:
    x=q.get();k=x%10
    for i in range(max(0,k-1),min(10,k+2)) :
        q.put(10*x+i)
    n-=1
print(q.get())


Measured memory_bytes: 13040
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (auto& x : A) cin >> x;
	auto B = A;
	sort(B.begin(), B.end());
	for (auto x : A) {
		if (x <= B[N/2-1]) {
			cout << B[N/2] << endl;
		} else {
			cout << B[N/2-1] << endl;
		}
	}
}


Measured memory_bytes: 3712
n,m=map(int,input().split())
l_max=-1
r_min=n+1
for i in range(m):
    l,r=map(int,input().split())
    l_max=max(l_max,l)
    r_min=min(r_min,r)
    
print(max(r_min-l_max+1,0))

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

double solve(int a, int b, int c, vector<vector<vector<double>>> &dp, int N){
	if(dp[a][b][c] >= 0.0) return dp[a][b][c];
	int s = a+b+c;
	dp[a][b][c] = 1.*N/s;
	if(a > 0) dp[a][b][c] += solve(a-1,b+1,c,dp,N)*a/s;
	if(b > 0) dp[a][b][c] += solve(a,b-1,c+1,dp,N)*b/s;
	if(c > 0) dp[a][b][c] += solve(a,b,c-1,dp,N)*c/s;
	return dp[a][b][c];
}

int main(){
	int N; cin >> N;
	int a[3] = {0,0,0};
	repp(i,0,N){
		int x; cin >> x;
		++a[x-1];
	}
	vector<vector<vector<double>>> dp(a[2]+1,vector<vector<double>>(N+1,vector<double>(N+1,-1.0)));
	dp[0][0][0] = 0.0;
	printf("%.12f\n",solve(a[2],a[1],a[0],dp,N));
	return 0;
}


Measured memory_bytes: 216960
#include<stdio.h>
int main(){
float w;for(;scanf("%f",&w)!=EOF;){
		if(w<=48.0)printf("light fly\n");
		else if(w<=51.0)printf("fly\n");
		else if(w<=54.0)printf("bantam\n");
		else if(w<=57.0)printf("feather\n");
		else if(w<=60.0)printf("light\n");
		else if(w<=64.0)printf("light welter\n");
		else if(w<=69.0)printf("welter\n");
		else if(w<=75.0)printf("light middle\n");
		else if(w<=81.0)printf("middle\n");
		else if(w<=91.0)printf("light heavy\n");
		else printf("heavy\n");
	}
	exit(0);
}

Measured memory_bytes: 0
import sys
from collections import deque
import copy
import heapq

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] =  [(input_raw[0])]
    input_raw = read_func().strip().split()
    [K] = [long(input_raw[0])]
    count = 0L;
    for s in S:
        if s != "1":
            break;
        count += 1
    if count >= K:
        print S[K-1]
    else:
        print S[count]

if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n, y;
    cin >> n >> y;
    y /= 1000;
    int sen, go, man;
    bool flag = false;
    for (man = 0; man <= n; man++) {
        for (go = 0; go <= n - man; go++) {
            sen = n - man - go;
            if (sen + 5 * go + man * 10 == y) flag = true;
            if (flag) break;
        }
        if (flag) break;
    }
    if (!flag) sen = go = man = -1;
    cout << man << " " << go << " " << sen << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m;
ll ans;
inline void dfs(ll x,ll y){
	if(x%y==0){
		ans+=x*2-y;
		return ;
	}
	else{
		ans+=(x-x%y)*2;
		dfs(y,x%y);
	}
}
main(){
	cin>>n>>m;
	ans=n;
	n-=m;
	dfs(max(n,m),min(n,m));
	cout<<ans<<endl; 
	return 0;
}


Measured memory_bytes: 256
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i, a, b) for (int i = (a); i <= int(b); i++)
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

namespace { namespace shik {

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" SCNd64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }

#ifdef SHIK
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T, class F = less<T>> void sort_uniq(vector<T> &v, F f = F()) { sort(begin(v), end(v), f); v.resize(unique(begin(v), end(v)) - begin(v)); }
template<class T> inline T bit(T x, int i) { return (x >> i) & 1; }
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

// }}}

void main() {
    string s;
    R(s);
    W(s.find("AC")!=string::npos ? "Yes" : "No");
}

// {{{ main
}}
int main() { shik::main(); return 0; }
// }}}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int LOGN = 20;
const int MAXN = 200000 + 10;

int a[MAXN], lg2[MAXN];
PII odd[LOGN][MAXN], even[LOGN][MAXN];

PII query(int l, int r, int t) {
	assert(l <= r);
	int k = lg2[r-l+1];
	if(t ^ (l%2))
		return min(odd[k][l], odd[k][r-(1<<k)+1]);
	else
		return min(even[k][l], even[k][r-(1<<k)+1]);
}

int main() {
	int n;
	scanf("%d", &n);
	for(int i=0; i<n; i++) {
		scanf("%d", a+i);
		odd[0][i] = MP(a[i], i), even[0][i] = MP(n+1, i);
		if(i%2 == 0)	swap(odd[0][i], even[0][i]);
	}
	for(int i=1, l=1; i<LOGN; i++, l<<=1) {
		for(int j=0; j+l<n; j++) {
			odd[i][j] = min(odd[i-1][j], odd[i-1][j+l]);
			even[i][j] = min(even[i-1][j], even[i-1][j+l]);
		}
	}
	for(int i=1, lg=0; i<=n; i++) {
		if((1<<(lg+1)) < i)	lg++;
		lg2[i] = lg;
	}

	priority_queue<pair<PII, PII>, vector<pair<PII,PII>>, greater<pair<PII, PII> > > pq;
	VI ans;
	pq.push(MP(query(0, n-1, 0), MP(0, n-1)));
	while(!pq.empty()) {
		auto p = pq.top();	pq.pop();
		int l = p.S.F, r = p.S.S, i = p.F.S;
		// printf("%d %d %d\n", l, r, i);
		assert(r <= n);
		assert(l!=r);
		if(l>r)	continue;
		auto tmp = query(i, r, 1);
		int j = tmp.S;
		ans.PB(p.F.F);
		ans.PB(tmp.F);
		// printf("(i, j) = (%d, %d)\n", i, j);
		if(l <= i-1)	pq.push(MP(query(l, i-1, 0), MP(l, i-1)));
		if(i+1 <= j-1)	pq.push(MP(query(i+1, j-1, 0), MP(i+1, j-1)));
		if(j+1 <= r)	pq.push(MP(query(j+1, r, 0), MP(j+1, r)));
	}

	for(int i=0; i<SZ(ans); i++)	printf("%d%c", ans[i], " \n"[i==SZ(ans)-1]);
}


Measured memory_bytes: 67060
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL H, W;
	cin >> H >> W;
	vector<string> map;
	FOR(i, 0, H)
		map.push_back(IN<string>());
	LL t = 10000000;
	vector<VL> ans(H, VL(W, t));
	ans[0][0] = 0;

	//bfs
	queue<pair<LL, LL> > q;
	q.push(MP(0, 0));

	while (q.size() > 0) {
		pair<LL, LL> nowp = q.front(); q.pop();
		FOR(i, 0, 4) {
			LL nowh = nowp.first + dx[i];
			LL noww = nowp.second + dy[i];
			if (nowh >= 0 && noww >= 0 && nowh < H&&noww < W) {
				if (map[nowh][noww] != '#' && ans[nowh][noww] == t) {
					ans[nowh][noww] = min(ans[nowh][noww],
						ans[nowp.first][nowp.second] + 1);
					q.push(MP(nowh, noww));
				}
			}
		}
	}
	//DUMP_VVI(ans);
	LL finans = -1;
	if (ans[H - 1][W - 1] == t) {
		finans = -1;
	}
	else {
		LL blackSum = 0;
		FOR(i, 0, H) {
			FOR(j, 0, W) {
				if (map[i][j] == '#') {
					blackSum++;
				}
			}
		}
		finans = H*W - (ans[H - 1][W - 1] + 1) - blackSum;
	}
	O(finans);

	return 0;
}

Measured memory_bytes: 256
r,c=map(int,input().split())
A=list()

for i in range(r):
    A.append(list(map(int,input().split())))
    A[i]+=[sum(A[i])]
    print(*A[i])
A=list(zip(*A[::-1]))
for i in range(c):
    print(sum(A[i]),end=' ')
print(sum(A[c]))


Measured memory_bytes: 5772
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> A(0),B(0);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(i%2==0)
      A.push_back(a);
    else
      B.push_back(a);
  }
  vector<int> C(0);
  if(n%2==0){
    reverse(B.begin(),B.end());
    for(int &i:B)
      C.push_back(i);
    for(int &i:A)
      C.push_back(i);
  }else{
    reverse(A.begin(),A.end());
    for(int &i:A)
      C.push_back(i);
    for(int &i:B)
      C.push_back(i);
  }
  for(int i=0;i<n;i++){
    cout<<C[i];
    if(i==n-1)
      cout<<endl;
    else
      cout<<' ';
  }
}

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

public class Main {
	static int gcd(int a, int b){
		if(b == 0) return a;
		return gcd(b,a % b);
    }
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(true){
			try{
				int a = in.nextInt();
				int b = in.nextInt();
				int min = gcd(a,b);
				int max = 1;
				for(int i = 2;i < Math.pow(a + b, 0.5) + 1;i++){
					if(a % i == 0 && b % i == 0){
						max = max * i;
						a = a / i;
						b = b / i;
						i--;
					}
				}
				max = max * a * b;
				System.out.println(min + " " + max);
			}catch(Exception e){
				System.exit(0);
			}
		}
	}
}

Measured memory_bytes: 17256
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define rep(i,n) for (int i =0;i < (n); ++i)
#define vi vector<ll>
#define all(v) (v).begin(),(v).end()
const int inf = 1e9 + 10;

void solve() {
	ll a, b, c, k; cin >> a >> b >> c >> k;
	ll ans = 0;
	ans = min(a, k);
	k -= ans;
	k -= min(b, k);
	ans += (-1) * min(c, k);
	cout << ans;
}

int main() {

	FASTIO;



	int t = 1;

	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

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

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int W, H, x, y, r;

int main(){
	cin.tie(0);
	cin>>W>>H>>x>>y>>r;
	if((r<=x && r<=y) && (x <= W-r && y <= H-r))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const ll mod = 1000000007;
#define Sort(a) sort(a.begin(), a.end())

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b,a%b);
}

ll lcm (ll a,ll b) {
  return a / gcd(a,b) * b; 
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long a = 1LL;
  for (int i = 0; i < n; i++) {
    long long t;
    cin >> t;
    a = lcm(a,t);
  }
  cout << a << '\n';
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
ul H, W;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  string answer = "keyence";
  cin >> S;
  ul n = S.size();

  int pos = S.find(answer);
  int pos_back = S.rfind(answer);
  // cout <<pos <<endl;
  // cout <<pos_back << " "<<n<<endl;
  if (pos == 0 || pos_back == n - 7) {
    cout << "YES" << endl;
    return 0;
  }
  int i = 0;
  while (S[i] == answer[i]) {
    ++i;
  }
  int j = 0;
  while (S[n - 1 - j] == answer[6 - j]) {
    ++j;
  }
  if (i + j >= 7) {
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

struct node{
	int num;
	vector<node> children;
	int minimum(){
		if(children.size()==0){
			return (num+1)/2;
		}else{
			vi nums;
			REP(i,children.size()){
				nums.push_back(children[i].minimum());
			}
			sort(ALL(nums));
			int ret=0;
			REP(i,(nums.size()+1)/2){
				ret+=nums[i];
			}
			return ret;
		}
	}
};

int num(string &s,int &p){
	int ret=0;
	while(isdigit(s[p])){
		ret*=10;
		ret+=s[p]-'0';
		p++;
	}
	return ret;
}

node senkyoku(string &s,int &p){
	if(s[p]=='['){
		node ret;
		while(s[p]=='['){
			p++;
			node child=senkyoku(s,p);
			ret.children.push_back(child);
			assert(s[p]==']');
			p++;
		}
		return ret;
	}else{
		int nu=num(s,p);
		node n;
		n.num=nu;
		return n;
	}

}

int main(){
	int n;
	cin>>n;
	REP(i,n){
		string s;
		cin>>s;
		int p=0;
		node root=senkyoku(s,p);
		cout<<root.minimum()<<endl;
	}
}

Measured memory_bytes: 1500
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
 
 
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
int tc;
const int N=1e6+5,M=3e5+5,MOD=1e9+7,OO=1e9;

int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	//file();
 	
 	int n;

 	scanf("%d",&n);

 	std::vector<int> a(n);

 	for(int i=0;i<n;i++)scanf("%d",&a[i]);
 	int curr = 1,cnt=0;
 	for(int i=0;i<n;i++){
 		if(a[i]==curr){
 			curr++;
 			cnt++;
 		}
 	}

 	printf("%d\n",cnt==0?-1:n-cnt );
}

Measured memory_bytes: 1024
s=input()
n=len(s)
guki=[0,0,"r",0]
ans=[0]*n
for i in range(n):
    if guki[2]=="r":
        if s[i]=="R":
            guki[(i-guki[3])%2]+=1
        else:
            ans[i]+=guki[(i-guki[3])%2]
            ans[i-1]+=guki[(i-guki[3]+1)%2]
            guki[0]=0
            guki[1]=1
            guki[2]="l"
            guki[3]=i-1
    else:
        if s[i]=="L":
            guki[(i-guki[3])%2]+=1
        else:
            ans[guki[3]]+=guki[(i-guki[3])%2]
            ans[guki[3]+1]+=guki[(i-guki[3]+1)%2]
            guki[0]=1
            guki[1]=0
            guki[2]="r"
            guki[3]=i
ans[guki[3]]+=guki[(n-guki[3])%2]
ans[guki[3]+1]+=guki[(n-guki[3]+1)%2]


# print(ans)
print(" ".join(map(str,ans)))

Measured memory_bytes: 50800
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <functional>
using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int x = 0;
	int x_ = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'I') x_++;
		if (S[i] == 'D') x_--;
		x = max(x, x_);
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int x[10000000], n, _beg, _end, cnt;
int main() {
	while (true) {
		cin >> n;
		if (!n) { break; }
		cnt = 0;
		for (int i = 0; i < n; i++) {
			cin >> x[i];
		}
		x[n] = 10000;
		_beg = x[0]; _end = x[0];
		for (int i = 1; i <= n; i++) {
			if (x[i] - x[i - 1] == 1 && i < n) { _end = x[i]; }
			else {
				if (x[i] - x[i - 1] == 1) { _end = x[i]; }
				if (cnt) { cout << ' '; }
				cnt++;
				if (_beg != _end) {
					cout << _beg << '-' << _end;
				}
				else{
					cout << _beg ;
				}
				_beg = x[i]; _end = x[i];
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1164
#include<stdio.h>
int main(void)
{
	int d,n,a=1,i;
	scanf("%d %d", &d, &n);
	for(i=0; i<d; i++)
	a*=100;
	if(n>99)
	n++;
	printf("%d\n", a*n);
	
	return 0;
}

Measured memory_bytes: 128
N = int(input())
D, X = map(int,input().split())
A = [int(input()) for _ in range(N)]
choco = X
for a in A: 
  d = 0
  x = 0
  while d*a+1 <= D:
    x += 1
    d += 1
  choco += x
print(choco)

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

#define  fastIO  ios_base::sync_with_stdio(0); cin.tie(0);
#define  int long long int 
#define  endl '\n'

void solveTestCase()
{

	string str;
	cin >> str;

	if(str == "ABC")
		cout << "ARC\n";
	else
		cout << "ABC\n";
	
}

int32_t main()
{

	fastIO

	solveTestCase();

	return 0;

}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdint.h>

#define MOD_NUM 1000000007
enum {A = 0, G, C, T};
static uint32_t N;
static uint64_t memo[100][4][4][4];
static uint64_t mvld[100][4][4][4];

int isOK(int *last4) {
  for(int i = 0; i < 4; i++) {
    int chk [4];
    for(int j = 0; j < 4; j++) {
      chk[j] = last4[j];
    }
    if(i >= 1) {
      int tmp;
      tmp = chk[i-1];
      chk[i-1] = chk[i];
      chk[i] = tmp;
    }
    if((chk[0] == A && chk[1] == G && chk[2] == C) ||
       (chk[1] == A && chk[2] == G && chk[3] == C)) { 
      return 0;
    }
  }
  return 1;
}

uint64_t search(uint32_t i, int *last){
  if(mvld[i][last[0]][last[1]][last[2]] == 1) {
    return memo[i][last[0]][last[1]][last[2]];
  }
  if(i == N) return 1;

  uint64_t ret = 0;
  for(int j = 0; j < 4; j++) {
    int new_last [4];
    new_last[0] = last[0];
    new_last[1] = last[1];
    new_last[2] = last[2];
    new_last[3] = j;
    if(isOK(new_last) == 1)
      ret = (ret + search(i+1, &new_last[1])) % MOD_NUM;
  }
  memo[i][last[0]][last[1]][last[2]] = ret;
  mvld[i][last[0]][last[1]][last[2]] = 1;
  return ret;
}

int main(void) {
  scanf("%d", &N);
  int TTT[3] = {T, T, T};
  printf("%ld\n", search(0, TTT));
  return 0;
}


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

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

	int res = 0;

	for (int i = 0;i < n - 2;++i) {
		if (p[i] < p[i + 1] && p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1]&& p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

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

int main() {
  int a,s1,s2,s3;
  cin >> a;
  s1 = a / 100;
  s2 = a / 10 % 2;
  s3 = a % 2;
  cout << s1 + s2 + s3 << endl;
}

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

int main(){

        int mn=INT_MAX;
        int nur=753;
        string s;
        cin>>s;
        for(int i=0;i<s.size()-2;i++){
                string k="";
                for(int j=i;j<i+3;j++){
                        k=k+s[j];
                }
               ///cout<<k<<endl;
                int a=stoi(k);
                int b=abs(a-nur);
                mn=min(mn,b);
        }
        cout<<mn;
}



Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main() {
    int N, L;
    cin >> N >> L;
    int sum = N * (L - 1) + N * (N + 1) / 2;
    if (L >= 0) cout << sum - L << endl;
    else if (L + N - 1 <= 0) cout << sum - (L + N - 1) << endl;
    else cout << sum << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        mut a: [u64; n+1],
        b: [u64; n],
    }

    let mut tmp;
    let mut ans = 0;
    for i in 0..n {
        if a[i] > b[i] {
            a[i] = a[i] - b[i];
            tmp = 0;
            ans = ans + b[i];
        } else {
            tmp = b[i]-a[i];
            ans = ans + a[i];
        }

        if tmp > a[i+1] {
            ans = ans + a[i+1];
            a[i+1] = 0;
        } else {
            a[i+1] = a[i+1]-tmp;
            ans = ans + tmp;
        }
        //println!("{}", ans);

    }

    println!("{}", ans);


}




Measured memory_bytes: 6396
package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scan(&n)
  m := make(map[int]int)
  var d int
  for i := 0; i < n; i++ {
    fmt.Scan(&d)
    m[d]++
  }

  ans := 0
  for i := 1; i <= 100; i++ {
    if m[i] > 0 {
      ans++
    }
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int mape[505][505]={0};
int ans[505][505]={0};
int main(){
	int n,m,q;
	scanf("%d %d %d",&n,&m,&q);
	for(int i=0;i<m;i++){
		int l,r;
		scanf("%d %d",&l,&r);
		mape[l][r]++;
	}
	for(int i=1;i<=500;i++){
		for(int j=1;j<=500;j++){
			ans[i][j]=ans[i][j-1]+mape[i][j]; 
		}
	}
	for(int i=500;i>=1;i--){
		for(int j=1;j<=500;j++){
			ans[i][j]+=ans[i+1][j]; 
		}
	}
	for(int i=0;i<q;i++){
		int l,r;
		scanf("%d %d",&l,&r);
		printf("%d\n",ans[l][r]);
	}
} 

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
const double PI = acos(-1);
typedef long long ll;


int main(void){
    int N;cin>>N;
    VI s(N);
    int ans=0;
    REP(i,N){
        cin>>s[i];
        ans+=s[i];
    }

    sort(All(s));
    int no=0;
    REP(i,N){
        if(s[i]%10!=0){
            no=s[i];
            //cout<<no<<endl;
            break;
        }
    }

    if(ans%10!=0)cout<<ans<<endl;
    else if(no==0)cout<<0<<endl;
    else cout<<ans-no<<endl;

}




Measured memory_bytes: 256