akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

class PrimeNumber{
public:
    int N;
    vector<ll> primetable;

    void MakeTable(int n){
        N = n;
        vector<bool> v(n+1, true);
        v[0] = false;
        v[1] = false;
        for(int i=2; i<=n; i++){
            if(v[i]){
                int j = i*2;
                while(j <= n){
                    v[j] = false;
                    j += i;
                }
            }
        }
        for(int i=0; i<=n; i++){
            if(v[i]){
                primetable.push_back(i);
            }
        }
    }

    bool is_prime(ll n){
        ll m = sqrt(n);
        for(ll i=2; i*i<=m; i++){
            if(n%i == 0){
                return false;
            }
        }
        return true;
    }

    map<ll,int> factorization(ll n){
        map<ll,int> mp;
        for(ll i=2; i*i<=n; i++){
            while(n%i == 0){
                n /= i;
                mp[i]++;
            }
        }
        if(n > 1){
            mp[n]++;
        }
        return mp;
    }
};

int main(){
    ll n, p;
    cin >> n >> p;
    PrimeNumber PN;
    auto mp = PN.factorization(p);

    ll ans = 1;
    for(auto i : mp){
        ans *= max(1LL, (ll)pow(i.first, (i.second/n)));
    }
    cout << ans << endl;
    return 0;
}

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

long gcd(long x, long y){
    long r;
    if(x<y){
        swap(x,y);
    }
    while(y>0){
        r = x%y;
        x=y;
        y=r;
    }
    return x;
}
int main() {
    long a, b;
    cin >> a >> b;
    long ans, s;
    s = gcd(a,b);
    ans = a*b/s;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node{ int p,l,r;};

Node T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  cout<<"node "<<u<<": ";
  cout<<"parent = "<<T[u].p<<", ";
  cout<<"depth = "<<D[u]<<", "  ;

  if(T[u].p==NIL)cout<<"root, ";
  else if(T[u].l==NIL)cout <<"leaf, ";
  else cout<<"internal node, ";

  cout<<"[";

  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)cout<<", ";
    cout<<c;
  }
  cout<<"]"<<endl;
}

int rec(int u,int p){
  D[u]=p;
  
  if(T[u].r!=NIL)rec(T[u].r,p);
  if(T[u].l!=NIL)rec(T[u].l,p+1);
  return 0;
}

int main(){
  int i,j,d,v,c,l,r;
  cin>>n;
  for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
  for(i=0;i<n;i++){
    cin>>v>>d;
    for(j=0;j<d;j++){
      cin>>c;
      if(j==0)T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL)r=i;
  }

  rec(r,0);
  for(i=0;i<n;i++) print(i);
  return 0;
}



Measured memory_bytes: 7704
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    std::cin >> n;
    int ans=0;
    for (int i = 0; i < n; i++) {
        int l,r;
        std::cin >> l >> r;
        ans+=r-l+1;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
#define ll long long int
using namespace std;
int main(void) {
  char g[50][50];
  int h, w;
  cin>>h>>w;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin>>g[i][j];
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(g[i][j]=='#') {
	if((i-1>=0 and g[i-1][j]=='#') or (i+1<h and g[i+1][j]=='#') or(j-1>=0 and g[i][j-1]=='#') or(j+1<w and g[i][j+1]=='#')) {}
	else {
	  cout<<"No"<<endl;
	  return 0;
	}
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
import math
total = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        ans2 = math.gcd(i, j)
        for k in range(1, K+1):
            ans3 = math.gcd(ans2, k)
            #print(i, j, k, ans3)
            total += ans3
print(total)

Measured memory_bytes: 67784
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;
//x.substr(start, length);
/*
// Create a vector containing n 
//vectors of size m.  
    vector<vector<int> > vec( n , vector<int> (m, 0));  
*/
struct type{
    int k, i, j;
};
//to check if a no is prime or not?
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

// minimum subaaray sum of size k-sliding window approach
int findSubarray(int arr[], int n, int k)
{
	int window_sum = 0;
	int min_window = INT_MAX;
	int last = 0;
	for (int i = 0; i < n; i++)
	{
		window_sum += arr[i];
		if (i + 1 >= k)
		{
			if (min_window > window_sum)
			{
				min_window = window_sum;
				last = i;
			}
			window_sum -= arr[i + 1 - k];
		}
	}
	int sum=0;
	for(int i=last-k+1;i<=last;i++)
	{
	    sum+=arr[i];
	}
	return sum;
}
signed main() 
{
    fastio;
    //cout << fixed << setprecision(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<n-2;)
    {
        if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C')
        {
            i+=3;
            ans++;
        }
        else
        {
            i+=1;
        }
    }
    print(ans)
}


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

int main(){
  
  string str;  
  while(cin >> str, str!="0"){
    int sum = 0;
    for(char c: str)
      sum += c - '0';
    cout << sum << endl;
  }
  
  return 0;
}

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

int main() {
    ll a; cin >>a;
    long double b; cin >> b;
    ll c = (b+0.001)*100;
    ll d = a*c;
    ll e = d/100;
    cout << e << endl;
}

Measured memory_bytes: 3704
#ifndef ___Class_BIT
#define ___Class_BIT

// ------ Includes ------ //
#include <vector>
#pragma warning(disable : 4146)

// ------ Class ------ //
template <typename Type>
class BIT {
private:
	unsigned size_; std::vector<Type> v;
	Type sum(unsigned r) {
		Type ret = 0;
		while (r > 0) {
			ret += v[r];
			r -= r & (-r);
		}
		return ret;
	}
public:
	BIT() {};
	BIT(unsigned size__) {
		for (size_ = 1; size_ < size__;) size_ <<= 1;
		v.resize(size_ + 1, 0);
	}
	inline void add(unsigned i, Type x) {
		i++;
		while (i <= size_) {
			v[i] += x;
			i += i & -i;
		}
	}
	inline Type sum(unsigned l, unsigned r) {
		return sum(r) - sum(l);
	}
	bool operator[](unsigned x) {
		return sum(x, x + 1);
	}
};

#endif

#include <map>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int A, B, M;
int main() {
	while (cin >> A >> B >> M, A) {
		vector<string> v(B - A + 1);
		for (int i = A; i <= B; i++) v[i - A] = to_string(i);
		sort(v.begin(), v.end());
		vector<int> pos(B - A + 1);
		for (int i = 0; i < v.size(); i++) pos[stoi(v[i]) - A] = i;
		BIT<long long> Q(B - A + 1);
		for (int i = A; i <= B; i++) Q.add(pos[i - A], (Q.sum(0, pos[i - A]) + 1) % M);
		cout << Q.sum(0, B - A + 1) % M << endl;
	}
}

Measured memory_bytes: 9824
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k, s;
    cin >> k >> s;
    ll sol = 0;
    for (int i = 0; i <= k; ++i)
        for (int j = 0; j <= k; ++j)
            if (i + j <= s && i + j + k >= s)
                sol++;
    cout << sol;
}


Measured memory_bytes: 256
l = list(input()) 
for i in range(8):
    p = ["+"if i&j else"-" for j in[1, 2, 4]]
    line = "".join([v+o for v,o in zip(l,p)]) + l[3]
    if eval(line) == 7:
        print(line + "=7")
        break

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 998244353;

int main() {
    ll n, ans;
    cin >> n;

    ans = 0;
    for(ll i = 1; i * i <= n; i++){
        if((n - i) % i == 0){
            ll m = (n - i) / i;
            if(i < m){
                ans += m;
            }
        }
    }

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


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

int main() { 
  long long int n, ans = 0;
  cin >> n;
  int a[n*3];
  for(int i = 0; i < n*3; ++i) cin >> a[i];
  sort(a, a+n*3, greater<int>());
  for(int i = 1; i < 2*n; ++i) {
    if(i%2 == 1) ans += a[i];
  }
  cout << ans << '\n';
}


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

using namespace std;

long long int powa[1000],powb[1000];

int main(){
    long long int A,B,las,ans=0;
    cin >> A >> B;
    for(int i=1;;i++){
        long long int div = pow(2,i);
        powa[i-1] = (div/2)*((A-1)/div) + max((long long int)0,(A-1)%div+1-div/2);
        powb[i-1] = (div/2)*(B/div) + max((long long int)0,B%div+1-div/2);
        if(B<pow(2,i)){
            las = i;
            break;
        }
    }

    for(int i=0;i<las;i++){
        if((powb[i]-powa[i])%2==1){
            ans += pow(2,i);
        }
        //cout << powa[i] << " " << powb[i] << endl;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import itertools
import numpy as np

N,M,X = map(int, input().split())
arr = np.array([list(map(int, input().split())) for _ in range(N)])
und=[0]*M
c_max = 10**7

for i in range(N):
    lis=list(itertools.combinations(arr,i+1))
    for li in lis:
        c=0
        a=np.array([0]*M)
        for l in li:
            c += l[0]
            a += l[1:]
        #print(li,c,a)
        if np.all(a>=X) and c<c_max:
            c_max=c
if c_max < 10**7:
    print(c_max)
else:
    print('-1')
            

Measured memory_bytes: 27624
#include <bits/stdc++.h>
using namespace std;
void err() {
	cout << "NO" << endl;
	exit(0);
}
inline bool chmax (int& a, int b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
vector<int> a;
void dfs (
	int crr
, int prt
, vector<int>& out
, vector<vector<int>>& grh
) {
	int cnt = 0;
	int in = 0;
	int mxv = 0;
	for (int nxt : grh[crr]) if (nxt != prt) {
		cnt++;
		dfs(nxt, crr, out, grh);
		in += out[nxt];
		chmax(mxv, out[nxt]);
	}
	if (cnt) {
		out[crr] = in - 2 * (in - a[crr]);
	} else {
		out[crr] = a[crr];
	}
	if (out[crr] < max(0, 2 * mxv - in) || a[crr] < out[crr]) err();
	if (crr == 0 && 
		(
			(cnt == 1 && a[0] != out[0]) ||
			(cnt > 1 && out[0] != 0)
		)
	) {
		err();
	}
}
int main() {
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<vector<int>> grh(n);
	for (int i = 0; i < n - 1; i++) {
		int s, t;
		cin >> s >> t;
		grh[--s].push_back(--t);
		grh[t].push_back(s);
	}
	vector<int> out(n, -1);
	dfs(0, 0, out, grh);
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 14464
N, M = [int(_) for _ in input().split()]
A = set([int(input()) for i in range(M)])

cs = [0] * (N + 1)

cs[0] = 1

M = 10**9+7

for i in range(1, N + 1):
    if not i in A:
        cs[i] = (cs[i - 2] + cs[i - 1]) % M

result = cs[N]

print(result)


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

int main() {
	int a,b ;
	cin >> a >> b;
	
	if (a > b){
		cout << "a > b" << endl;
	}
	else if (a == b){
		cout << "a == b" << endl;
	}
	else {
		cout << "a < b" << endl;
	}
}

Measured memory_bytes: 3104
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){
  ll n;cin>>n;
  ll k,c;cin>>k>>c;
  string s;cin>>s; 
  ll count=0;
  vector<ll> left,right;
  rep(i,n){
    if(count>=k)break;
    if(s[i]=='o'){
      left.push_back(i);
      count++;
      i+=c;
    }
  }
  
  reverse(all(s));
  count=0;
  rep(i,n){
    if(count>=k)break;
    if(s[i]=='o'){
      right.push_back(n-i-1);
      count++;
      i+=c;
    }
  }
  reverse(all(right));
  rep(i,k)if(left[i]==right[i])cout<<right[i]+1<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


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

const int INF = 1e9;

int main() {
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      int k=n-i-j;
      if(k<0){
        break;
      }
      if(y==10000*i+5000*j+1000*k){
        cout<<i<<" "<<j<<" "<<k<<endl;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
// 2018/01/05 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		string w[40];
		int len[40];
		for(int i=0; i<n; i++){
			cin >> w[i];
			len[i] = w[i].size();
		}

		for(int i=0; i<n; i++){
			bool flg = false;
			int sta = 0;
			int sum = 0;

			for(int j=i; j<n; j++){
				sum += len[j];

				if(sum==5 || sum==12 || sum==17 || sum==24 || sum==31){
					sta++;
				}

				if(sta==5){
					flg = true;
					break;
				}
				else if(sum>=31){
					break;
				}
			}

			if(flg){
				cout << i+1 << endl;
				break;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	int ai = 0;
	rep(i, n){
		cin >> a[i];
		if(ai < a[i]) ai = a[i];
	}
	
	int aj = 1001001001;
	int j;
	rep(i, n){
		if(a[i] == ai) continue;
		if(abs(aj) > abs(ai - a[i] * 2)){
			aj = ai - a[i] * 2;
			j = i;
		}
	}
	
	
	cout << ai << " " << a[j] << endl;
	
	
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define NN 1000090
bool arr[NN]{};
int main() {
	int num; std::cin >> num;
	for (int x = 0; x < NN; x++)arr[x] = 1;

	for (int x = 2; x <= num+100; x++) {
		if (arr[x]) {
			for (int z = x + x; z <= num+100; z+=x) {
				arr[z] = 0;
			}
		}
	}

	if (arr[num]) std::cout << num;
	else {
		int a = num + 1;
		while (!arr[a]) { a++; };
		std::cout << a;
	}
}

Measured memory_bytes: 4528
<?php
list($h,$n)=explode(" ",trim(fgets(STDIN)));
//echo $h,"\n",$n,"\n";
$a = explode(" ",trim(fgets(STDIN)));
$damage = 0;
for ($i = 0; $i < $n; $i++) {
    //echo $a[$i],"\n";
   $damage = $damage + $a[$i];
}
//echo $damage,"\n";
if ($h<=$damage) {
    echo "Yes","\n";
}else{
    echo "No","\n";
}
?>

Measured memory_bytes: 21540
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctype.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef long long Int;
Int mod = 1e9+7;
Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    double N;
    cin >> N;
    Int a, b, c;
    for (double h = 1.0; h <= 3500.0; h += 1.0) {
        for (double n = 1.0; n <= 3500.0; n += 1.0) {
            double x = (N * h * n) / (4 * h * n - N * n - N * h);
            if (x > 0 && ceil(x) == floor(x)) {
                a = h;
                b = n;
                c = x;
                break;
            }
        }
    }
    cout << a << " " << b << " " << c << '\n';
    return 0;  
}    

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll x,y;
    ll ans = 0;
    cin >> x >> y;
    while(x <= y){
      x = 2*x;
      ans ++;
    }
    cout << ans<<endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    H,W,K=map(int,input().split())
    s=[[0]]*H
    
    ans=[0]*H
    num=1
    kazu=0
    g=[]
    preg=[]
    f=False
    nonsharp=0
    for i in range(H):
        l=list(input())
        if g!=[]:
            preg=g
        g=[]
        kazu=0
        f=False
        for j in range(W):
            if l[j]=='.':
                kazu+=1
                if j == W-1:
                    if f==True:
                        g+=[str(num)]*kazu
                        num+=1
            else:
                if f==False:
                    f=True
                    kazu+=1
                    if j == W-1:
                        g+=[str(num)]*kazu
                        num+=1
                else:
                    g+=[str(num)]*kazu
                    num+=1
                    kazu=1
                    if j == W-1:
                        g+=[str(num)]*kazu
                        num+=1
        if f==True:
            for z in range(nonsharp+1):
                ans[i-z]=g
            nonsharp=0
        else:
            nonsharp+=1
    if nonsharp!=0:
        for z in range(nonsharp):
            ans[H-1-z]=preg
    for b in ans:
        print(' '.join(b))
        
                    
                    
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 46428
n, k = map(int, input().split())
lr = list(input())
j = 0
counts = [0]
for i in range(n):
    if lr[j] == lr[i]:
        counts[-1] += 1
    else:
        j = i
        counts.append(1)

for _ in range(k):
    if len(counts)>=3:
        counts[0] += counts[1]+counts[2]
        del counts[1:3]
    elif len(counts)==2:
        counts[0] += counts[1]
        del counts[1]
    else:
        break

count = sum(counts) - len(counts)
print(count)

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> array(N);
    for(int i=0;i<N;i++){
        cin >> array[i];
    }

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

    cout << array[N/2] - array[N/2-1] << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int D = sc.nextInt();
   int[][] Xik = new int[N][D];
   for(int i =0;i<N;i++)
   {
    for(int k = 0;k<D;k++)
    {
     Xik[i][k] = sc.nextInt();
    }
   }
   int count = 0;
   int sum = 0;
   double sq = 0.0;
   int ab = 0;
   for(int i = 0;i<N;i++)
   {
    for(int l = i+1 ; l<N;l++) 
    {
     for(int k = 0;k<D;k++)
     {
      sum += (Xik[i][k] - Xik[l][k])*(Xik[i][k] - Xik[l][k]);  
     }
      sq = Math.sqrt(sum);
      ab = (int)Math.abs(sq);

      if(sum == ab*ab) 
      {
        count++;
      }
        sum = 0;
    }
   }

   System.out.println(count);
 }
}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

vector < pair<ll,ll> > vec;

int main() {
    ll n, k, a, b;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        vec.push_back(make_pair(a,b));
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < n; i++) {
        k -= vec[i].second;
        if (k <= 0) {
            cout << vec[i].first << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
using namespace std;
int A[2005];
int D[2005];
int main() {
  ios::sync_with_stdio(false);
  int N, X, Y;
  cin >> N >> X >> Y;
  X--;
  Y--;
  for (int i=0; i<N; i++) {
    for (int j=i+1; j<N; j++) {
      int d = j - i;
      d = min(d, abs(i - X) + 1 + abs(Y - j));
      d = min(d, abs(i - Y) + 1 + abs(X - j));
      D[d]++;
    }
  }
  for (int i=1; i<N; i++) {
    cout << D[i] << '\n';
  }
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

int PS[200001][20];

int get_max(int s, int e)
{
	int ret=0;
	for(int j=0;j<20;j++) ret=max(ret,PS[e][j]-PS[s-1][j]);
	return ret;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N;
	long long ans=0;
	cin>>N;
	for(int i=1;i<=N;i++) {
		int A;
		cin>>A;
		for(int j=0;j<20;j++) PS[i][j]=PS[i-1][j]+((A>>j)&1);
	}
	for(int i=1;i<=N;i++) {
		int s=i, e=N;
		while(s<=e) {
			int m=(s+e)>>1;
			if(get_max(i,m)<=1) s=m+1;
			else e=m-1;
		}
		ans+=s-i;
	}
	cout<<ans<<'\n';
	return 0;
}

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

int main() {
	string S,T;
	cin>>S>>T;
	for(int i=0;i<T.size();i++){
		cout<<T.at(i);
	}
	for(int j=0;j<S.size();j++){
		cout<<S.at(j);
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int x;
	cin >> x;
	if(x == 3 || x == 5 || x == 7) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int i, loop, arr[100];
    scanf("%d", &loop);

    for(i = loop - 1; i >= 0; i--){
        scanf("%d", &arr[i]);
    }

    for(i = 0; i < loop; i++){
        printf("%d%s", arr[i], (i == loop -1) ? "\n" : " ");
    }
}


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

int main()
{
    int h, w;
    scanf("%d%d", &h, &w);
    for (int i = 0; i < w + 2; i++) printf("#");
    printf("\n");
    for (int i = 0; i < h; i++)
    {
        char a[128]{};
        scanf("%s", a);
        printf("#%s#\n", a);
    }
    for (int i = 0; i < w + 2; i++) printf("#");
    printf("\n");
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, M, R;
  cin >> N >> M >> R;
  vector<vector<long>> data(N, vector<long> (N, 1000000000));
  vector<long> road(R);
  for(int i = 0; i < R; i++)cin >> road.at(i);
  long a, b, c;
  for(int i = 0; i < M; i++){
    cin >> a >> b >> c;
    a--;
    b--;
    data.at(a).at(b) = c;
    data.at(b).at(a) = c;
  }
  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        data.at(i).at(j) = min(data.at(i).at(j), data.at(i).at(k) + data.at(k).at(j));
      }
    }
  }
  vector<long> P(R);
  for(int i = 0; i < R; i++)P.at(i) = i;
  long ans = 1000000000, sub;
  do{
    sub = 0;
    for(int i = 0; i < R - 1; i++){
      sub += data.at(road.at(P.at(i)) - 1).at(road.at(P.at(i + 1)) - 1);
    }
    ans = min(ans, sub);
  } while(next_permutation(P.begin(), P.end()));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var sets = (sample_input.trim()).split("\n");
sets.forEach(function(pair){
  var sum = pair.split(" ").map(Number).reduce(function(a,b){return a + b;},0);
  console.log(sum.toString().length);
});

Measured memory_bytes: 16112
n, m = map(int,input().split())

if n%2 == 1:
    for i in range(m):
        print(n//2-i,n//2+i+1)
else:
    ni = 1
    l = 1
    r = n
    while ni <= n//4 and ni <= m:
        print(l,r)
        l += 1
        r -= 1
        ni += 1
    r -= 1
    while ni <= m:
        print(l,r)
        l += 1
        r -= 1
        ni += 1


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

int n, k, s, cnt, c[30];
string a[10005];
bool v[30];
int main() {
	int i, j;
	cin >> n >> k;
	for(i=0; i<n; i++) cin >> a[i];
	a[n] = "00";
	sort(a, a+n+1);
	for(i=1; i<=n; i++) {
		if(a[i] != a[i-1]) {
			c[a[i][0] - 'A']++;
		}
	}
	while(1) {
		sort(c, c+26, greater<int>());
		if(c[k-1] == 0) break;
		cnt++;
		for(i=0; i<k; i++) {
			c[i]--;
		}
	}
	cout << cnt << endl;
	return 0;
}


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

int main(){
	int N,M;
	cin >> N>>M;
	vector<pair<long long,long long>> ene(N);
	int count=0;
	long long money=0;
	for(int i=0;i<N;i++){
		cin>>ene.at(i).first;
		cin>>ene.at(i).second;
	}
	sort(ene.begin(),ene.end());
	int j=0;
	while(count<M){
		if(count+ene.at(j).second<=M){
			count+=ene.at(j).second;
			money+=ene.at(j).first*ene.at(j).second;
			j++;
		}
		else{
			money+=ene.at(j).first*(M-count);
			count=M;
			j++;
		}
	}
	cout << money<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    ll ans = 0;

    bool flag = true;
    while(flag){
        flag = false;
        for(int i = 0; i < n; i++){
            if(a[i] >= 1){
                flag = true;
                ll m = a[i];
                int j;
                for(j = i+1; j < n; j++){
                    if(a[j] == 0){
                        break;
                    }else{
                        m = min(m,a[j]);
                    }
                }
                ans += m;
                for(int k = i; k < j; k++){
                    a[k] -= m;
                }
                break;
            }
        }
    }

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

Measured memory_bytes: 256
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0] * n

for i in range(n):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(h[0]-h[1])
    else:
        costs = []
        for j in range(1, k+1):
            if j > i:
                break
            if abs(h[i-j]-h[i]) == 0:
                costs.append(dp[i-j])
                break
            costs.append(dp[i-j] + abs(h[i-j]-h[i]))

        # if i == 3:
        #     print(costs)
        dp[i] = min(costs)

#print(dp)
print(dp[n-1])



Measured memory_bytes: 52832
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int powint(int a, int x){
	int res = 1;
	REP(i,x){
		res = res *a; 
	}
	return res;
}

using namespace std;

int main(){
	vector<int> v(3);
	cin>>v[0]>>v[1]>>v[2];
	sort(v.begin(),v.end(), greater<int>());

	int ans=0;
	ans+=v[0]-v[1];
	if((v[1]-v[2])%2==0){
		ans+=(v[1]-v[2])/2;
	} else {
		ans+=(v[1]-v[2])/2 + 2;
	}

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


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

int n, m, a, b;

int main() {
  cin >> n >> m;
  vector<vector<int>> neighbor(n);
  rep (i, m) {
    cin >> a >> b;
    a--;b--;
    neighbor[a].push_back(b);
    neighbor[b].push_back(a);
  }
  vector<int> sign(n, -1);
  queue<int> que;
  que.push(0);
  int now;
  while (que.size() > 0) {
    now = que.front();
    que.pop();
    rep (i, neighbor[now].size()) {
      if (sign[neighbor[now][i]] == -1) {
        sign[neighbor[now][i]] = now;
        que.push(neighbor[now][i]);
      }
    }
  }
  bool is_existed = true;
  rep (i, n) {
    if (sign[i] == -1) {
      is_existed = false;
      break;
    }
  }
  if (is_existed) {
    cout << "Yes" << endl;
    rep (i, n) {
      if (i == 0) continue;
      cout << sign[i] + 1 << endl;
    }
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 10148
#include<bits/stdc++.h>
#define ull unsigned long long
#define pi acos(-1)
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f;
const ll maxn = 1e7+5;
const ll mod = 1e9+7;
int p[10],q[10],a[10];
int main(){
	int n,k=0,x,y;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		a[i]=p[i];
	}
	for(int i=1;i<=n;i++) cin>>q[i]; 
	sort(p+1,p+n+1);
	do{
		k++;
		int flag1=0,flag2=0;
		for(int i=1;i<=n;i++){
			if(a[i]==p[i]) flag1++;
			if(q[i]==p[i]) flag2++;
			//cout<<p[i]<<" ";
		}
		if(flag1==n) x=k;
		if(flag2==n) y=k;
		//cout<<'\n';
	}while(next_permutation(p+1,p+n+1));
	cout<<abs(x-y)<<'\n';
	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
	string word;
	cin >> word;
	for( int i=0 ; i<word.size() ; i++ ){
		if( isupper(word[i]) )
			word[i] = tolower(word[i]);
	}
	//cout << word << endl;
	string sign="END_OF_TEXT";
	int counter=0;
	while(cin>>str){
		if( sign == str )
			break;
		for( int i=0 ; i<str.size() ; i++ ){
			if( isupper(str[i]))
				str[i] = tolower(str[i]);
		}
		//cout << str << endl;
		if( str == word )
			counter++;
	}
	cout << counter << endl;
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

#define N 100010
#define M 200010
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int n, m;
	int arr[110];
	ll sum = 0;
	
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		sum += arr[i];
	}
	
	double d = sum / (4.0 * m);
	
	int cnt = 0;
	for(int i = 0; i < n; i++){
		if(arr[i] >= d){
			cnt++;
		}
	}
	
	if(cnt >= m){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    int n,x;
    cin>>n>>x;
    vector<int>l(n);
    REP(i,n){
        cin>>l[i];
    }
    int ans=1;
    int sum=0;
    REP(i,n){
        sum+=l[i];
        if(sum<=x)ans++;
    }
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

const int MAX = 2020;

char maze[MAX][MAX];
//blocks, horizontal, vertical
int b[MAX][MAX], h[MAX][MAX], v[MAX][MAX];

int f(int x1, int x2, int y1, int y2) {
	x1--, y1--;
	int block = b[x2][y2] - b[x1][y2] - b[x2][y1] + b[x1][y1];
	int h_edge = h[x2][y2] - h[x1][y2] - h[x2][y1+1] + h[x1][y1+1];
	int v_edge = v[x2][y2] - v[x1+1][y2] - v[x2][y1] + v[x1+1][y1];
	//putsp(h_edge);
	//putln(v_edge);
	return block - h_edge - v_edge;
}

void solve(void){
	//input
	int N, M, Q;
	cin >> N >> M >> Q;
	rep(N, i) rep(M, j) {
		cin >> maze[i][j];
		if (maze[i][j] == '1') {
			b[i+1][j+1]++;
		}
	}

	rep(N, i) rep(M, j) {
		if (maze[i][j] == '1') {
			if (maze[i][j+1] == '1') {
				h[i+1][j+2]++;
			}
			if (maze[i+1][j] == '1') {
				v[i+2][j+1]++;
			}
		}
	}

	rep(N+1, i) rep(M+1, j) {
		b[i+1][j] += b[i][j];
		h[i+1][j] += h[i][j];
		v[i+1][j] += v[i][j];
	}

	rep(N+1, i) rep(M+1, j) {
		b[i][j+1] += b[i][j];
		h[i][j+1] += h[i][j];
		v[i][j+1] += v[i][j];
	}

	/*
	rep(N, i) rep(M, j) {
		putsp(h[i+1][j+1]);
		if (j==M-1) put('\n');
	}

	put('\n');

	rep(N, i) rep(M, j) {
		putsp(v[i+1][j+1]);
		if (j==M-1) put('\n');
	}

	put('\n');
	*/

	while(Q--) {
		int x1, x2, y1, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		putln(f(x1, x2, y1, y2));
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 53504
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll A[100010];
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    ll cnt[100010] = {};
    rep(i,0,N){
        cnt[A[i]]++;
    }
    ll total = 0;
    ll val = 0;
    rep(i,0,100010){
        if(cnt[i] != 0){
            total += cnt[i] - 1;
            val++;
        }
    }
    if(total % 2 == 0){
        print(val);
    }else{
        print(val - 1);
    }




}


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
  double N;
  double a;
  cin>>N;
  if((int)N%2==0){
    a=1.0/2.0;
    cout<<a<<endl;
  }else{
    a=((int)N/2+1)/N;
    cout<<a<<endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

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

int main() {
	string s;
	cin >> s;
	rep(i, s.size()) {
		if ((i+1) % 2 == 0) {
			if (s[i] == 'R') {

				cout << "No";
				return 0;
			}

		}
		else {
			if (s[i] == 'L') {
				cout << "No";
				return 0;
			}

		}

	}
	cout << "Yes";
}
	

Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define inf 2000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define rng_23 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef map<int,int> mii;
int main()
{
    double r;
    cin>>r;
    cout<<2.0*3.1416*r;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i);
    }
    int l=0;
    for(int i=0;i<n;i++){
        if(a.at(i)%2==0){
            a.at(i)/=2;
            if(i==n-1){
                i-=n-1;
                l+=1;
            }
            continue;
        }break;
    }
        cout<<l<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

#define max(a, b) (a > b ? a : b)

int main()
{
    int no_of_grains, time;
    scanf("%d %d", &no_of_grains, &time);

    int no_of_grains_left = max(no_of_grains - time, 0);
    printf("%d\n", no_of_grains_left);
    return 0;
}

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

#define deb(x) cout << #x << "=" << x << endl;
#define fo(i, n) for (ll i = 0; i < n; i++)
#define fo1(i, n) for (ll i = 1; i <= n; i++)
#define sn(x) cin >> x;
#define pn(x) cout << x << "\n"
#define ps(x) cout << x << " ";
#define pb() cout << "\n";
#define sort(x) sort(x.rbegin(), x.rend());
// #define reverse_sort(x) sort(x.rbegin(), x.rend());
// #define reverse(x) reverse(x.rbegin(), x.rend());

typedef long long ll;

using namespace std;

void solve()
{

	float n,x,t;
	cin >> n >> x >> t;

	cout << fixed << int(ceil(n/x)*t) << endl;

}

int main()
{

#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("err.txt", "w", stderr);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// return 0;

	ll t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
		// cout << ans;
	}
	return 0;
}


Measured memory_bytes: 3704
import bisect
n,q = map(int,input().split())
s = input()
data = []
for i in range(n-1):
    if s[i:i+2] == "AC":
        data.append(i)
for i in range(q):
    l,r = map(int,input().split())
    l -= 1
    r -= 1
    j = bisect.bisect_left(data,l)
    k = bisect.bisect_left(data,r)
    print(k-j)

    
    
        

Measured memory_bytes: 5748
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<string,int> P;
typedef pair<P,P> P2;
const ll INF=100000000000000001;

int main() {
	int h,w,n;
	cin>>h>>w>>n;
	int d[101][101]={};
	int s=0;
	int t=1;
	for(int i=1;i<n+1;++i){
		int a1;
		cin>>a1;
		for(int j=0;j<a1;++j){
			if(t%2==1){
				s++;
				if(s==w+1){
					s=w;
					t++;
				}
			}else{
				s--;
				if(s==0){
					s=1;
					t++;
				}
			}
			d[t][s]=i;
		}
	}
	for(int i=1;i<=h;++i){
		cout<<d[i][1];
		for(int j=2;j<=w;++j){
			cout<<" "<<d[i][j];
		}
		cout<<endl;
	}
	return 0;
}


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

#define endl '\n'
#define Int long long
#define Double long double
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define CLR(a, b) memset(a, b, sizeof a)
#define debug(x) cerr << #x << " " << x << endl;
#define MOD 1000000007
#define MAXN 110

using namespace std;

string s[MAXN];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, l;
    cin >> n >> l;
    
    for(int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    sort(s, s + n);

    for(int i = 0; i < n; ++i)
        cout << s[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import math
N = int(input())
n = N //1.08
x = math.floor(n*1.08)
y = math.floor((n-1)*1.08)
z = math.floor((n+1)*1.08)
if (N == x):
  ptint(math.floor(n))
  
elif N == y:
  print(math.floor(n-1))
elif N == z:

  print(math.floor(n+1))
else:
  print(':(')

Measured memory_bytes: 3064
/*
doge
░░░▄░░░░░░░░░░░░░░▄
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒

Mr Mr has arrived

*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>


using namespace std;


#define ll long long
#define ld long double
#define null NULL
#define prev prev228



int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	int it = 0;
	while (it <= 200000) {
		if ((a & 1) || (b & 1) || (c & 1)) {
			printf("%d\n", it);
			return 0;
		}
		ll fir = a / 2;
		ll sec = b / 2;
		ll thi = c / 2;
		a = sec + thi;
		b = fir + thi;
		c = fir + sec;
		++it;
	}
	puts("-1");
    return 0;
}






// x n : x , 2x <= n


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    w, h, x, y = map(int, input().split())
    if x == 0 or y == 0:
        print(w * h / 2, 0)
    elif w / x == 2 and h / y == 2:
        r = x * h
        print(r, 1)
    elif w / x == 2 or h / y == 2:
        if w / x == 2:
            r = x * h
            print(r, 0)
        else:
            r = y * w
            print(r, 0)
    else:
        print(w * h / 2, 0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9172
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int [] p = new int[n];
		
		for(int i = 0; i < n; i++) {
			p[i] = stdIn.nextInt();
		}
		int cnt = 0;
		
		
		for(int i = 0; i < n; i++) {
			if(p[i]!= i+1) {
				cnt++;
			}
		}
		if(cnt <= 2) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
	}

}


Measured memory_bytes: 25044
#include <iostream>
#include <cassert>

int main () {
    int N, A, B;
    std::cin >> N >> A >> B;

    assert(1 <= N && N <= 20);
    assert(1 <= A && A <= 50);
    assert(1 <= B && B <= 50);

    int cost_train = N * A;
    int cost_taxi  = B;

    int cost = cost_train < cost_taxi ? cost_train : cost_taxi;
    std::cout << cost << std::endl;

    return 0;
}

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

#define int long long
#define endl '\n'
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define dvec(vct) for(auto i : vct) cout << i << " "; cout << endl;
#define darr(a, n) for(int i=0;i<n;) cout << a[i++] <<' '; cout<< '\n';
#define print_(x) cout << #x << " : " << x << endl;

const int mod = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    vector<int> p(n), q(n), r(n);
    for (int i = 1; i <= n; i++) {
        r[i-1] = i;
        int x; cin >> x;
        p[i-1] = x;
    }
    for (int i = 1; i <= n; i++) {
        cin >> q[i-1];
    }
    if (p == q) {
        cout << 0 << endl;
        return;
    }
    vector<int> pos;
    int a, b;
    int cnt = 1;
    do {
        if (r == p || r == q) {
            pos.push_back(cnt);
        }
        cnt++;
    } while (
        next_permutation(all(r))
    );
    cout << abs(pos[0] - pos[1]) << endl;
}

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256