akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(),v.end());
    if(v.back() == 0){
        puts("Yes");
        return 0;
    }else if(n%3){
        puts("No");
        return 0;
    }
    map<int, int> m;
    for (int i = 0; i < n; ++i) {
        m[v[i]]++;
    }
    int k = 0;
    for (auto &&j : m) {
        if(j.second%(n/3)){
            puts("No");
            return 0;
        }else {
            for (int i = 0; i < j.second/(n/3); ++i) {
                k ^= j.first;
            }
        }
    }
    puts(k ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 4224
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");

        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int c = Integer.parseInt(input[2]);
        int x = Integer.parseInt(input[3]);
        int y = Integer.parseInt(input[4]);
        
        long sum = 0;
        if(a + b > 2*c){
            int buyc = Math.min(x,y);
            x -= buyc;
            y -= buyc;
            sum += buyc * 2 * c;
            if(x == 0){
                if(b > 2*c){
                    sum += y*2*c;
                }else{
                    sum += y*b;
                }
            }else if(y == 0){
                if(a > 2*c){
                    sum += x*2*c;
                }else{
                    sum += x*a;
                }
            }
        }else{
            sum += x * a;
            sum += y * b;
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 21204
def main():
    N = int(input())
    ans = 0
    def c(i, j):
        res = 0
        str_i = str(i)
        str_j = str(j)
        for k in range(1, N+1):
            if str(k)[0] == str_i and str(k)[-1] == str_j:
                res += 1
        return res

    for i in range(1, 10):
        for j in range(1, 10):
            ans += c(i,j) * c(j, i)

    print(ans)
main()

Measured memory_bytes: 73320
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int X,Y; cin >> X >> Y;
  if(Y%2==1){
    No
    return 0;
  }
  int a=2*X-Y/2;
  int b=Y/2-X;
  if(a>=0 && b >= 0){
    Yes
  }
  else{
    No
  }
  return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();

        int k = cin.nextInt();
        int s = cin.nextInt();

        int ans = 0;
        for (int x = 0; x <= k; x++)
        {
            for (int y = 0; y <= k; y++)
            {
                if (s - (x + y) >= 0 && s - (x + y) <= k)
                {
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main () {
    string s;
    cin >> s;
    vector <int> v(26);
    for (int i = 0; i < s.size(); ++i)
        v[s[i] - 'a']++;
    long long ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        ans += s.size() - i - v[s[i] - 'a'];
        --v[s[i] - 'a'];
    }
    cout << ans + 1 << endl;
}


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

using namespace std;

vector< vector<int> >adj(12) ;

int n , m ;
int state[12] ;

int ans ;

void solve(int idx , int mask)
{
    if(idx == n)
    {
        int t = 1 ;
        for(int i = 0 ; i < m ; ++i)
        {
            if((mask & (1 << i)) && state[i] == 0)
                t = 0 ;
            if((!(mask & (1 << i))) && state[i] == 1)
                t = 0 ;
        }
        ans += t ;
        return ;
    }
    solve(idx+1 , mask) ;
    int nmask = mask ;
    for(auto &i : adj[idx])
        nmask ^= (1 << i) ;
    solve(idx+1 , nmask) ;
}

int main()
{
    cin>>n>>m ;
    for(int i = 0 ; i < m ; ++i)
    {
        int x ;
        cin>>x ;
        while(x--)
        {
            int y ;
            cin>>y ;
            --y ;
            adj[y].push_back(i) ;
        }
    }
    for(int i = 0 ; i < m ; ++i)
        cin>>state[i] ;
    solve(0 , 0) ;
    return cout<<ans<<"\n" , 0 ;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    P, Q, R = LI()
    print(P+Q+R-max(P,Q,R))

main()

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int n;
  for(;cin>>n;)
    {
      int data[n][n];
      int sum_data[n][n];
      int ans=-10000;
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  {
	    cin>>data[i][j];
	    int sum=data[i][j];
	    if(i>0)
	      sum+=sum_data[i-1][j];
	    if(j>0)
	      sum+=sum_data[i][j-1];
	    if(i>0 && j>0)
	      sum-=sum_data[i-1][j-1];
	    sum_data[i][j]=sum;
	  }
      /*
      for(int i=0;i<n;i++,cout<<endl)
	for(int j=0;j<n;j++)
	  {
	    cout<<sum_data[i][j]<<" ";
	  }
      */
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  {
	    ans=max(ans,sum_data[i][j]);
	    for(int ii=i;ii>=0;ii--)
	      for(int jj=j;jj>=0;jj--)
		{
		  int sum=sum_data[i][j];
		  if(ii!=i)
		    sum-=sum_data[ii][j];
		  if(jj!=j)
		    sum-=sum_data[i][jj];
		  if(ii!=i && jj!=j)
		    {
		      //		      int tmp1=min(ii,i);
		      sum+=sum_data[ii][jj];
		    }
		  ans=max(ans,sum);
		}
	  }
      cout<<ans<<endl;

    }

}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define ALL(i) i.begin(),i.end()
#define SZ(i) ll(i.size())
#define MEM(i,n) memset(i,(n),sizeof(i))
#define X first
#define Y second
#define eb emplace_back
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template <typename T> void _do(T &&x){cerr<<x<<endl;}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define debug(...)
#define endl '\n'
#endif

const ll INF = 0x3f3f3f3f3f3f3f3f;
vector<ll> len;
int main () {
	IOS();
	ll n;
	cin >> n;
	REP (i,n) {
		ll l;
		cin >> l;
		len.eb(l);
	}
	
	sort(ALL(len));
	
	ll sum = 0;
	REP (i,SZ(len)-1) {
		sum += len[i];
	}
	
	if (sum <= len.back()) {
		cout << "No" << endl;
	} else{
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=2e5+5,M=2e3+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
}































const int mo=1e9+7;
int n,a[N],b[N];
void input()
{
	n=read<int>();
	For(i,1,n)a[i]=read<int>(),b[i]=read<int>();
}
ll dp[M*2][M*2],mc[M<<2],inv[M<<2];
ll power(ll x,int y)
{
	ll res=1;
	for(;y;x=x*x%mo,y>>=1)if(y&1)res=res*x%mo;
	return res;
}
ll C(int x,int y)
{
	return mc[x]*inv[y]%mo*inv[x-y]%mo;
}
void work()
{
	For(i,1,n)dp[2001-a[i]][2001-b[i]]++;
	For(i,1,4001)For(j,1,4001)
	{
		dp[i][j]=(dp[i-1][j]+dp[i][j-1]+dp[i][j])%mo;
	}
	mc[0]=inv[0]=1;
	For(i,1,8000)mc[i]=mc[i-1]*i%mo;
	inv[8000]=power(mc[8000],mo-2);
	Fordown(i,7999,1)inv[i]=inv[i+1]*(i+1)%mo;
	ll ans=0;
	For(i,1,n)
	{
		ans=(ans+dp[a[i]+2001][b[i]+2001])%mo;
		ans=(ans+mo-C(a[i]+b[i]+a[i]+b[i],a[i]+a[i]))%mo;
	}
	write(1ll*ans*power(2,mo-2)%mo,'\n');
}
int main()
{
//	file();
	input();
	work();
	return 0;
}

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

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)1e5 + 10;
const int mod = (int)1e9 + 7;

int main(){

    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);

    double a, b, x;
    cin >> a >> b >> x;

    const double PI = acos(-1);

    bool halfFull = 2 * x >= a * a * b;

    double angle = 0;

    if(halfFull){
        angle = atan(2 * (b - x / a / a) / a);
    }
    else{
        angle = atan(2 * x / a / b / b);
        angle = PI / 2 - angle;
    }
    
    cout << fixed << setprecision(6) << angle * 180 / PI << endl;


    return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 100005;
int N;
int A[MAX_N];

signed main()
{
  cin >> N;
  vector<II> vec;
  REP(n,N) {
    cin >> A[n];
    vec.push_back(II(A[n], n+1));
  }
  sort(vec.begin(), vec.end());
  REP(n,N) {
    cout << vec[n].second;
    if(n < N-1) cout << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3312
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a,b = map(int,input().split())
    print((a-1)*(b-1))
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38636
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <stack>
#include <queue>
#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef pair <int, int> pii;

// template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5 + 5;
const int oo = 1e9 + 5;

int a[N];

void solve() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {cout << "Yes\n";}
	else cout << "No\n";	
}

 main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	while (tt --) {
		solve();
	}
	return 0;
}
/*
	“I’m not gonna run away, I never go back on my word! That’s my nindo: my ninja way.” Naruto
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 6006,inf=0x3f3f3f3f;
int n,f[N],a[N];Vi e[N];
void dfs(int u, int fa){
	int mn=inf;
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)
		dfs(e[u][i],u),mn=min(mn,f[e[u][i]]);
	f[u]=a[u]>=mn?inf:a[u]+1;
}
int main() {
	read(n);rep(i,1,n)read(a[i]);
	rep(i,1,n-1){
		int u,v;read(u);read(v);e[u].pb(v);e[v].pb(u);
	}
	rep(i,1,n){
		dfs(i,0);if(f[i]==inf)printf("%d ",i);
	}
	return 0;
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string S, T;
  cin >> S >> T;
  int N = SZ(S), M = SZ(T);

  int ans = 0;
  for(int l=1;l<=min(N,M);++l){
	set<VI> memo;
	VI tmp(26);
	REP(i,l) tmp[S[i]-'a']++;
	memo.insert(tmp);
	for(int b=0,e=l;e<N;++b,++e){
	  tmp[S[b]-'a']--;
	  tmp[S[e]-'a']++;
	  memo.insert(tmp);
	}

	tmp.assign(26,0);
	REP(i,l) tmp[T[i]-'a']++;
	if(memo.count(tmp)){
	  ans = l;
	  continue;
	}
	for(int b=0,e=l;e<M;++b,++e){
	  tmp[T[b]-'a']--;
	  tmp[T[e]-'a']++;
	  if(memo.count(tmp)){
		ans = l;
		break;
	  }
	}
  }
  cout << ans << endl;
  
  return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

ll solve(ll ni, ll nj, ll nl, ll no) {
	ll res = no;
	res += ni / 2 * 2 + nj / 2 * 2 + nl / 2 * 2;
	return res;
}

int main() {
	int ai, ao, at, aj, al, as, az;
	cin >> ai >> ao >> at >> aj >> al >> as >> az;
	if (aj < al) swap(aj, al);
	
	ll ans = solve(ai, aj, al, ao);
	if (ai >= 1 && aj >= 1 && al >= 1) chmax(ans, solve(ai - 1, aj - 1, al - 1, ao) + 3);
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
N,D,A = map(int,input().split())
attack_number = {}
Enemy = []
import math
for i in range(N):
    x,h = map(int,input().split())
    n = math.ceil(h/A)
    attack_number[x] = n
    Enemy.append(x)
Enemy.sort()
bomb_number = [0 for i in range(N+1)]
F = {}
import bisect
for i in range(N):
    x = Enemy[i]
    y = bisect.bisect_right(Enemy,x+2*D)
    F[i] = y
ans = 0
for i in range(N):
    if i > 0:
        bomb_number[i] += bomb_number[i-1]
    x = attack_number[Enemy[i]] - bomb_number[i]
    if x <= 0:
        continue
    y = F[i]
    bomb_number[i] += x
    bomb_number[y] -= x
    ans += x
print(ans)

Measured memory_bytes: 66828
#include<cstdio>

char c1,c2,c;
int l=0;

int main()
{
	
	while((c=getchar())!=-1)
	{
		l++;
		if(c1==c)
		{
			printf("%d %d",l-1,l);
			return 0;
		}
		if(c2==c)
		{
			printf("%d %d",l-2,l);
			return 0;
		}
		c2=c1; c1=c;
	}
	puts("-1 -1");
	return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    string s, t;
    cin >> s >> t;

    ll n = s.size(), m = t.size();

    vector<vector<int>> table(26);
    REP(i, n){
        int c = s[i] - 'a';
        table[c].push_back(i);
    }

    vector<int> ptr(26, -1);

    ll repeat = 0, pos = -1;
    REP(i, m){
        int c = t[i] - 'a';
        if(table[c].size() == 0){
            cout << -1 << endl;
            return 0;
        }
        auto itr = upper_bound(all(table[c]), pos);
        if(itr == table[c].end()){
            ptr[c] = 0;
        }else{
            ptr[c] = itr - table[c].begin();
        }
        int p = table[c][ptr[c]];
        if(p <= pos){
            repeat++;
        }
        pos = p;
    }

    cout << (ll) repeat * n + pos + 1 << endl;
    return 0;
}


Measured memory_bytes: 1216
#![allow(unused_variables, dead_code, clippy::many_single_char_names, non_upper_case_globals, unused_imports, unused_macros)]
use std::{
    collections::{BTreeMap, HashSet, HashMap, VecDeque, LinkedList},
    io::{stdin, stdout, StdinLock, StdoutLock, BufReader, BufWriter, prelude::*},
    mem::swap,
    str::FromStr,
};

struct Reader<'a> {
    stdin: BufReader<StdinLock<'a>>
}

#[cfg(not(debug_assertions))]
macro_rules! yubi {
    () => { unsafe { std::hint::unreachable_unchecked() } }
}

#[cfg(debug_assertions)]
macro_rules! yubi {
    () => { panic!() }
}

impl<'a> Reader<'a> {
    fn new(stdin: BufReader<StdinLock<'a/*'*/>>) -> Self {
        Self {stdin}
    }
    fn read_str(&mut self) -> String {
        let mut s = String::with_capacity(100);
        self.stdin.read_line(&mut s).unwrap();

        if s.ends_with('\n') { s.pop(); if s.ends_with('\r') { s.pop(); } }
        s
    }
    fn read_int<T: FromStr>(&mut self) -> T {
        match self.read_str().parse::<T>() {
            Ok(n) => n,
            _ => yubi!()
        }
    }
    fn read_vec(&mut self) -> Vec<String> {
        let t = self.read_str();
        t.split(' ').map(|x| x.to_owned()).collect()
    }
    fn read_vec_int<T: FromStr>(&mut self) -> Vec<T> {
        let t = self.read_str();
        t.split(' ').map(|x| match x.parse::<T>() {Ok(n) => n, _ => yubi!()}).collect()
    }
}

macro_rules! pipe_read {
    ($r: expr, str, $($x: ident),+) => {
        let t = $r.read_str();
        let mut it = t.split(' ');
        $($x = it.next().unwrap();)+
    };
    ($r: expr, $t: ty, $($x: ident),+) => {
        let t = $r.read_str();
        let mut it = t.split(' ').map(|x| x.parse::<$t>().unwrap());
        $($x = it.next().unwrap();)+
    }
}

macro_rules! pipe {
    ($r: expr, str, $($x: ident),+) => {
        pipe_read!($r, str, $($x),+);
    };
    (declare $r: expr, str, $($x: ident),+) => {
        $(let $x: &str;)+
        pipe_read!($r, str, $($x),+);
    };
    ($r: expr, $t: ty, $($x: ident),+) => {
        pipe_read!($r, $t, $($x),+);
    };
    (declare $r: expr, $t: ty, $($x: ident),+) => {
        $(let $x: $t;)+
        pipe_read!($r, $t, $($x),+);
    };
}

const M: usize = 1_000_000;

fn main() {
    let stdin = stdin();
    let stdout = stdout();
    
    solve(&mut Reader::new(BufReader::with_capacity(M, stdin.lock())), &mut BufWriter::with_capacity(M, stdout.lock()));
}

fn solve(r: &mut Reader, w: &mut BufWriter<StdoutLock>) {
    let a = r.read_str();
    writeln!(w, "{}", if !a.ends_with('s') {a+"s"} else {a+"es"}).unwrap();
}

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

struct UnionFind {
    vector<int> par;
    vector<int> siz;
    UnionFind(int N) : par(N),siz(N) {
        for (int i=0; i<N; i++) {
            par[i]=i,siz[i]=1;
        }
    }
    int root(int x) {
        if (par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x, int y) {
        int rx=root(x);
        int ry=root(y);
        if (rx==ry) return;
        par[rx]=ry;
        siz[ry]+=siz[rx];
    }
    bool same(int x,int y) {
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
    int size (int x) {
        return siz[root(x)];
    }
};

int main() {
   long long N,M;
   cin >> N >> M;
   int A[M],B[M];
   for (int i=0; i<M; i++) {
       int a,b;
       cin >> a >> b;
       A[i]=a-1,B[i]=b-1;
   }
   long long total[M];
   UnionFind tree(N);
   for (int i=0; i<M; i++) {
       if (i==0) {
           total[M-1]=N*(N-1)/2;
       }
       else {
           if (tree.same(A[M-i],B[M-i])) total[M-1-i]=total[M-i];
           else {
               long long a=tree.size(A[M-i]),b=tree.size(B[M-i]);
               total[M-i-1]=total[M-i]-a*b;
               tree.unite(A[M-i],B[M-i]);
           }
       }
   }
   for (int i=0; i<M; i++) cout << total[i] << endl;
}

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

void solve(long long N){
    map<int, string> h;
    h.insert(make_pair(0, "pon"));
    h.insert(make_pair(1, "pon"));
    h.insert(make_pair(2, "hon"));
    h.insert(make_pair(3, "bon"));
    h.insert(make_pair(4, "hon"));
    h.insert(make_pair(5, "hon"));
    h.insert(make_pair(6, "pon"));
    h.insert(make_pair(7, "hon"));
    h.insert(make_pair(8, "pon"));
    h.insert(make_pair(9, "hon"));
    cout << h[N % 10] << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3704
import java.util.*

object MainKt {
	@JvmStatic
	fun main(args: Array<String>) {
		val scanner = Scanner(System.`in`)
		val n = scanner.nextInt()
		val m = scanner.nextInt()
		var cnt = 0
		var a = -1
		var px=0
		var py=1
		for (i in 1..n){
			if (cnt<m && a<i) {
				a=scanner.nextInt()
				cnt++
			}
			val pz = if (a==i) 0 else (px+py)%1000000007
			px=py
			py=pz
		}
		println(py)
	}
}

Measured memory_bytes: 49852
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int n,k,d[15];
int panduan(int x)
{
    while(x)
    {

        int q=x%10;
          x=x/10;
          if(d[q]!=0)
              return 0;

    }
    return 1;
}

int main()
{int i,j;
cin>>n>>k;
 memset(d,0,sizeof(d));
for(i=0;i<k;i++)
     {
         int t;
         cin>>t;
         d[t]=1;

     }
  for(i=n;;i++)
      if(panduan(i))
     {
         cout<<i<<endl;
         break;
     }
return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+18
#define MOD 1000000007
using namespace std;



int main(){
    ll N,M;
    cin >> N >> M;
    
    ll X[M];
    for(ll i=0; i<M; i++){
        cin >> X[i];
    }
    
    sort(X,X+M);
    

    if(M==1){
        cout<<0<<endl;
        return 0;
    }

    
    ll ans = X[M-1]-X[0];
    
    ll dist[M-1];
    for(int i=0; i<M-1; i++){
        dist[i]=X[i+1]-X[i];
    }

    
    sort(dist,dist+M-1);
    for(int i=0; i<min(M-1,N-1); i++){
        ans -= dist[M-2-i];
    }
    
    cout<<ans<<endl;
    
    
    return 0;
}


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

int main(){
  int x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  int sax = x2-x1;
  int say = y2-y1;
  
  cout<<x2-say<<" "<<y2+sax<<" "<<x1-say<<" "<<y1+sax<<endl;
  
}


Measured memory_bytes: 256
a,b,c,d=map(int,input().split());w=c-a;h=d-b;print(h*'U'+w*'R'+h*'D'+(w+1)*'L'+(h+1)*'U'+(w+1)*'R'+'D'+'R'+(h+1)*'D'+(w+1)*'L'+'U')

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

using namespace std;
int main() {
	int a, b;
	cin >> a >> b;

	if (a >= 13) {
		cout << b << endl;
	}
	else if (a <= 5) {
		cout << 0 << endl;
	}
	else {
		cout << b / 2 << endl;
	}
}

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

int main() {
    int n, tmp;
    int a[n];
    double res;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> tmp;
        res += 1.0 / double(tmp);
    }
    cout << 1.0 / res << endl;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
	}
	if (sum % 2 == 0) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

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

using namespace std;

typedef long long ll;

ll k, n;
ll a[200111];
ll segments[200111];
ll max_seg = 0;
ll count_max_segs = 0;
ll ans = 0;
int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> k >> n;

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

    for (int i = 1; i <= n ; i++){
        if (i < n)
            segments[i] = a[i] - a[i - 1];
        else
            segments[i] = k - a[i - 1] + a[0];

        if (segments[i] > max_seg){
            max_seg = segments[i];
        }
        
    }

    for (int i = 1; i <= n ; i++){
        if (segments[i] == max_seg)
            count_max_segs++;
    }
    for (int i = 1; i <= n ; i++){
        if (segments[i] < max_seg)
            ans+=segments[i];
    }

    ans += (count_max_segs - 1)*max_seg;

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

Measured memory_bytes: 6744
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  s = input().strip()
  q = int(input())
  state = 1
  swap = [0, 2, 1]
  ss = []
  es = []
  for _ in range(q):
    x = input().strip()
    if x == '1':
      state *= -1
    else:
      _, f, c = x.split(' ')
      f = int(f)
      if state == -1:
        f = swap[int(f)]
      if f == 1:
        ss.append(c)
      else:
        es.append(c)
  s = ''.join(ss[::-1]) + s + ''.join(es)
  if state == -1:
    s = s[::-1]
  print(s)

if __name__=='__main__':
  main()



Measured memory_bytes: 6380
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using Graph = vector<vector<int>>;
const int INF = 1000000007;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int>v(n);
  rep(i,n)cin >> v[i];
  rep(i,k){
    bool end = true;
    rep(j,n)if(v[j] != n)end = false;
    if(end)break;
    vector<int>imos(n + 1);
    rep(j,n){
      imos[max(0,j - v[j])]++;
      imos[min(n,j + v[j] + 1)]--;
    }
    rep(j,n)imos[j + 1] += imos[j];
    rep(j,n)v[j] = imos[j];
  }
  rep(i,n){
    if(i == n - 1)cout << v[i] << endl;
    else cout << v[i] << " ";
  }
  return 0;
}


Measured memory_bytes: 4848
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#include <cmath>
#include <algorithm>

int main(int argc, char *argv[]){
    int N;
    std::cin >> N;
    long int A[N+1];
    long int monsters = 0;
    for(auto &a : A){
        std::cin >> a;
        monsters += a;
    }
    long int B[N];
    for(auto &b : B){
        std::cin >> b;
    }
    for(int i=0; i<N; ++i){
        if(A[i] <= B[i]){
            B[i] -= A[i];
            A[i] = 0;
        }else{
            A[i] -= B[i];
            B[i] = 0;
        }
        if(A[i+1] <= B[i]){
            B[i] -= A[i+1];
            A[i+1] = 0;
        }else{
            A[i+1] -= B[i];
            B[i] = 0;
        }
    }
    long int remains = 0;
    for(auto a : A){
        remains += a;
    }
    std::cout << monsters - remains << std::endl;
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,k,n) for (ll i = k; i < n; ++i)
#define inputar(a,n) ll a[n];rep(i,0,n)cin>>a[i]
#define PI 3.14159265
const int MOD=1e9+7;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()

#define test4(x,y,z,a) cerr<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cerr<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cerr<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cerr<<"x is "<<x<<endl;

int a[300*300+10];
    vector<int>v[301];
int main()
{
    IOS;
    ll a,b,t;
    cin>>a>>b>>t;
    cout<<b*(t/a)<<endl;   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {

  //int n; cin >> n ;
  int n; cin >> n;
  float a[n];
  for(int i = 0;i<n;i++) cin >> a[i];
  sort(a, a+n);
  float sum = (a[0] + a[1])/2;
  for(int i = 2;i<n;i++) {
  	sum = (sum + a[i])/2;
  }
  cout << sum << endl;
  return 0;


}

Measured memory_bytes: 256
n = int(input())
mi = 9999999999999999
for i in range(1,n):
    jj = n - i
    r = 0
    si = str(i)
    sj = str(jj)
    for i in range(len(si)):
        r += int(si[i])
    for i in range(len(sj)):
        r += int(sj[i])
    if mi > r:
        mi = r
print(mi)

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

int main()
{
        int N,M,P;
        while(cin >> N >> M >> P, (N||M||P))
        {
                int a[200];
                int cnt=0;
                for(int i=0; i<N; i++)
                {
                        cin >> a[i];
                        cnt+=a[i];
                }

                if(a[M-1]==0) cout << 0 << endl;
                else
                {
                        cout << (int)(1.0*cnt*(100-P)/a[M-1]) << endl;
                }
        }
}

Measured memory_bytes: 0
import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        r=math.sqrt(dis)
        if r.is_integer():
            ans+=1
print(ans)

Measured memory_bytes: 9000
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n,k,a[100005];

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> k;
    fort (i,n)
        cin >> a[i];
    sort (a+1,a+n+1);
    int m=a[n];
    fort (i,n-k+1)
        m=min(m,a[i+k-1]-a[i]);
    cout << m;
}


Measured memory_bytes: 640
n=int(input())
from collections import Counter
c=Counter()
for i in range(n):
  aa=int(input())
  if c[aa]>0:
    c[aa]-=1
    continue
  else:
    c[aa]+=1
ans=0
for k,v in c.items():
  if v>0:ans+=1
print(ans)


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

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] a = Input.ScanIntArray();
          Array.Sort(a);
          
          Console.WriteLine(a[2]*10 + a[1] + a[0]);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11348
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

S = input().rstrip()

win = 0
length = len(S)

for i in range(length):
    if S[i] == 'o':
        win += 1

win += 15 - length

if win >= 8:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3444
store=[]
str=["N","S","E","W"]
rep={
 "N":[4,0,2,3,5,1],
 "S":[1,5,2,3,0,4],
 "E":[2,1,5,0,4,3],
 "W":[3,1,0,5,4,2]}
 
def rotate_dice(b,s):
 result = [0]*6
 for i in range(6):
  result[i]=b[rep[s][i]]
 return result
      
def check(a,b):
 if not b in store:
  store.append(b)
  for s in str:
   check(a,rotate_dice(b,s))
  
a=input().split()
b=input().split()
r=check(a,b)
if a in store:
 print("Yes")
else:
 print("No")

Measured memory_bytes: 7604
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
bool tate[110],yoko[110];
int main() {
  ll n;
  cin>>n;
  ll ans;
  if(n<105)ans=0;
  else if(n<135)ans=1;
  else if(n<165)ans=2;
  else if(n<189)ans=3;
  else if(n<195)ans=4;
  else ans=5;
  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++)

int main(){
  int s,w;
  cin>>s>>w;
  if(s<=w)cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;
  
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vec = vector<ll>;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define rep(i, n) REP(i, 0, n)
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;

int main(void) {
	ll n, m, l;
	while(true){
		cin >> n >> m >> l;
		if(n == 0 && m == 0 && l == 0) break;
		m = (1LL << n) - m;
		--l;
		
		bool cnt = false;
		vector<bool> up(n);
		for(int i = n - 1; i >= 0; --i){
			if(((m >> i) & 1) ^ cnt){
				up[i] = true;
				cnt = !cnt;
			}
		}

		string ans;
		rep(i, n){
			ll b = 1LL << (n - 1 - i);
			if(up[i]){
				if(l < b){
					ans += 'L';
					l = b - 1 - l;
				}else{
					ans += 'R';
					l = 2 * b - 1 - l;
				}
			}else{
				if(l < b){
					ans += 'R';
				}else{
					ans += 'L';
					l -= b;
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}



Measured memory_bytes: 3232
fun main(args:Array<String>) {
    val itemCount = readLine()!!.toInt()
    val ans = (1..itemCount).map { readLine()!!.toLong() }.reduce { acc, l -> getKoubai(acc, l) }
    println(ans)
}

fun getKouyaku(num1:Long, num2:Long):Long {
    if(num1 % num2 == 0L) {
        return num2
    }
    return getKouyaku(num2, num1 % num2)
}

fun getKoubai(num1: Long, num2: Long):Long {
    val kouyaku = getKouyaku(num1,num2)
    val num1tmp = num1/kouyaku
    val num2tmp = num2/kouyaku
    return kouyaku * num1tmp *num2tmp
}

Measured memory_bytes: 33832
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b;
	cin >> a >> b;
	if (a + b >= 10)
	{
		cout<<"error";
	}
	else
	{
		cout << a + b;
	}
	cout << endl;
	
}

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

int main(){
  int A, B;
  cin >> A >> B;
  if(A>9||B>9) cout <<"-1";
  else cout << A * B;
  
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
y = 0
r = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, y, a[i]/(y+1), a[i]]
    r += y
x.sort(key= lambda val : val[2],reverse=True)
for i in range(k-r):
    x[i][1] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][3]/(x[i][1]+1))
print(int(-(-ans//1)))


Measured memory_bytes: 59200
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define rep(i,n) for((i)=0;(i)<(n);(i)++)

string s;
LL step2[N],step3[N];
int sum[N];
LL ans;

int main()
{
	
	int i;
	cin>>s;
	sum[0]=(s[0]=='1');
	rep(i,s.size()-1)
		sum[i+1]=sum[i]+(s[i+1]=='1'); 
	step2[0]=1;
	rep(i,s.size())
		step2[i+1]=step2[i]*2%MOD;
	step3[0]=1;
	rep(i,s.size())
		step3[i+1]=step3[i]*3%MOD;
	
	rep(i,s.size())
		if(s[i]=='1') ans+=(step2[sum[i-1]])*(step3[s.size()-1-i])%MOD;
	ans+=step2[sum[s.size()-1]];
	cout<<ans%MOD<<'\n';
	
	return 0;
}

Measured memory_bytes: 2432
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(float,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B = input().split()
A = int(A)
B = B.replace(".","")
B = int(B)

print(A*B // 100)

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

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define all(v) v.begin(),v.end()
#define ve vector
#define vi vector<int>
#define vi2 vector<vi>
#define vl vector<long long>
#define vl2 vector<vl>

template <class T> T maxAny(T a, T b){
    if(a > b) return a;
    else return b;
}

template <class T> T minAny(T a, T b){
    if(a > b) return b;
    else return a;
}

int main(){
    int n, x, t;
    cin >> n >> x >> t;
    if(n % x == 0) cout << n/x * t << endl;
    else cout << n/x * t + t << endl;
}

Measured memory_bytes: 3632
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

def bfs(sy=0, sx=0, c=[['.']], gy=0, gx=0, blocks=['#'], return_maximum_distance=False):
    H = len(c)
    W = len(c[0])
    dire = [(1,0), (0,1), (-1,0), (0,-1)]
    dist = [[1000000007]*W for i in range(H)]

    q = deque()

    if (type(sy)==list) and (type(sx)==list):
        for syi, sxi in zip(sy, sx):
            dist[syi][sxi] = 0
            q.append((syi, sxi))
    else:
        dist[sy][sx] = 0
        q.append((sy, sx))

    if (return_maximum_distance):
        while q:
            y, x = q.popleft()
            for dy, dx in dire:
                if (y+dy<H) and (y+dy>=0) and (x+dx<W) and (x+dx>=0):
                    if (c[y+dy][x+dx] in blocks):
                        continue
                    elif (dist[y+dy][x+dx] > dist[y][x]+1):
                            dist[y+dy][x+dx] = dist[y][x]+1
                            q.append((y+dy, x+dx))
        maximum_distance = 0
        for i in range(H):
            for j in range(W):
                if (dist[i][j] < 1000000007):
                    maximum_distance = max(dist[i][j], maximum_distance)
        return maximum_distance

    else:
        while q:
            y, x = q.popleft()
            for dy, dx in dire:
                if (y+dy<H) and (y+dy>=0) and (x+dx<W) and (x+dx>=0):
                    if (c[y+dy][x+dx] in blocks):
                        continue
                    else:
                        if (y+dy==gy) and (x+dx==gx):
                            return (dist[y][x]+1)
                        elif (dist[y+dy][x+dx] > dist[y][x]+1):
                            dist[y+dy][x+dx] = dist[y][x]+1
                            q.append((y+dy, x+dx))
        return -1

H, W = LI()
c = SR(H)

sy, sx = [], []

for i in range(H):
    for j in range(W):
        if (c[i][j]=="#"):
            sy.append(i)
            sx.append(j)

print(bfs(sy, sx, c, return_maximum_distance=True))


Measured memory_bytes: 140104
n, y = map(int, input().split())
for i in range(n + 1):
  for j in range(n - i + 1):
    if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
      print(i, j, n - i - j)
      exit()
print("-1 -1 -1")

Measured memory_bytes: 2940