akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
const int null=-1;

struct Node{
	int parent;
	int child;
	int sibling;
	int depth;
	int degree;
};
Node *nodes;

int traceRoot(Node *nodes, int id){
	if(nodes[id].parent==null) return id;
	else return traceRoot(nodes, nodes[id].parent);
}

		


void setDepth( Node *nodes, int id, int d ){
	nodes[id].depth=d;
	if( nodes[id].sibling !=null ){
		setDepth( nodes, nodes[id].sibling, d );
	}
	if( nodes[id].child !=null ){
		setDepth( nodes, nodes[id].child, d+1 );
	}
	
}

void show(Node *nodes, int n){
	for( int id=0; id<n; id++ ){
		cout<<"node "<<id<<": "
			<<"parent = "<<nodes[id].parent<<", "
			<<"depth = "<<nodes[id].depth<<", ";
		if( nodes[id].parent==null ) cout<<"root, ";
		else if( nodes[id].child==null ) cout<<"leaf, ";
		else cout<<"internal node, ";

		cout<<"[";
		if( nodes[id].child !=null ){
			int tp=nodes[id].child;
			cout<<tp;
			for( int i=1; i<nodes[id].degree; i++ ){
				tp=nodes[tp].sibling;
				cout<<", "<<tp;
			}
		}
		cout<<"]"<<endl;

	}
}

int main()
{
	int n;cin>>n;
	nodes=new Node[n];

	for( int i=0; i<n; i++ ) nodes[i].parent=nodes[i].child=nodes[i].sibling=null;

	for( int i=0, id, deg, cld, prevcld; i<n; i++ ){
		cin>>id>>deg;
		nodes[id].degree=deg;
		
		if( deg>0 ){
			for( int j=0; j<deg; j++ ){ //??????????????????.
				cin>>cld;
				nodes[cld].parent=id; //?????????????????????????????????????????????
				
				if( j==0 ){
					nodes[id].child=cld; //????????????????????????????????????
				}else{
					nodes[prevcld].sibling=cld; //??????????????????????????????
				}
				prevcld=cld;
			}

		}
	}
	setDepth(nodes, traceRoot(nodes, 0) , 0);
	show(nodes, n);
}


		

Measured memory_bytes: 6256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
int main()
{
    ll a;
    cin>>a;
    double x=(double)a/3;
    printf("%.12lf",x*x*x);
  return 0;
}
/*
10 6
8 3 7 8 2 9 3 8 2 4


20 20
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a>c)cout<<"NO";
  else if(a+b>=c)cout<<"YES";
  else cout<<"NO";
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  
  int p = 1;
  for (int i = 0; i < N; i++) {
    if (i == 0) { 
      continue;
    }
    else if (vec.at(i) == vec.at(i-1)){
      continue;
    }
    else {
      p++;
    }
  }
  cout << p << endl;    
}


Measured memory_bytes: 256
s = input()
N = len(s)
c1 = 0
c2 = 0
for i in range(N):
    if i % 2 == 0:
        if s[i] != '0':
            c1 += 1
        else:
            c2 += 1
    else:
        if s[i] != '1':
            c1 += 1
        else:
            c2 += 1
print(min(c1, c2))


Measured memory_bytes: 3188
#include <iostream>
#include <array>
#include <string>
#include <vector>

using namespace std;

constexpr int SURFACE_NUM = 6;
enum {TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM};

class Dice {
private:
    array<int, SURFACE_NUM> m_surface;

public:
    // constructor
    Dice()
    {
        for (int i = 0; i < SURFACE_NUM; i++) {
            m_surface.at(i) = 0;
        }
    }

    Dice(array<int, SURFACE_NUM> surface)
        : m_surface(surface) {}

    Dice(const Dice& dice)
    {
        m_surface = dice.m_surface;
    }

    // getter
    int surface(int i) const
    {
        return m_surface.at(i);
    }

    // roll and spin
    void roll(char direction)
    {
        switch (direction) {
        case 'N':
            roll(TOP, FRONT, BOTTOM, BACK);
            break;
        case 'S':
            roll(TOP, BACK, BOTTOM, FRONT);
            break;
        case 'E':
            roll(TOP, LEFT, BOTTOM, RIGHT);
            break;
        case 'W':
            roll(TOP, RIGHT, BOTTOM, LEFT);
            break;
        }
    }

    void roll(int i, int j, int k, int l)
    {
        int tmp = m_surface.at(i);
        m_surface.at(i) = m_surface.at(j);
        m_surface.at(j) = m_surface.at(k);
        m_surface.at(k) = m_surface.at(l);
        m_surface.at(l) = tmp;
    }

    void spin()
    {
        int tmp = m_surface.at(FRONT);
        m_surface.at(FRONT) = m_surface.at(LEFT);
        m_surface.at(LEFT) = m_surface.at(BACK);
        m_surface.at(BACK) = m_surface.at(RIGHT);
        m_surface.at(RIGHT) = tmp;
    }

    // is equal
    bool isEqual(const Dice& dice)
    {
        for (int i = 0; i < 6; i++) {
            (i % 2)? (*this).roll('E'): (*this).roll('N');
            for (int j = 0; j < 4; j++) {
                (*this).spin();
                if (*this == dice) {
                    return true;
                }
            }
        }
        return false;
    }

    bool operator==(const Dice& dice)
    {
        for (int i = 0; i < SURFACE_NUM; i++) {
            if (m_surface.at(i) != dice.surface(i)) {
                return false;
            }
        }
        return true;
    }

    // debug
    void printDice() const
    {
        cout << surface(TOP) << surface(FRONT)
             << surface(RIGHT) << surface(LEFT)
             << surface(BACK) << surface(BOTTOM) << endl;
    }
};

array<int, SURFACE_NUM> inputDice();

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

    vector<Dice> dices(dice_num);
    for (auto i = 0; i < dice_num; i++) {
        Dice dice(inputDice());
        dices.at(i) = dice;
    }

    bool is_diff_all = true;
    for (int i = 0; i < dice_num - 1 && is_diff_all; i++) {
        for (int j = i + 1; j < dice_num; j++) {
            if (dices.at(i).isEqual(dices.at(j))) {
                is_diff_all = false;
                break;
            }
        }
    }

    cout << (is_diff_all? "Yes": "No") << endl;
}

array<int, SURFACE_NUM> inputDice()
{
    array<int, SURFACE_NUM> init;
    for (auto i = 0; i < SURFACE_NUM; i++) {
        cin >> init.at(i);
    }
    return init;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FOR(i,j,k) for(int i=j;i<k;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair < int, int > pii;
 
const int maxn=1e5+100, INF=1000000000+7;
 
ll sum=0;
 int n;
int a[maxn];

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    FOR(i,1,n+1){
        cin>>a[i];
        sum+=abs(a[i]-a[i-1]);
    }
    sum+=abs(a[n]);
    FOR(i,1,n+1){
        cout<<sum-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1])<<endl;
    }
    return 0;
}

Measured memory_bytes: 1664
N, L = (int(i) for i in input().split())

aji = []
for i in range(1, N+1):
    aji.append(L + i - 1)


ajisum = sum(aji)

res = 0
minres = 999999999
for x in aji:
    if minres > abs(x):
        minres = abs(x)
        res = ajisum - x

print(res)

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

const int MAX_N = (int)1e4 + 5;
const int MAX_S = (int)100 + 5;

int h, w;
int n;
int a[MAX_N];

int cnt;
vector<int> tvec = {};
int field[MAX_N];
vector<vector<int>> lfield;

int main(void){
  // Here your code !
  scanf("%d %d", &h, &w);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }

  cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < a[i]; ++j) {
      field[cnt] = i;
      cnt += 1;
    }
  }

  cnt = 0;
  for (int i = 0; i < h * w; ++i) {
    if (cnt % w == 0 && cnt != 0) {
      lfield.push_back(tvec);
      tvec = {};
    }
    tvec.push_back(field[i]);
    cnt += 1;
  }
  lfield.push_back(tvec);

  for (int i = 0; i < lfield.size(); ++i) {
    if (i % 2 == 1) reverse(lfield[i].begin(), lfield[i].end());

    for (int j = 0; j < lfield[i].size(); ++j) printf("%d ", lfield[i][j]);
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 384
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {

	int n,a,b;cin>>n>>a>>b;
	if((n*a)<=b)
		cout<<n*a<<endl;
	else
		cout<<b<<endl;








    return 0;
}


Measured memory_bytes: 256
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
town=set()
town.add(1)
town_ls=[1]
now=1
for i in range(min([K,N])):
  now=ls[now-1]
  if now in town:
    break
  town.add(now)
  town_ls.append(now)

if i+1==K:
  print(now)
else:
  L=i+1
  S=town_ls.index(now)
  loop=L-S
  #print(loop,S)
  x=(K-S)%loop+S
  print(town_ls[x])

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int C,D,W,X;
int E[15][30],F[15][30];

int dp[31][51][6];
int dfs(int day, int cost, int x)
{
    if(dp[day][cost][x]>=0) return dp[day][cost][x];
    if(day==D) return 0;

    int ret=0;

    // ??????????????????
    ret=max(ret,dfs(day+1,cost,x));

    rep(place,C)
    {
        if(E[place][day]==0) continue;

        // 1????????????
        if(cost+F[place][day]<=W) ret=max(ret,dfs(day+1,cost+F[place][day],x)+E[place][day]);

        // ?????°????????????
        if(x==X) continue;

        int tcost=cost+F[place][day];
        int tE=E[place][day];
        int now=place-1;
        while(now>=0)
        {
            if(E[now][day]==0) break;
            if(tcost+F[now][day]>W) break;

            tcost+=F[now][day];
            tE+=E[now][day];
            ret=max(ret,dfs(day+1,tcost,x+1)+tE);
            --now;
        }

        tcost=cost+F[place][day];
        tE=E[place][day];
        now=place+1;
        while(now<C)
        {
            if(E[now][day]==0) break;
            if(tcost+F[now][day]>W) break;

            tcost+=F[now][day];
            tE+=E[now][day];
            ret=max(ret,dfs(day+1,tcost,x+1)+tE);
            ++now;
        }
    }

    return dp[day][cost][x]=ret;
}

int main()
{
    while(scanf(" %d %d %d %d",&C,&D,&W,&X),C)
    {
        rep(i,C)rep(j,D) scanf(" %d", &E[i][j]);
        rep(i,C)rep(j,D) scanf(" %d", &F[i][j]);
        memset(dp,-1,sizeof(dp));
        printf("%d\n", dfs(0,0,0));
    }
    return 0;
}

Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            int v = sc.nextInt();
            int sum = 0;
            while (v % 2 == 0) {
                v /= 2;
                sum++;
            }
            res += sum;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 33572
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll x;
    cin >> x;

    if(x == 0){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
//defines
typedef long long ll;
typedef long double ld;
ll n,m,k,tar,a,b,d,e;
ll solve(ll t)
{
  ll v[3];
  for(ll i=0;i<3;i++)cin>>v[i];
  sort(v,v+3);
  if(v[0]==5 and v[1]==5 and v[2]==7)cout<<"YES"<<"\n";
  else cout<<"NO"<<"\n";
   //cout<<a<<" "<<b<<" "<<d<<" "<<e;
 //if(t>0)cout<<"\n";

}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
        solve(t);
    }
    
        
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main () {
    int x, y ;
    std::cin >> x >> y;
    int a = x + y;
    int s = x - y;
    int m = x * y;
    int an = std::max (a,s);
    int sw = std::max (an,m);
    std::cout << sw << std::endl;
}


Measured memory_bytes: 256
//16:00
//A,A+B,B,0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=998244353;
const int N=3e5+10;
ll P[N];
ll fast_pow(int a,int b)
{
	ll res=1,p=a;
	while(b>0){
		if(b&1)(res*=p)%=MOD;
		b>>=1;(p*=p)%=MOD;
	}return res;
}
ll C(int n,int m)
{
	ll res=P[n],b=P[n-m]*P[m]%MOD;
	return res*fast_pow(b,MOD-2)%MOD;
}
int main()
{
	//freopen("/home/zz7/CFInput","r",stdin);
	int n,a,b;ll k;scanf("%d%d%d%lld",&n,&a,&b,&k);
	P[0]=1;
	for(int i=1;i<=n;i++)P[i]=P[i-1]*i%MOD;
	ll ans=0;
	for(int i=0;i<=n;i++){
		ll op=k-1LL*i*a;
		if(op%b==0&&op/b>=0&&op/b<=n){
			(ans+=C(n,i)*C(n,op/b)%MOD)%=MOD;
		}
	}cout<<ans<<'\n';
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

 

int main() {
	int N; cin >> N;
	vector<int>a;
	for (int i = 0; i < N; i++) {
		int ipts;
		cin >> ipts;
		a.push_back(ipts);
	}
	int minscore = INF10;
	for (int i = -100; i <= 100; i++) {
		int sc = 0;
		for (int j = 0; j < N; j++) {
			sc += (i - a[j])*(i - a[j]);
		}
		minscore = min(minscore, sc);
	}
	print(minscore);



	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x >= r && x <= W - r && y >= r && y <= H - r ){
    printf("Yes\n");
  }else if(x >= r && x <= W - r && y >= r && y <= H - r  && x ==y){
    printf("Yes\n");
  } else if(x <= r){
    printf("No\n");
  }else if(x >= W -r){
    printf("No\n");
  }else if(y <= r){
    printf("No\n");
  }else if(y >= H - r){
    printf("No\n");
  }return 0;
}
 
 



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

const ll mod = 1000000007;

ll rui(ll p, ll k) {
    if(k == 1) {
        return p;
    }
    
    ll pro;
    if(k % 2 == 1) {
        ll r = rui(p,(k-1)/2);
        pro = r * r % mod;
        pro = pro * p % mod;
    }
    else {
        ll r = rui(p,k/2);
        pro = r * r % mod;
    }
    
    return pro;
}

int main() {
    ll x, y;
    cin >> x >> y;
    
    if((x+y)%3) {
        cout << 0 << endl;
        return 0;
    }
    
    ll n = (x+y) / 3;
    x -= n;
    y -= n;
    
    if(x < 0 || y < 0) {
        cout << 0 << endl;
        return 0;
    }
    
    ll mx, mn;
    mx = max(x, y);
    mn = min(x, y);
    
    ll c, p;
    c = p = 1;
    rep(i,mn) {
        c *= mx + mn - i;
        c %= mod;
        
        p *= mn - i;
        p %= mod;
    }
    //cout << c << endl;
    //cout << p << endl;
    
    p = rui(p,mod-2);
    
    cout << c * p % mod << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 3624
while True:
    H, W = map(int, raw_input().split())
    if (H+W) == 0:
        break
    cb1 = '#'
    cb2 = '.'
    for w in range(W-1):
        if (w % 2) == 0:
            cb1 += '.'
            cb2 += '#'
        else:
            cb1 += '#'
            cb2 += '.'

    for h in range(H/2):
        print cb1
        print cb2
    if (H % 2) != 0:
        print cb1
    print ""

Measured memory_bytes: 6344
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var N int
  NextInt(&N)
  X := make([]int, N)
  cnt := 0
  for i, s := range NextLine() {
    if s == '1' { X[i]++; cnt++ }
  }
  B := make([][]int, N)
  for i := range B { B[i] = make([]int, 2) }
  B[0] = []int{1, 1}
  for i := 1; i < N; i++ {
    B[i][0] = (B[i - 1][0] * 2) % (cnt + 1)
    if cnt > 1 { B[i][1] = (B[i - 1][1] * 2) % (cnt - 1) }
  }
  M := []int{0, 0}
  for i := 0; i < N; i++ {
    if X[N - i - 1] == 0 { continue }
    M[0] = (M[0] + B[i][0]) % (cnt + 1)
    if cnt > 1 { M[1] = (M[1] + B[i][1]) % (cnt - 1) }
  }
  C := make([]int, N)
  for i := 1; i < N; i++ {
    c, cnt := i, 0
    for c > 0 {
      c -= c & (-c)
      cnt++
    }
    C[i] = C[i % cnt] + 1
  }
  for i, x := range X {
    if x == 0 {
      Write(C[(M[0] + B[N - 1 - i][0]) % (cnt + 1)] + 1)
    } else if cnt > 1 {
      Write(C[(M[1] - B[N - 1 - i][1] + cnt - 1) % (cnt - 1)] + 1)
    } else {
      Write(0)
    }
  }
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntSlice(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatSlice(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(S ...interface{}) {
  fmt.Fprintln(writer, S...)
}
func WriteIntSlice(A []int) {
  B := make([]interface{}, len(A))
  for i, a := range A { B[i] = a }
  Write(B...)
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 15116
s = input()
ans = chk = 0
ans = [-1] * (len(s)+1)
if s[0] == "<":
    ans[0] = 0
if s[-1] == ">":
    ans[-1] = 0
for i in range(len(s) - 1):
    if s[i] == ">" and s[i+1] == "<":
        ans[i+1] = 0
for i in range(len(s)):
    if s[i] == "<":
        ans[i+1] = ans[i] + 1
for i in range(-1, -len(s)-1,-1):
    if s[i] == ">":
        ans[i-1] = max(ans[i-1], ans[i]+1)
print(sum(ans))


Measured memory_bytes: 23336
N = int(input())
X = list(map(int, input().split())) + [2020]
M = int(input())
A = list(map(int, input().split()))

for a in A:
    if X[a-1]+1 == X[a]: continue
    else: X[a-1] += 1
    
for x in X[:N]:
    print(x)


Measured memory_bytes: 5608
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	string s;
	cin >> s;

	int h1 = 1, h2 = 0, p = -1;
	vector<int> ans(s.size(), 0);
	for (int x = 1; x < s.size();x++) {
		if (s[x - 1] == 'R' && s[x] == 'L') {
			h2++;
			ans[x - 1] += h1;
			ans[x] += h2;
			h1 = h2 = 0;
			p = x;
		}
		else if(s[x]=='L'){
			ans[p - (x - p) % 2]++;
		}
		else {
			h2++;
		}
		swap(h1, h2);
	}


	rep(i, ans.size()) {
		if (i)cout << ' ';
		cout << ans[i];
	}
	cout << endl;



	return 0;
}

Measured memory_bytes: 1104
#include <iostream>
#include <vector>
#include <algorithm>
#define INPUT_FROM_FILE (0)

#if INPUT_FROM_FILE
#include <fstream>
#endif

#if INPUT_FROM_FILE
#define IS ifs
#else
#define IS std::cin
#endif

int main(int argc, char **argv) {
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;
	std::vector<int> v;
	int num_operations = 0;

	IS >> n;

	v.resize(n, 0);
	for(int i = 0; i < n; i++){
		IS >> v[i];
	}

	for(int i = 0; i < n; i++){
		for(int j = n - 1; j >= i + 1; j--){
			if(v[j] < v[j - 1]){
				std::swap(v[j], v[j - 1]);
				num_operations++;
			}
		}
	}

	for(int i = 0; i < n; i++){
		std::cout << v[i];
		if(i < n - 1){
			std::cout << " ";
		}
	}
	std::cout << std::endl;
	std::cout << num_operations << std::endl;

	return 0;
}

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


from math import sqrt

def divisor(num):
    max_num = int(sqrt(num))
    divisor_list = []
    for i in range(1, max_num + 1):
        if num % i == 0:
            divisor_list.append(i)
            divisor_list.append(num//i)
    sorted_divisor_list = sorted(divisor_list)
    return sorted_divisor_list

count=0
for num in range(1, n+1):
    if num % 2 == 0:
        continue
    if len(divisor(num)) == 8:
        count+=1

print(count)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();

		sc.close();

		int[] nc = new int[2000];
		for(int i = 1; i <= n; i++){
			for(int j = 2; j <= n; j++){
				if (i >= j) {
					continue;
				}
				int c1 = j - i;
				int c2 = Math.abs(i - x) + Math.abs(j - y) + 1;
				int c = Math.min(c1, c2);
				nc[c]++;
			}
		}

		for(int i = 1; i < n; i++) {
			System.out.println(nc[i]);
		}
	}
}


Measured memory_bytes: 23248
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <assert.h>
#include <string>
#include <unordered_map>
#define FIN freopen("input/in.txt", "r", stdin)
#define FOUT freopen("output/out.txt", "w", stdout)
using namespace std;
typedef long long LL;
typedef unsigned u;
typedef unsigned long long ull;
typedef long double ld;

const int MAXN = 2e5+5;
const int MAXM = 5e6+5;
const double eps = 1e-10;
const LL MOD = 998244353;

char s[MAXN];
char t[MAXN];
int cnt[30];

vector<string> ans;

int main() {

    int a, b;
    cin >> a >> b;
    cout << a + b/2 << endl;

    return 0;
}


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

using namespace std;

int main(){
 long long int a,b[100010],ans =0,ant=0;
  cin >> a;
  
  for(int i=0;i<a;i++)
   cin >> b[i];

  
  sort(b,b+a,greater<int>());
  
  for(int i=0;i<a;i++){
    
    if(b[i] == b[i+1]){
      if(ans ==0){
        ans =b[i];
      }
      else if(ant ==0){
        ant =b[i];
      }
      i++;
    }
  }
  
  cout << ans*ant << endl;
}
    
  


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

int main(){
    int64_t N;
    cin >> N;
    vector<int64_t> A(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> A.at(i);
    }
    vector<int64_t> count(N);
    for ( int64_t i = 0; i < N; ++i){
        count.at( A.at(i) - 1 ) += 1;
    }
    
    int64_t total = 0;
    for ( int64_t i = 0; i < N; ++i){
        total = total + count.at(i) * ( count.at(i) - 1 ) / 2;
    }
    
    /*for ( int i = 0; i < N; ++i){
        cout << count.at(i) << " ";
    }
    cout << endl;*/
    
    int64_t c = 0;
    for ( int64_t i = 0; i < N; ++i){
        c = count.at(A.at(i) - 1) - 1;
        cout << total - c << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 5760
X,A = map(int,input().split())
li = list(map(int,input().split()))	

d=[0]*(X+1)

for i in range(1,X+1):
    d[i] = li[i-1] + d[i-1]

count = 0

for i in range (0,X+1):
    if d[i] <= A:
      count = count + 1 
    
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}
map<P,int> mp;
vector<vector<int>> g;
vector<bool> v;
void dfs(int x, int k, int mx) {
    if (v[x]) return;
    v[x] = true;
    vector<bool> used(mx+10);
    used[0] = used[k] = true;
    for (auto &&e: g[x]) {
        if (v[e]) continue;
        int nx = 1;
        rep(i,mx+1) {
            if (!used[i]) {
                nx = i;
                break;
            }
        }
        int l = x; int r = e;
        if (l>r) swap(l,r);
        // cout << nx << endl;
        mp[P(l,r)] = nx;
        dfs(e,nx,mx);
        used[nx] = true;
    }
} 

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    g.resize(n); v.resize(n);
    vector<int> h(n),x(n-1),y(n-1);
    rep(i,n-1) {
        int a,b; cin>>a>>b;
        --a,--b;
        g[a].push_back(b); g[b].push_back(a);
        h[b]++; h[a]++;
        x[i] = a; y[i] = b;
    }
    int ans = 0;
    rep(i,n) chmax(ans,h[i]);
    dfs(0,ans+5,ans);
    cout << ans << endl;
    rep(i,n-1) {
        cout << mp[P(x[i],y[i])] << endl;
    }
    return 0;
}

Measured memory_bytes: 18816
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}


int main(){
    string s;cin >> s;
    // string s;
    // rep(i,8000){
    //     s += "F";
    // }
    ll x,y; cin >> x >> y;
    vector<ll> xv, yv;
    ll temp = 0;
    ll n = s.size();
    bool is_x = true;
    bool first = false;
    if(s[0] == 'F')first = true;
    rep(i,n+1){
        if(i == n){
            if(!temp)continue;
            if(is_x) xv.emplace_back(temp);
            else yv.emplace_back(temp);
            temp = 0;
        }
        if(s[i] == 'F')temp++;
        else{
            if(!temp){
                is_x = !is_x;
                continue;
            }
            if(is_x) xv.emplace_back(temp);
            else yv.emplace_back(temp);
            temp = 0;
            is_x = !is_x;
        }
    }

    // print(xv);
    // print(yv);
    ll MAX = 8080;
    ll xvs = xv.size(), yvs = yv.size();
    vvl dp_x(xvs+1, vl(2*MAX,0));
    vvl dp_y(yvs+1, vl(2*MAX,0));
    dp_x[0][MAX] = 1;
    rep(i,xvs){
        if(first && i == 0){
            dp_x[1][MAX+xv[0]] = 1;
            continue;
        }
        rep(j,2*MAX){
            if(dp_x[i][j]){
                dp_x[i+1][j+xv[i]] = 1;
                dp_x[i+1][j-xv[i]] = 1;
            }
        }
    }
    dp_y[0][MAX] = 1;
    rep(i,yvs){
        rep(j,2*MAX){
            if(dp_y[i][j]){
                dp_y[i+1][j+yv[i]] = 1;
                dp_y[i+1][j-yv[i]] = 1;
            }
        }
    }

    // rep(i,2*MAX){
    //     if(dp_x[xvs][i])print(i-MAX);
    // }

    cout << (dp_x[xvs][x+MAX] && dp_y[yvs][y+MAX] ? "Yes" : "No") << endl;

}

Measured memory_bytes: 505856
import java.util.*;

public class Main{

    public static int select(int A[],int N){
        int cnt=0;
        for(int i=0;i<N;i++){
            int minj=i;
            for(int j=i;j<N;j++){
                if(A[j]<A[minj]){
                    minj = j;
                }
            }
            if(minj!=i){
                int t=A[i];
                A[i]=A[minj];
                A[minj]=t;
                cnt++;
            }
        }
        return cnt;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        int count;
        A = new int[100];


        for(int i=0;i<N;i++){
            A[i] = sc.nextInt();
        }
        count=select(A,N);

        for(int i=0;i<N;i++){
            System.out.print(A[i]);
            if(i!=N-1)  System.out.print(" ");
        }
        System.out.println("\n"+count);

    }
}


Measured memory_bytes: 26292
import collections
N = int(input())
S = ['']*N
for T in range(0,N):
    S[T] = input()
Count = collections.Counter(S).most_common()
MaxC = Count[0][1]
Disp = []
for T in range(0,len(Count)):
    if Count[T][1] < MaxC:
        break
    Disp.append(Count[T][0])
print('\n'.join(sorted(Disp)))

Measured memory_bytes: 45028
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
arr.sort!.reverse!
odd = arr.each_slice(2).map(&:first)
even = arr.each_slice(2).map(&:last)
# p odd,even,arr.size
if arr.size.odd?
  even[-1] = 0
end
# p odd,even
p odd.inject(:+) - even.inject(:+)

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

long long BinarySearch(long long l, long long r, function<bool(long long)> f) {
  /* O(log(r-l) * O(f)) */
  /* Find the boundary T and F that satisfies (f(T)==true && f(F)==false && abs(T-F)==1). */
  bool fl = f(l), fr = f(r);
  assert(fl!=fr);
  long long &T = fl ? l : r;
  long long &F = fr ? l : r;
  while(r-l>1) {
    long long m = l + (r-l) / 2;
    if(f(m)) T = m;
    else F = m;
  }
  return T;
}

double BinarySearch(double l, double r, int iteration, function<bool(double)> f) {
  /* O(iteration * O(f)) */
  /* Find the boundary T and F that satisfies (f(T)==true && f(F)==false) for (iteration) times. */
  bool fl = f(l), fr = f(r);
  assert(fl!=fr);
  double &T = fl ? l : r;
  double &F = fr ? l : r;
  while(iteration--) {
    double m = l + (r-l) / 2;
    if(f(m)) T = m;
    else F = m;
  }
  return T;
}

signed main() {
#if 1 // https://atcoder.jp/contests/abc174/tasks/abc174_e
  int n,k; cin >> n >>k;
  vector<int> a(n);
  for(int i=0; i<n; ++i) cin >> a[i];

  auto f = [&](long long x) {
    if(x==0) return false;
    int kk = k;
    for(int i=0; i<n; ++i) kk -= (a[i] + x-1) / x - 1;
    return kk >= 0;
  };

  cout << BinarySearch(0, *max_element(a.begin(),a.end()), f) << endl;
#elif 1 // https://atcoder.jp/contests/arc050/tasks/arc050_b
  long long r,b; cin >> r >> b;
  int x,y; cin >> x >> y;

  auto f = [&](long long k) {
    return r>=k && b>=k && ((r-k) / (x-1) + (b-k) / (y-1) >= k);
  };

  cout << BinarySearch(0, max(r,b)+1, f) << endl;
#else // https://atcoder.jp/contests/abc034/tasks/abc034_d
  int n,k; cin >> n >> k;
  vector<double> w(n), p(n);
  for(int i=0; i<n; ++i) cin >> w[i] >> p[i];

  auto f = [&](double x) {
    vector<double> v(n);
    for(int i=0; i<n; ++i) v[i] = w[i] * (p[i] - x);
    sort(v.begin(), v.end(), greater<double>());
    double sum = accumulate(v.begin(), v.begin()+k, 0.0);
    return sum > 0;
  };

  cout << setprecision(12) << BinarySearch(0.0, 100.0, 100, f) << endl;
#endif
}


Measured memory_bytes: 4008
#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;

class Operand {
private:
	int stack[100] = {0};
	int state = 0;
public:
	void add(int x);
	int calc(char symbol);
};

void Operand::add(int x)
{
	stack[state] = x;
	state++;
}

int Operand::calc(char symbol)
{
	if (symbol == '+') {
		stack[state-2] = stack[state-2] + stack[state-1];
	} else if (symbol == '-') {
		stack[state-2] = stack[state-2] - stack[state-1];
	} else if (symbol == '*') {
		stack[state-2] = stack[state-2] * stack[state-1];
	} else {
	}
	state--;
	
	return stack[state-1];
}

int main(void)
{	
	Operand operand;
	
	char buf[200][8] = {"\0"};
	for (int i = 0; cin >> buf[i]; i++);
	
	int result;
	for (int i = 0; buf[i][0] != '\0'; i++) {
		if (buf[i][0] >= '0' && buf[i][0] <= '9') {
			operand.add(atoi(buf[i]));
		} else {
			result = operand.calc(buf[i][0]);
		}
	}
	
	cout << result << endl;
	
	return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll n;
    cin >> n;
    vll d(n);
    rep(i, n) cin >> d[i];

    if(d[0]!=0) cout << 0 << endl;
    else{
        sort(all(d));
        ll m = d[d.size()-1];
        vll c(m+1, 0);
        rep(i, n) ++c[d[i]];
        if(c[0]>1) cout << 0 << endl;
        else{
            ll a = 1;
            REP(i, 1, c.size()){
                if(c[i]==0){
                    cout << 0 << endl;
                    return 0;
                }
                rep(j, c[i]) a = a*c[i-1]%998244353;
            }
            cout << a << endl;
        }
    }
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();

		System.out.println(x*x*x);

		sc.close();
	}

}



Measured memory_bytes: 26020
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==1)
        {
            cout<<"first"<<endl;
            return 0;
        }
    }
    cout<<"second"<<endl;

}


Measured memory_bytes: 640
#include <iostream>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(0),cin.tie(0);
	
	ll a,b,c,k;
	ll result=0;
	cin>>a>>b>>c>>k;
	if(k&1==0)
	{
		result=a-b;
	}
	else if(k&1!=0)
	{
		result=b-a;
	}
	else
	{
		result=a-b;
	}
	cout<<result<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
#include <list>

using namespace std;

#define ll long long
#define ss stringstream
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define rep0(i,n) for(int (i)=0;(i)<(n);(i)++)

const ll INF=1000000000000000000;
ll n,a,b,h[1000050],l=1,r=1e9;
bool check(ll m){
	ll d=m*b;
	rep(i,n){
		if(d>h[i])continue;
		else{
			if((h[i]-d)%(a-b)==0)m-=(h[i]-d)/(a-b);
			else m=m-(h[i]-d)/(a-b)-1;
			if(m<0)return 0;
		}
	}
	return 1;
}
int main()
{
	ll ans;
	cin>>n>>a>>b;
	rep(i,n)cin>>h[i];
	while(l<=r){
		ll mid=(l+r)/2;	//cout<<mid<<' '<<l<<' '<<r<<' '<<check(mid)<<endl;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
		
	}

	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};



int main(){
    int n;
    while(cin >> n,n){
        vector<int> l(n),t(n),r(n),b(n);
        vector<int> x,y;
        for (int i = 0; i < n; i++) {
            cin >> l[i] >> t[i] >> r[i] >> b[i];
            x.pb(l[i]),x.pb(r[i]);
            y.pb(b[i]),y.pb(t[i]);
        }
        sort(ALL(x));x.erase(unique(ALL(x)),x.end());
        sort(ALL(y));y.erase(unique(ALL(y)),y.end());
        int w = 2*(2*n+2),h = 2*(2*n+2);
        vector<vector<int>> v(h,vector<int> (w,0));
        for (int i = 0; i < n; i++) {
            l[i] = 2*(lower_bound(ALL(x),l[i]) - x.begin() + 1);
            r[i] = 2*(lower_bound(ALL(x),r[i]) - x.begin() + 1);
            t[i] = 2*(lower_bound(ALL(y),t[i]) - y.begin() + 1);
            b[i] = 2*(lower_bound(ALL(y),b[i]) - y.begin() + 1);
            for (int j = l[i]; j <= r[i]; j++) {
                v[t[i]][j] = -1;
                v[b[i]][j] = -1;
            }
            for (int j = b[i]; j <= t[i]; j++) {
                v[j][l[i]] = -1;
                v[j][r[i]] = -1;
            }
        }
        queue<P> q;
        int ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if(v[i][j]!=0) continue;
                q.push(mp(i,j));
                while(!q.empty()){
                    int a = q.front().first, b = q.front().second;
                    q.pop();
                    if(v[a][b]) continue;
                    v[a][b] = 1;
                    for (int k = 0; k < 4; k++) {
                        int nx = b + dx[k], ny = a + dy[k];
                        if(0<=nx&&nx<w&&0<=ny&&ny<h){
                            if(!v[ny][nx]){
                                q.push(mp(ny,nx));
                            }
                        }
                    }
                }
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

ll N;
ll dfs(ll atama){
    if(atama>N)return 0;
    ll ans=dfs(atama*10+3)+dfs(atama*10+5)+dfs(atama*10+7);
    vector<bool> a(10,false);
    ll now=atama;
    while(now){
        a.at(now%10)=true;
        now/=10;
    }
    if(a.at(3) && a.at(5) && a.at(7))ans++;
    return ans;
}

int main() {
    cin>>N;
    cout<<dfs(0)<<endl;
}

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int a, b, c;
	cin>>a>>b>>c;
	cout<<(max(0, c-(a-b)))<<'\n';
	return 0;
}


Measured memory_bytes: 256
using System;

namespace AOJ.intro
{
    namespace ITP_1_4_B
    {
        public static class Circle
        {
            public static void Main()
            {
                double rad = double.Parse(Console.ReadLine());
                double Circumference = rad * rad * Math.PI;
                double CircleArea    = rad * 2 * Math.PI;
                Console.WriteLine(Circumference + "\n" + CircleArea);
            }
        }
    }
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int temp = k;
    int snake[n];
    int Di;
    
    for(int i=0;i<n;i++)
        snake[i] = 0;
        
    while(temp--){
        cin>>Di;
        int safe[Di];
        for(int j=0; j<Di; j++){
            cin>>safe[j];              //these are the safe snakes
            snake[safe[j] - 1] = 1;
        }
            
    }
    
    int count = 0;
    for(int i=0;i<n;i++){
        if(snake[i] == 0)
            count++;
    }
    
    cout<<count;
   return 0;
}


Measured memory_bytes: 3620
MOD = 1_000_000_007

N = gets.to_i
S = gets.strip

prev = '#'
i = 0
X = []
while i < N
  if S[i] == S[i + 1]
    X << 0
    i += 2
  else
    X << 1
    i += 1
  end
end

C = {}
C[[0, 0]] = 3
C[[0, 1]] = 1
C[[1, 0]] = 2
C[[1, 1]] = 2

ans = X[0] == 1 ? 3 : 6
X.each_cons(2) do |ar|
  ans = (ans * C[ar]) % MOD
end

puts ans

Measured memory_bytes: 3836
N, M = [int(item) for item in input().split()]

reg_list = [[int(item) for item in input().split()] for _ in range(M)]

cand = [11 for _ in range(N)]

is_flag = False

for i, v in reg_list:
    temp = cand[i-1]
    cand[i-1] = min(v, temp)
    if temp < 11 and v != temp:
        is_flag = True
    if i == 1 and v == 0:
        is_flag = True

# print(cand)

res = ''
for j, v in enumerate(cand):
    if v == 11 and j > 0:
        res += '0'
    elif v ==11 and j == 0:
        res += '1'
    else:
        res += str(v)

if is_flag and N >1:
    print(-1)
elif N == 1 and M > 1:
    print(-1)
elif N == 1 and M ==1:
    print(res)
elif N ==1 and M == 0:
    print(0)
else:
    print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

int main() {
    int n; cin >> n;
    vector<int> vec(n, 0);
    rep(i, n) cin >> vec[i];

    for (auto v: vec) {
        if (v % 2 == 0) {
            if ((v % 3 == 0) || (v % 5 == 0)) continue;
            else {
                puts("DENIED");
                return 0;
            }
        }
    }
    puts("APPROVED");
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int h[3][1000], n, i;
	scanf("%d", &i);
	for (n = 0; n < i; n++){
		scanf("%d %d %d", &h[0][n], &h[1][n], &h[2][n]);
	}
	for (n = 0; n < i; n++){
		if ((h[0][n]>=h[1][n])&&(h[0][n]>=h[2][n])){
			if ((h[0][n]*h[0][n])==(h[1][n]*h[1][n]+h[2][n]*h[2][n])){
				printf("YES\n");
			} else {printf("NO\n");}
		} else if	((h[0][n]<=h[1][n])&&(h[1][n]>=h[2][n])){
			if ((h[1][n]*h[1][n])==(h[0][n]*h[0][n]+h[2][n]*h[2][n])){
				printf("YES\n");
			} else {printf("NO\n");}
		} else if	((h[0][n]<=h[2][n])&&(h[1][n]<=h[2][n])){
			if ((h[1][n]*h[1][n]+h[0][n]*h[0][n])==(h[2][n]*h[2][n])){
				printf("YES\n");
			} else {printf("NO\n");}
		}
	}
	return 0;
}

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

std::string str;

int n;

int r,b;

int main(){

    std::cin>>n>>str;

    for(auto&& x:str){
        if(x=='R')r++;
        else b++;
    }

    if(r>b)std::cout<<"Yes"<<std::endl;

    else
    std::cout<<"No"<<std::endl;
    

    return 0;

}

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

int main(){
    while(1){
        string str;
        int m;
        cin>>str;
        if(str=="-")break;
        cin>>m;
        for(int i=0;i<m;i++){
            int h;
            cin>>h;
            char* c=new char[h];
            for(int j=0;j<h;j++){
                c[j]=str[j];
            }
            for(int k=h;k<str.length();k++){
                str[k-h]=str[k];
            }
            for(int j=0;j<h;j++){
                str[str.length()-h+j]=c[j];
            }
            delete[] c;
        }
        cout<<str<<endl;
    }
    return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>
#include <stack>

using namespace std;
typedef long long ll;

bool cmp(const pair<string, int> &a, const pair<string, int> &b)
{
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first < b.first;
}


int main() {
  int N;
  cin >> N;
  vector<pair<string, int>> vec(N);
  map<pair<string, int>, int> m;
  for (int i = 0; i < N; i++) {
    string a;
    int b;
    cin >> a >> b;
    m[{a, b}] = i;
    vec[i] = {a, b};
  }
  sort(vec.begin(), vec.end(), cmp);
  for (auto itr = vec.begin(); itr != vec.end(); itr++) {
    cout << m[*itr] + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// unionfind: 1-indexed
struct UnionFind{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    int n;

    UnionFind(int N) : par(N+1) { //最初は全てが根であるとして初期化
        n = N;
        for(int i = 0; i < N+1; i++) par[i] = -1;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry]; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        par[ry] = rx;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n, m, k; cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> friends(n+1), block(n+1), ans(n+1);
    for (int i = 0; i < n+1; i++){
        friends[i] = 0; block[i] = 0;
    }
    for (int i = 0; i < m; i++){
        int a, b; cin >> a >> b;
        friends[a] ++;
        friends[b] ++;
        uf.unite(a, b);
    }
    for (int i = 0; i < k; i++){
        int c, d; cin >> c >> d;
        if (uf.same(c, d)){
            block[c] ++; block[d] ++;
        }
    }

    for (int i = 1; i < n+1; i++){
        cout << uf.size(i) - friends[i] - block[i] - 1 << " ";
    }

}


Measured memory_bytes: 2432