akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S;
	cin >> S;

	int a = (S[0] - '0') * 10+(S[1]-'0');
	int b = (S[2] - '0') * 10 + (S[3] - '0');


	//cout << a << " " << b << endl;
	if (a <= 12 && b <= 12 && b!=0 && a!=0) {
		cout << "AMBIGUOUS" << endl;
	}
	else if ((a > 12 || a==0) && b <= 12 && b!=0) {
		cout << "YYMM" << endl;
	}
	else if (a <= 12 && (b > 12 || b==0) && a!=0) {
		cout << "MMYY" << endl;
	}
	else{
		cout << "NA" << endl;
	}


	
	return 0;
}



Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
vector<int>gr[maxn];
int vis[maxn];
int par[maxn];
void solve()
{
    int n,m;
    cin>>n>>m;
    rep0(i,m){
        int x,y;
        cin>>x>>y;
        gr[x].pb(y);
        gr[y].pb(x);
    }
    rep1(i,n) vis[i]=1;
    queue<int>q;
    q.push(1);
    vis[1]=0;
    while((int)(q.size())){
        int tt=q.front();
        q.pop();
        for(auto x:gr[tt]){
            if(vis[x]){
                vis[x]=0;
                q.push(x);
                par[x]=tt;
            }
        }
    }
    rep1(i,n){
        if(vis[i]){
            cout<<"No";
            return;
        }
    }
    cout<<"Yes\n";
    repp(i,2,n+1) cout<<par[i]<<"\n";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // srand(time(0));
    //freopen("sp.txt","r",stdin);
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 13804
#include <bits/stdc++.h>
#include <math.h>
#include <regex>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
ld n , d;
vector<vector<ld>> x(n,vector<ld>(d));

int main(){
    ll k; cin >> k;
    ll ans = 0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += __gcd(i,__gcd(j,l));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll n,m,v,p;
    cin>>n>>m>>v>>p;

    vector<ll>a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(all(a),greater<ll>());

    vector<ll>pref(n+1,0);
    for(int i=0;i<n;i++)
    {
        pref[i+1] = pref[i] + a[i];
        // cout<<pref[i+1]<<" ";
    }

    int ans = p;
    for(int i=p;i<n;i++)
    {
        if( p+n-i-1 >= v )
        {
                // cout<<i,nl;
            if( a[i] + m >= a[p-1] )
            {
                ans++;
            }
        }
        else
        {
            int extra = v-p-n+i+1;
            // nl;nl;
            // cout<<i<<" "<<extra,nl;
            ll total = pref[i] - pref[p-1] + m*extra;
            if( a[i] + m < a[p-1] ) continue;
            if( total <= (a[i]+m)*(i-p+1) )
            {
                // cout<<i,nl;
                ans++;
            }
        }
    }
    cout<<ans,nl;
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>

int main()
{
	int i;
	int K;
	int A, B;

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

	for (i = 1; i <= 1000; i++) {
		if ((i*K >= A) && (i*K <= B)) {
			printf("OK\n");
			break;
		}
	}
	if (i == 1001) {
		printf("NG\n");
	}

	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;

void solve()
{
   int n;
   cin>>n;
   int a;
   int ans=0;
   fr(i,n)
   {
       
       cin>>a;
       if(i%2==0)
       {
           if(a&1)
           ans++;
       }
   }
   cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    // cin >> t
    t = 1;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,m,i,j,k,p,ans=0;
    cin >> n >> m;
    vector<int> suki(m,0);
    for(i=0;i<n;i++){
        cin >> k;
        for(j=0;j<k;j++){
            cin >> p;
            suki.at(p-1)++;
        }
    }
    for(i=0;i<m;i++){
        if(suki.at(i)==n) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    string sa,sb,sc; cin >> sa >> sb >> sc;
    char tmp='a';
    while(true){
        if (tmp=='a') {
            if (sa=="") {
                cout << 'A' << endl;
                return 0;
            }
            else{
                tmp=sa[0];
                sa.erase(sa.begin());
            }
        }
        if (tmp=='b') {
            if (sb=="") {
                cout << 'B' << endl;
                return 0;
            }
            else{
                tmp=sb[0];
                sb.erase(sb.begin());
            }
        }
        if (tmp=='c') {
            if (sc=="") {
                cout << 'C' << endl;
                return 0;
            }
            else{
                tmp=sc[0];
                sc.erase(sc.begin());
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> vi;
int main(){
    int l,r,d;
    int cnt=0;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++){
            if(i%d==0) cnt++;
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3600
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(a)<sum(b):
    print(-1)
    exit()
c = []
for i in range(n):
    c.append(a[i]-b[i])
c.sort()
#print(c)
i = 0
j = n-1
ans = 0
while c[i] < 0:
    if i == 0:
        ans += 1
    if c[j] + c[i] > 0:
        c[j] += c[i]
        i += 1
        ans += 1
    else:
        c[i] += c[j]
        ans += 1
        j -= 1
#print(c)
print(ans)

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

int _partition(int *A, int p, int r) {
    int x = A[r];
    int i = p-1;
    for(int j=p; j<r; j++) {
        if(A[j]<=x) {
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

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

    int par = _partition(A, 0, n-1);
    
    for(int i=0; i<n; i++) {
        if(i==par) {
            cout << "[" << A[i] << "]";
        }
        else {
            cout << A[i];
        }
        if(i!=n-1) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}


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

vector<int> X;
vector<vector<int>> Y;
int ans;

void dfs(int x) {
  if (X.at(x) != 1) return;
  int y = 1;
  while(!Y.at(x).at(y)) y++;
  X.at(x)--, X.at(y)--;
  Y.at(x).at(y) = Y.at(y).at(x) = 0;
  ans++;
  dfs(y);
}

int main() {
  int N, M;
  cin >> N >> M;
  X.resize(N + 1);
  Y.resize(N + 1, vector<int>(N + 1));
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    X.at(a)++, X.at(b)++;
    Y.at(a).at(b)++, Y.at(b).at(a)++;
  }

  for (int i = 1; i <= N; i++) dfs(i);

  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
  bool t=true;
  string s;
  cin >> s;
  int n=s.size();
  rep(i,s.size()/2){
    if (s[i]!=s[n-i-1]) t=false;
  }
  rep(i,n/2){
    if (s[i]!=s[(n-3)/2-i]) t=false;
    if (s[(n+1)/2+i]!=s[n-i-1]) t=false;
  }
  if (t) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,m,k;
    scanf("%d%d",&n,&m);
    k=n%500;
    if(k<=m)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>

int main(){
	double a, b, c, d, e, f;
	while (std::cin >> a >> b >> c >> d >> e >> f){
		double x, y;
		y = (a*f - c*d) / (a*e - b*d);
		x = (c - b*y) / a;
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1280
def minkovsky(A,B,n = 0):
    C = [abs(a - b) for a , b in zip(A,B)]
    if n == 0:
        return max(C)
    else:
        d = 0
        for c in C:
            d += c ** n
        d = d ** (1 / n)
        return d
            
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

print(minkovsky(A,B,1))
print(minkovsky(A,B,2))
print(minkovsky(A,B,3))
print(minkovsky(A,B))


Measured memory_bytes: 5648
#include<bits/stdc++.h>
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define tests(t) int t; cin >> t; while(t--)
#define ll long long
#define EPS 1e-9
#define mod 1000000007
#define MOD 1000000007
#define N 200005
using namespace std;
#define mod 1000000007
int main()
{int m,n;
    cin>>m>>n;
   string  mat[m],s;
    int dp[m+1][n+1]={};
    for(int i=0;i<m;i++)
    {
    	cin>>s;
    	mat[i]=s;
    }
	
	dp[0][0]=1;
    for(int i=0;i<m;i++)
    {
    	for(int j=0;j<n;j++)
    	{
    		if(mat[i][j]=='#')
    		continue;
    		if(i>0)
    		dp[i][j]+=dp[i-1][j]%mod;
    		if(j>0)
    			dp[i][j]+=dp[i][j-1]%mod;
    	}
    }
  
    cout<<dp[m-1][n-1]%mod;
    return 0;
}



Measured memory_bytes: 5248
import sys
from collections import deque

def main():
    input = sys.stdin.readline

    s = input()[:-1]
    q = int(input())
    tmp = [input().split() for _ in range(q)]

    flag = 0
    ans = deque([s])
    for t in tmp:
        if len(t) == 1:
            flag = ~flag 
        else:
            f = int(t[1])
            c = t[2]
            if (f == 1 and flag == 0) or (f ==2 and flag == -1):
                ans.appendleft(c)
            else:
                ans.append(c)
    if flag == 0:
        print(''.join(ans))
    else:
        print(''.join(ans)[::-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 42996
A, B = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


print(len(set(prime_factorize(gcd(A, B)))) + 1)

Measured memory_bytes: 3064
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  var data = new Number( chunk.replace( '\n', '' ) );
  var s = Math.PI*data*data;
  var r2 = Math.PI*data*2;
  console.log( '%d %d', s.toFixed( 6 ), r2.toFixed( 6 ) );
});

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

int main() {
  int n,k;
  cin>>n>>k;
  bool a[n];
  for(int i=0; i<n; i++) a[i]=true;

  for(int i=0; i<k; i++) {
    int d;
    cin>>d;
    for(int j=0; j<d; j++) {
      int get;
      cin>>get;
      a[get-1] = false;
    }
  }

  int ans = 0;
  for(int i=0; i<n; i++) {
    if(a[i]) ans++;
  }

  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 3636
//package arc086;

import java.io.*;
import java.util.*;

public class Main {
    public FastScanner in;
    public PrintWriter out;

    public void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] counter = new int[n + 1];
        for (int i = 0; i < counter.length; i++) counter[i] = 0;
        for (int i = 0; i < n; i++) counter[in.nextInt()]++;
        int numbers = 0;
        for (int i = 0; i < counter.length; i++) {
            if (counter[i] > 0) numbers++;
        }
        Arrays.sort(counter);
        int ans = 0;
        for (int i = 0; i < counter.length; i++) {
            if (counter[i] == 0) continue;
            if (numbers - k <= 0) break;
            ans += counter[i];
            numbers--;
        }
        out.println(ans);
    }

    public void runIO() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    public void run() {
        try {
            in = new FastScanner(new File("input.txt"));
            out = new PrintWriter(new File("output.txt"));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }

        solve();

        out.close();
    }

    public class FastScanner {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public FastScanner(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public FastScanner(File file) {
            try {
                reader = new BufferedReader(new FileReader(file));
            } catch (FileNotFoundException e) {
                throw new RuntimeException(e);
            }
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}


Measured memory_bytes: 45268
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		ArrayList<Program> programs = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int start = sc.nextInt();
			int end = sc.nextInt();
			int channel = sc.nextInt();
			programs.add(new Program(start, end, channel));
		}
		sc.close();
		Collections.sort(programs, new ComparatorProgram());

		for (int i = 1; i < programs.size(); i++) {
			if (programs.get(i).getStart() == programs.get(i - 1).getEnd() && programs.get(i).getChannel() == programs.get(i - 1).getChannel()) {
				programs.get(i - 1).setEnd(programs.get(i).getEnd());
				programs.remove(i);
				i--;
			}
		}

		HashMap<Integer, Integer> timeTable = new HashMap<>();
		int answer = 0;
		for (Program program : programs) {
			for (int d = program.getStart() - 1; d < program.getEnd(); d++) {
				if (timeTable.containsKey(d)) {
					timeTable.put(d, timeTable.get(d) + 1);
					answer = Math.max(timeTable.get(d), answer);
				} else {
					timeTable.put(d, 1);
					answer = Math.max(answer, 1);
				}
			}
		}

		System.out.println(answer);
	}
}

class Program {
	private int start;
	private int end;
	private int channel;
	public Program(int start, int end, int channel) {
		this.start = start;
		this.end = end;
		this.channel = channel;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getEnd() {
		return end;
	}
	public void setEnd(int end) {
		this.end = end;
	}
	public int getChannel() {
		return channel;
	}
}

class ComparatorProgram implements Comparator<Program> {
	@Override
	public int compare(Program prog1, Program prog2) {
		if (prog1.getChannel() < prog2.getChannel()) {
			return -1;
		} else if (prog1.getChannel() > prog2.getChannel()) {
			return 1;
		} else {
			if (prog1.getStart() < prog2.getStart()) {
				return -1;
			} else if (prog1.getStart() > prog2.getStart()) {
				return 1;
			} else {
				return 0;
			}
		}
	}
}

Measured memory_bytes: 159348
#include <iostream>

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

using namespace std;

int a[100000];

int main(){
	rep(i,100000){
		a[i] = -1;
	}
	int N;
	cin >> N;
	int ans=0;
	rep(i,N){
		int c;
		cin >> c;
		c--;
		if(a[c]==i){
			ans++;
		}
		a[i]=c;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll func(ll n){
    if(n==1)
    return 1;
    return 2*func(n/2)+1;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h;
    cin>>h;
    cout<<func(h);
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ldb;
typedef unsigned int ui;
typedef unsigned long ul;
 
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
typedef priority_queue<pi> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound


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

ll x,k,d;
cin>>x>>k>>d;

x=abs(x);
ll steps=x/d;
if(steps>k){
	cout<<x-(k*d);
}
else{
	ll pos=x%d;
	ll neg=abs(x%d-d);
	k-=steps;
	if(k%2==0) cout<<pos;
	else cout<<neg;
}



return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   

using namespace std;
#define i64  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807


void rep_s(string & str,int A,int B,string str_t)
{
  for (int i = A; i <=B; i++)
  {
    str[i] = str_t[i - A];
  }
  return;
}

void inv(string & str, int A, int B)
{
  string str_r (B - A + 1,'a');

  for (int i = A; i <= B; i++)
  {
    str_r[i - A] = str[i];
  }
  
  for (int i = A; i <= B; i++)
  {
    str[i] = str_r[B -i];
  }

  return;
} 

void prt_s(string & str, int A, int B)
{
  for (int i = A; i <= B; i++)
  {
    cout<<str[i];
  }

  cout<<endl;

  return;
  
}
void solve(void)
{
  string str;
  int M;
  cin>>str>>M;

  for (int i = 0; i <M; i++)
  {
    string opp;
    string reprace;
    int A,B;
    cin>> opp;
    if(opp == "reverse")
    {
      cin>>A>>B;
      inv(str,A,B);
    }
    else if(opp == "print")
    {
      cin>>A>>B;
      prt_s(str,A,B);
    }
    else
    {
      cin>>A>>B>>reprace;
      rep_s(str,A,B,reprace);
    }
  }
  

  return;
}

int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3184
using System;
public class program{
    public static void Main(){
    
        var tapdance = Console.ReadLine();
        var count = tapdance.Length;
        var answer = "Yes";
      
        for(var i = 0; i < count; i ++)
        {
           	if(i % 2 == 0) //偶数
           	{
           		if(tapdance[i] == 'L') // Lを含んでいたら"No"
           		{
                    answer = "No";   
                    break;
                } 
           	}
            else //奇数
            {
                if(tapdance[i] == 'R') // Rを含んでいたら"No"
                {
                     answer = "No";
                     break;
                }
            }        	
        }
		Console.WriteLine(answer); 
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int bin(int a[],int size_in ,int x);
int main()
{
   int *a,size_original,size_choice,*b;
   cin>>size_original;
   a=(int *)calloc(sizeof(int),size_original);
   for(int i=0;i<size_original;i++)
    cin>>a[i];
   cin>>size_choice;
   b=(int *)calloc(sizeof(int),size_choice);
   for(int i=0;i<size_choice;i++)
    cin>>b[i];
   for(int i=0;i<size_choice;i++)
   cout<<bin(a,size_original,b[i])<<endl;
    return 0;
}
int bin(int a[],int size_in ,int x)
{
    int high=size_in-1,low=0,mid;
    while(low<=high)
    {
        mid=(low+high)/2;
        if(x<a[mid])
            high=mid-1;
        else if(x==a[mid])
            return 1;
            else
                low=mid+1;
    }
        return 0;
}



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

int main()
{
    int n,y;
    int a,b,c;

    cin >> n >> y;

    a = b = c = -1;
    for (int i = 0;i <= n;++i)
        for (int j = 0;j <= n-i;++j) {
            int k = n - i - j;
            if (k >= 0 && k <= n)
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    a = i;
                    b = j;
                    c = k;
                    goto OWARI;
                }
        }

 OWARI:
    cout << a << " " << b << " " << c << endl;

    return(0);
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "consonant";
            if (sS == "a" || sS == "i" || sS == "u" || sS == "e" || sS == "o" ) { sOut = "vowel"; }

            // 出力
            Console.WriteLine("{0}", sOut.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
# -*= coding: utf-8 -*-
from collections import deque

N, X, Y = map(int, input().split())

d = deque() # 初期化

ans = [0] * N

# BFS
for i in range(N):
  # 0 〜 N-1の各頂点からスタート
  
  cost = [-1] * N
  cost[i] = 0
  d.append(i) # 基準とする頂点をノードiにする
  
  while len(d) > 0:
    # dequeueが空でない間ループ
    
    # 現在のノードのインデックス
    current = d.popleft()
    
    if current - 1 >= 0 and cost[current - 1] == -1:
      # 1つ前のノードを登録
      
      d.append(current - 1)
      cost[current - 1] = cost[current] + 1
      
    if current + 1 < N and cost[current + 1] == -1:
      # 1つ後ろのノードを登録
      
      d.append(current + 1)
      cost[current + 1] = cost[current] + 1
      
    if current == X - 1 and cost[Y - 1] == -1:
      # XからYへのルートを登録
      
      d.append(Y - 1)
      cost[Y - 1] = cost[current] + 1
    
    if current == Y - 1 and cost[X - 1] == -1:
      # YからXへのルートを登録
      
      d.append(X - 1)
      cost[X - 1] = cost[current] + 1
      
  # この時点でcostにはノードiから各ノードへの最小コストが格納されている
  
  #print(cost)
  for j in range(N):
    ans[cost[j]] += 1

for i in range(1, N):
  print(ans[i]//2) # ノードA→Bと、逆向きのB→Aが、両方カウントされているので2分の1する

Measured memory_bytes: 111004
n = gets.to_i
a,b = n.times.map{gets.split.map(&:to_i)}.transpose
a.sort!
b.sort!

if n % 2 == 1
  puts b[n/2]-a[n/2]+1
else
  am = (a[n/2]+a[n/2-1])/2.0
  bm = (b[n/2]+b[n/2-1])/2.0
  puts ((bm-am)*2+1).to_i
end

Measured memory_bytes: 33000
#include<iostream>
#include<map>
#include<list>
#include<stack>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

int main(){
	int X,A,B;
	
	cin >> X >> A >>B;
	
	X -= A;
	while(1){
		if(X < B)break;
		X -= B;
	}
	
	cout << X << endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]
sall = lambda: sys.stdin.readlines() # no strip

#from math import gcd
from fractions import gcd


def main():
    n, xx = na()
    xs = na()
    xs = [abs(x - xx) for x in xs]

    if len(xs) == 1:
        print(xs[0])
        return
    
    m = float('inf')
    v = xs[0]
    for x in xs[1:]:
        m = min(m, gcd(x, v))

    print(m)

main()


Measured memory_bytes: 16276
#include <iostream>
#include <cstdio>
using namespace std;
#define MAXN 1000
#define NIL -1

struct Node{
	int p, l, r;
}T[MAXN];

int n;

void preOrder(int u){
	if (u == NIL) {
		return;
	}
	printf(" %d", u);
	preOrder(T[u].l);
	preOrder(T[u].r);
}

void inOrder(int u){
	if (u == NIL) {
		return;
	}
	inOrder(T[u].l);
	printf(" %d", u);
	inOrder(T[u].r);
}

void postOrder(int u){
	if (u == NIL) {
		return;
	}
	postOrder(T[u].l);
	postOrder(T[u].r);
	printf(" %d", u);
}

int main(int argc, char *argv[]) {
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) {
		T[i].p = NIL;
	}
	
	int v, l, r;
	for (int i = 0; i < n; i++) {
		
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if (l != NIL) {
			T[l].p = v;
		}
		if (r != NIL) {
			T[r].p = v;
		}
	}
	int root = 0;
	for (int i = 0; i < n; i++) {
		if (T[i].p == NIL) {
			root = i;
		}
	}
	//printf("%d %d\n", root, T[root].p);
	printf("Preorder\n");
	preOrder(root);
	printf("\n");
	printf("Inorder\n");
	inOrder(root);
	printf("\n");
	printf("Postorder\n");
	postOrder(root);
	printf("\n");
	return 0;
}


Measured memory_bytes: 3212
N = int(input())
S = input()

pin = [[[False] * 11 for _ in range(11)] for _ in range(11)]

for i in range(0, N):
    c = int(S[i])
    for a in range(10):
        for b in range(10):
            if pin[a][b][-1]:
                pin[a][b][c] = True
        if pin[a][-1][-1]:
            pin[a][c][-1] = True
    pin[c][-1][-1] = True

ans = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            ans += int(pin[a][b][c])

print(ans)

Measured memory_bytes: 3188
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out, true);
    public static long n, m;
    public static long[] a;

    public static long gcd(long a, long b) {
        while (b > 0) {
            long c = a % b;
            a = b;
            b = c;
        }
        return a;
    }

    public static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    public static void Input() {
        n = sc.nextLong();
        m = sc.nextLong();
        a = new long[(int) n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            a[i] /= 2;
        }
    }

    public static void Solve() {
        long x = a[0];
        for (int i = 1; i < n; i++) {
            x = lcm(x, a[i]);
            if (x > m) {
                out.println(0);
                return;
            }
        }

        for (int i = 0; i < n; i++)
            if ((x / a[i]) % 2 == 0) {
                out.println(0);
                return;
            }

        long res = (m / x - 1) / 2 + 1;
        out.println(res);
    }

    public static void main(String[] args) {
        Input();
        Solve();
    }
}


Measured memory_bytes: 50576
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	string S;
	cin>>S;
	int l=(int)S.length();
	bool ac=false;
	rep(i,l-1)if(S[i]=='A'&&S[i+1]=='C')ac=true;
	if(ac)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	N := read()
	A := readArray(N)

	for _, x := range A {
		if x%2 == 0 {
			if x%3 != 0 && x%5 != 0 {
				fmt.Println("DENIED")
				return
			}
		}
	}

	fmt.Println("APPROVED")
}

func read() int {
	var v int
	fmt.Scan(&v)
	return v
}

func readArray(length int) []int {
	result := make([]int, length)
	for i := 0; i < length; i++ {
		result[i] = read()
	}

	return result
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ABC126
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int first = int.Parse(S.Substring(0, 2));
            int second = int.Parse(S.Substring(2, 2));
            if (first == 0 && second > 12)
            {
                Console.WriteLine("NA");
            }
            else if (first > 12 && second == 0)
            {
                Console.WriteLine("NA");
            }
            else if (first == 0 && second == 0)
            {
                Console.WriteLine("NA");
            }
            else if (first <= 12 && second == 0)
            {
                Console.WriteLine("MMYY");
            }
            else if (first == 0 && second <= 12)
            {
                Console.WriteLine("YYMM");
            }
            else if (first > 12 && second <= 12)
            {
                Console.WriteLine("YYMM");
            }
            else if (first <= 12 && second > 12)
            {
                Console.WriteLine("MMYY");
            }
            else if (first <= 12 && second <= 12)
            {
                Console.WriteLine("AMBIGUOUS");
            }
            else
            {
                Console.WriteLine("NA");
            }
        }
    }
}

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

bool check (string s) {
	for(int i = 0; i < s.length() - 1; i++)
		if(s[i] == s[i+1]) return false;
 	return true;
}

int main() {
  string s;
  cin >> s;
  if(check(s)) cout << "Good";
  else cout << "Bad";
}

Measured memory_bytes: 508
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
int K;
vector<ll> v;
void f(int cur,int len,ll val) {
	if(len==1) {
		v.push_back(val);
		return;
	}
	for(int i=-1;i<=1;i++) {
		if(cur+i<0||cur+i>=10)continue;
		f(cur+i,len-1,val*10+cur+i);
	}
}
void MAIN() {
	cin>>K;
	for(int i=1;i<=10;i++) {
		for(int j=1;j<10;j++) {
			f(j,i,j);
		}
	}
	cout<<v[K-1];
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 2420
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long k;

std::string s;

int main(){
    scanf("%ld", &k);
    std::cin >> s;
    if(s.length() <= k){
        std::cout << s << std::endl;
    }else{
        std::cout << s.substr(0, k) << "..." << std::endl;
    }
}


Measured memory_bytes: 3696
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  string D;
  cin>>D;
  for(int i=0;i+7<D.size();){
    string s=D.substr(i,8);
    sort(begin(s),end(s));
    string d="AIDUNYAN";
    sort(begin(d),end(d));
    if(s==d){
      D.replace(i,8,"AIZUNYAN");
      i+=8;
    }else{
      i++;
    }
  }
  cout<<D<<endl;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define RFOR(i, a, n) for (ll i = (ll)a; i >= n; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FOR(i, 1, n + 1)
#define RREP(i, n) RFOR(i, n - 1, 0)
#define RREPN(i, n) RFOR(i, n, 1)
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll extGCD(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1;
        y = 0;
        return a;
    }

    ll d = extGCD(b, a & b, y, x);
    y -= a / b * x;
    return d;
}

inline ll mod(ll &a, ll m)
{
    a = (a % m + m) % m;
    return a;
}

ll modinv(ll a, ll m)
{
    ll x, y;
    extGCD(a, m, x, y);
    return mod(x, m);
}

ll modadd(ll &a, ll b)
{
    mod(a, MOD);
    mod(b, MOD);
    a += b;
    return mod(a, MOD);
}

ll modsub(ll &a, ll b)
{
    return modadd(a, -b);
}

ll modmulti(ll &a, ll b)
{
    mod(a, MOD);
    mod(b, MOD);
    a *= b;
    return mod(a, MOD);
}

ll moddiv(ll &a, ll b)
{
    mod(a, MOD);
    a *= modinv(b, MOD);
    return mod(a, MOD);
}

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

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

//a,bの最大公約数
inline ll gcd(ll a, ll b)
{
    ll temp;
    while (a % b != 0)
    {
        temp = a;
        a %= b;
        b = temp;
    }
    return b;
}

//a,bの最小公倍数
inline ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

const int MAX_N = 1e5 + 10;

int main()
{
    int max = 1e5 + 10;
    ll N, a[max], x[max];
    cin >> N;
    for (int i = 0; i < N; ++i)
    {
        cin >> a[i];
    }

    for (int i = 0; i < N; ++i)
    {
        if(i % 2 == 1)
        {
            x[0] -= a[i];
        } else
        {
            x[0] += a[i];
        }
    }
    x[0] /= 2;

    for (int i = 1; i < N; ++i)
    {
        x[i] = a[i-1] - x[i-1];
    }

    for (int i = 0; i < N; ++i)
    {
        cout << 2 * x[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2816
h,w=gets.chomp.split(" ").map { |e| e.to_i }
s=h.times.map { gets.chomp.split("").map { |e| e.to_s }}

def func(a,b)
  if b=="#"
    return true
  end

  return false

end

def around_grid_squara(h,w,a,i,j)

  if 1 <= i
    if func(a[i][j],a[i-1][j])
      return true
    end
  end

  if i <= h-2
    if func(a[i][j],a[i+1][j])
      return true
    end
  end

  if 1 <= j
    if func(a[i][j],a[i][j-1])
      return true
    end
  end

  if j <= w-2
    if func(a[i][j],a[i][j+1])
      return true
    end
  end

return false

end



for i in 0..h-1 do
  for j in 0..w-1 do
    if s[i][j] == "#"
      if !around_grid_squara(h,w,s,i,j)
        puts "No"
        exit
      end
    end
  end
end


puts "Yes"


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

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    int a[6];
    fr(i, 1, 6) {
        cin >> a[i];
        if(a[i] == 0) {
            cout << i << nl;
            return;
        }
    }
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(int argc, char* argv[]){
  char w[100];
  scanf("%s",&w);
  int count[26]={};
  int i=0;
  while(1){
    if(w[i] == '\0') break;
    int pos;
    pos = w[i]-'a';
    count[pos]++;
    i++;
  }
  for(i=0;i<26;i++){
    if(count[i]%2 == 1){
      printf("No\n");
      return 0;
    }else continue;
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 10010010010
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main(){
    int n;
    string s; cin >> s;
    n = s.size();
    rep(i,n) cin >> s[i];
    vector<int> ans(n);
    
    rep(ri, 2){
        //solve
        int count = 0;
        rep(i, n){
            if(s[i] == 'R'){
                count++;
            }
            else{
                ans[i] += count/2;
                ans[i-1] += (count+1)/2;
                count = 0;
            }


        }
        
        
        
        




        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());
        rep(i, n){
            if(s[i] =='R') s[i] ='L';
            else s[i] = 'R';
        }

    }
    rep(i,n) {
        cout << ans[i] << endl;
    }
    return 0;


}


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

int main(){
    int N,K;
    cin>>N>>K;
    
    long long ans=0;
    for(int i=1;i<=N;i++){
        long long tmp=0;
        tmp+=(N/i)*max(i-K,0);
        tmp+=max(N%i-K+1,0);
        if(K==0&&tmp>1)tmp--;
        
        ans+=tmp;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a=[]
for _ in [0]*n:
  a += [list(input())]
b=[]
for _ in [0]*m:
  b += [list(input())]

for i in range(n-m+1):
  for j in range(n-m+1):
    if [k[j:m+j] for k in a[i:m+i]] == b:
      print("Yes")
      exit()
print("No")


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    long long X, A, B;
    cin >> X;
    for(int a = -118; a < 120; ++a){
        for(int b = -119; b < 119; ++b){
            if(X == a*a*a*a*a - b*b*b*b*b){
                A = a;
                B = b;
                break;
            }
        }
    }
    cout << A << " " << B << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,m;
int main(){
    cin>>n>>m;
    if(n>=13)
        cout<<m<<endl;
    else if(n>=6)
        cout<<m/2<<endl;
    else
        cout<<0<<endl;
    return 0;
}

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

int t[52];
main(){
	int n,p,c,i;
	while(cin>>n>>p,n){
		memset(t, 0, sizeof(t));
		for(c=0;;c=(c+1)%n){
			if(!p){
				p = t[c];
				t[c] = 0;
			}else{
				p--;
				t[c] ++;
				if(!p){
					for(i=0;i<n;i++) if(t[i] && i != c) break;
					if(i==n) break;
				}
			}
		}
		cout << c << endl;
	}
}

Measured memory_bytes: 864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using tuplis = array<ll, 3>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 0x1fffffffffffffff;
template<class T, class U> bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }

int main(){
    ll n, m, s;
    cin >> n >> m >> s;
    vector<vector<tuplis>> g(n);
    for(ll i = 0; i < m; i++){
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        g[u].push_back({v, a, b});
        g[v].push_back({u, a, b});
    }
    vector<ll> c(n), d(n);
    for(ll i = 0; i < n; i++) cin >> c[i] >> d[i];
    constexpr ll MAX = 2450;
    vector cost(n, vector(MAX + 1, INF)); // cost[i][j] = 頂点 i で銀貨 j 枚持っているときの最小時間
    vector used(n, vector(MAX + 1, false));
    pq<tuplis> q;
    chmin(s, MAX);
    cost[0][s] = 0;
    q.push({0, 0, s});
    while(q.size()){
        auto [time, at, coin] = q.top();
        q.pop();
        if(used[at][coin]) continue;
        used[at][coin] = 1;
        ll coin2 = coin + c[at], time2 = time + d[at];
        chmin(coin2, MAX);
        if(chmin(cost[at][coin2], time2)) q.push({time2, at, coin2});
        for(auto& i : g[at]){
            const ll at2 = i[0], coin2 = coin - i[1], time2 = time + i[2];
            if(coin2 < 0) continue;
            if(chmin(cost[at2][coin2], time2)) q.push({time2, at2, coin2});
        }
    }
    for(ll i = 1; i < n; i++) cout << *min_element(cost[i].begin(), cost[i].end()) << '\n';
}

Measured memory_bytes: 7416
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] list = new int[N];
		for (int i = 0; i < N; i++) {
			list[i]=sc.nextInt();
		}
		int J = 0;

		for(int i = 0; i < N; i++) {
			if(list[i]%2==0) {
				if(list[i]%3==0||list[i]%5==0) {
				}else {
					J = -1;
				}
			}else {
			}
		}

		if(J==0) {
			System.out.println("APPROVED");
		}else {
			System.out.println("DENIED");
		}
	}
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());

    map<pair<string, string>, lli> cnt1, cnt2;
    for (int bit = 0; bit < (1 << n); ++bit) {
      {
        string a, b;
        for (int i = 0; i < n; ++i) {
          if (bit & (1 << i)) {
            a += s[i];
          } else {
            b += s[i];
          }
        }
        reverse(b.begin(), b.end());
        ++cnt1[make_pair(a, b)];
      }
      {
        string a, b;
        for (int i = 0; i < n; ++i) {
          if (bit & (1 << i)) {
            a += s[n + i];
          } else {
            b += s[n + i];
          }
        }
        reverse(a.begin(), a.end());
        ++cnt2[make_pair(a, b)];
      }
    }
    lli sum = 0;
    each (i, cnt1) {
      sum += i.second * cnt2[i.first];
    }
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 103424