akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	}

}

Measured memory_bytes: 23508
#include<iostream>

using namespace std;

int main(){
  int n,m;
  while(1){
    cin>>n;
    char a[n],b[n],cha;
    if(n==0)
      break;
    for(int i=0;i<n;i++){
      cin>>a[i]>>b[i];
    }
    cin>>m;
 
    for(int i=0;i<m;i++){
      cin>>cha;
      for(int j=0;j<n;j++){
	if(cha==a[j]){
	  cout<<b[j];
	  break;
	}else if(j+1==n){
	  cout<<cha;
	}
      }
    }
   cout<<endl;
  }
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
void chmes(string &s,char me){
  if(me == 'C'){
    string tmp="";
    for(int i=1;i<s.size();i++){
      tmp+=s[i];
    }
    tmp += s[0];
    s = tmp;
  }else if(me == 'J'){
    string tmp="";
    tmp+=s.back();
    for(int i=0;i<s.size()-1;i++){
      tmp+=s[i];
    }
    s = tmp;
  }else if(me == 'E'){
    if(s.size()%2 == 1){
      string tmp1="",tmp2="";
      for(int i=0;i<s.size()/2;i++){
	tmp1+=s[i];
	tmp2+=s[s.size()/2+i+1];
      }
      char hge = s[s.size()/2];
      s = tmp2;
      s+= hge;
      s += tmp1;
    }else{
      string tmp1="",tmp2="";
      for(int i=0;i<s.size()/2;i++){
	tmp1+=s[i];
	tmp2+=s[s.size()/2+i];
      }
      s = tmp2+tmp1;
      // cout<<"!"<<s<<endl;
    }
  }else if(me == 'A'){
    reverse(ALL(s));
  }else if(me == 'M'){
    for(int i=0;i<s.size();i++){
      if(isdigit(s[i])){
	s[i] = (char)('0'+(s[i]-'0'+1)%10);
      }
    }
  }else{
    for(int i=0;i<s.size();i++){
      if(isdigit(s[i])){
	s[i] = (char)('0'+(s[i]-'0'+9)%10);
      }
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  for(int i=0;i<n;i++){
    string s,ss;
    cin>>s>>ss;
    reverse(ALL(s));
    for(auto a:s){
      chmes(ss,a);
    }
    cout<<ss<<endl;
  }
  return 0;
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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;
}

int main() {
  int N, M;
  cin >> N >> M;
  typedef pair<int, int> P;

  vector<P> AB(N);
  rep(i, N) {
    cin >> AB[i].fi >> AB[i].se;
    AB[i].fi;
  }
  sort(all(AB));
  priority_queue<int> p;

  int ans = 0;
  int x = 0;
  repp(i, 1, M) {
    while (AB[x].fi <= i) {
      p.push(AB[x].se);
      x++;
    }
    if (!p.empty()) {
      ans += p.top();
      p.pop();
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 1660
N = int(input())
p = list(map(int, input().split()))

A = [(N * i) + 1  for i in range(N)]
B = [(N * (N -i - 1) + 1) for i in range(N)]

for i in range(N):
    A[p[i] - 1] += i

print (*A)
print (*B)

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

void solve(long long N)
{
    ll ans = 1e9;
    for (ll a = 1; a * a <= N; a++) {
        if (N % a == 0) {
            auto F = (ll)max(to_string(a).size(), to_string(N / a).size());
            ans = min(ans, F);
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long N;
    scanf("%lld",&N);
    cin.tie(nullptr);
    cout.tie(nullptr);
	ios_base::sync_with_stdio(false);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
// -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    InputStream inputStream;
    if (args.length > 0 && args[0].equals("devTesting")) {
      try {
        inputStream = new FileInputStream(args[1]);
      } catch(FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    } else {
      inputStream = System.in;
    }
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskD solver = new TaskD();
    solver.solve(1, in, out);
    out.close();
  }
  
  static class TaskD {    
    int n, e, t;
    int[] x;
    
    void solve(int testNumber, InputReader in, PrintWriter out) {
      n = in.nextInt();
      e = in.nextInt();
      t = in.nextInt();
      x = new int[n + 1];
      for (int i = 1; i <= n; ++i)
        x[i] = in.nextInt();
      long[][] state = new long[2][n + 1];
      int ptr = 0;
      long min = Long.MAX_VALUE / 2;
      for (int i = 1; i <= n; ++i) {
        while (2 * (x[i] - x[ptr + 1]) > t)
          ++ptr;
        state[1][i] = ptr;
        for (int j = (int) state[1][i - 1]; j < (int) state[1][i]; ++j)
          min = Math.min(min, state[0][j] - 2 * x[j + 1]);
        state[0][i] = Math.min(min + 2 * x[i], state[0][(int) state[1][i]] + t);
      }
      long ans = state[0][n] + e;
      out.println(ans);
    }
    
  }
      
  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

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

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

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

    public long nextLong() {
      return Long.parseLong(next());
    }
    
    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public boolean hasInput() {
      try {
        if (tokenizer != null && tokenizer.hasMoreTokens()) {
          return true;
        }
        reader.mark(1);
        int ch = reader.read();
        if (ch != -1) {
          reader.reset();
          return true;
        }
        return false;
      } catch(IOException e) {
        throw new RuntimeException(e);
      }
    }
    
  }
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mod 1000000007
#define inf 1e18
#define endl "\n"

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

int main()
{
    fastio
    ll test=1,n;

    // cin >> test;

    while(test--)
    {
        cin >> n ;
        cout << 10 - n/200 << endl;        
    }


    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll t,i,j,n,b,c,d,k;
	char a;
	cin>>a;
	if('a'<=a and a<='z') cout<<"a\n";
	else cout<<"A\n";
	return 0;
}

Measured memory_bytes: 3644
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    let n = Int(readLine()!)!
    var aryA = readInts()
    //_________________________ここまで入力
    aryA.sort()
    for i in 0..<n-1 {
        if aryA[i] == aryA[i+1] {
            print("NO")
            return
        }
    }
    print("YES")
}

main()





Measured memory_bytes: 24272
import           Control.Applicative
import           Control.Monad
import           Data.Array
import           Data.List

solve :: [Int] -> Int
solve = maximum . scanl1 (\a b -> max (a + b) b)

main :: IO ()
main = getContents >>= loop . map read . lines
  where
    loop (0:_)  = return ()
    loop (x:xs) = let (as, rs) = splitAt x xs
                  in  print (solve as) >> loop rs

Measured memory_bytes: 5776
import sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from collections import defaultdict
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,OrderedDict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map(int, sys.stdin.readline().split()))
n = I()
if n == 1:
    print(0)
else:
    print(1)    

Measured memory_bytes: 9468
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

long foo[3][3] = { 0 };

void solve() {
  rep (i, 3) rep (j, 3) cin >> foo[i][j];

  rep (i, 2) rep (j, 2) {
    if (foo[i][j+1] - foo[i][j] != foo[i+1][j+1] - foo[i+1][j]) {
      cout << "No" << endl;
      return;
    }
    if (foo[i+1][j] - foo[i][j] != foo[i+1][j+1] - foo[i][j+1]) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int N,X;
    
    scanf("%d%d",&N,&X);
    
    int m[N],i,nokori,min;
    min = X;
    nokori = X;
    
    for (i=0;i<N;i=i+1) {
        
        scanf("%d",&m[i]);
        nokori = nokori-m[i];
        if (min>m[i]) {
            min = m[i];
        }
        
        
        
    }
    
    
    
    
    
    
    printf("%d\n",N+(nokori/min));
    return 0;
}


Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let n = get!(usize);
    let s: Vec<char> = util::line().chars().collect();

    let mut l = 0;
    let mut r = 0;

    for &c in &s {
        if c == '(' {
            r += 1;
        } else {
            if r == 0 {
                l += 1;
            } else {
                r -= 1;
            }
        }
    }

    for _ in 0..l {
        print!("(");
    }

    print!("{}", s.iter().cloned().collect::<String>());

    for _ in 0..r {
        print!(")");
    }

    println!("");
}


Measured memory_bytes: 4352
#include <stdio.h>

int main()
{
  int a, b, c;
  int a2, b2, c2;
  int ans=0;
  scanf(" %d %d %d", &a, &b, &c);

  
  while(a%2==0 && b%2==0 && c%2==0){
    if(a == b && b == c){
      puts("-1");
      return 0;
    }
    a2 = a/2;
    b2 = b/2;
    c2 = c/2;
    a = b2 + c2;
    b = a2 + c2;
    c = a2 + b2;
    ans++;
  }

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# Your code here!
S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


if flag1 == True and flag2 == False:
    print("YYMM")
elif flag1 == False and flag2 == True:
    print("MMYY")
elif flag1 == True and flag2 == True:
    print("AMBIGUOUS")
else:
    print("NA")


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

int main()
{
    string alp ="abcdefghijklmnopqrstuvwxyz";
    char c[2];
    cin >> c;
    for (int i = 0; alp.size(); i++) {
        if (alp[i] == *c) {
            cout << alp[i+1] << endl;
            return 0;
        }
    }

    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

void solve(long long N, long long K, std::vector<long long> h)
{
    int count = 0;
    rep(i, N)
    {
        if (h[i] >= K)
        {
            count++;
        }
    }
    cout << count << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::vector<long long> h(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define ull unsigned ll
#define pll pair<ll, ll>
#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'
#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout);
#define M 1000000007
#define N 105
#define INF 101111111111111
using namespace std;
ll a[N];
main(){
    FAST;
    ll n;
    cin >> n;
    for(ll i =0;i<n;i++) cin >> a[i];
    ll res = 0;
	for(ll i = 0;i<n;i++){
		for(ll j= i+1;j<n;j++) res += a[i]*a[j];
	}
	cout << res;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
const ll MAX_N = 10000100;

vector<int> is_prime;
void init_prime()
{
    is_prime.assign(MAX_N, 1);
    is_prime[0] = 0;
    for (ll i = 2; i*i < MAX_N; ++i)
    if (is_prime[i])
    {
        for (ll j = i*i; j < MAX_N; j += i)
            is_prime[j] = 0;
    }
}

int main()
{
    init_prime();
    ll a, b;
    cin >> a >> b;

    int cnt = 1;
    for (ll n = 2; n <= MAX_N; ++n)
    if (is_prime[n] and a % n == 0 and b % n == 0)
        ++cnt;
    
    ll g = __gcd(a, b);
    // cout << g << endl;
    rep(i, 2, MAX_N)
    if(is_prime[i])
        while(g % i == 0)
            g /= (ll)i;
    
    if (g > 1) ++cnt;

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 39296
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}


int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int a[n],b[n];
    vector<int> v,w;
    rep(i,0,n){
        cin>>a[i]>>b[i];
        v.push_back(a[i]);
        w.push_back(b[i]);
    }
    sort(v.begin(),v.end());
    sort(w.begin(),w.end());
    if(n%2){
        cout<<w[n/2]-v[n/2]+1<<endl;
    }
    else{
        int mi=v[n/2]+v[n/2-1];
        int ma=w[n/2]+w[n/2-1];
        cout<<ma-mi+1<<endl;
    }
}


Measured memory_bytes: 6684
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(u32);
    let A = get!(Vec<i64>);

    // 解は3^N - 2^(Aに含まれる偶数の個数)
    let M = A.iter()
        .filter(|&a| a % 2 == 0)
        .count();
    let ans = 3_i64.pow(N) - 2_i64.pow(M as u32);

    println!("{}", ans);
}


Measured memory_bytes: 4352
N=int(input())
A=sorted(list(map(int,input().split())))
min0,min1=A[0],A[1]

if min0==min1==1:
    print(1)
    exit()
if N==2:
    print(max(A))
    exit()
yakusuu0lst=[]
yakusuu1lst=[]

if min0>1:
    for i in range(1,int(min0**0.5+1)):
        if min0%i==0:
            yakusuu0lst.append(i)
            yakusuu0lst.append(min0//i)
if min1>1:
    for i in range(1,int(min1**0.5+1)):
        if min1%i==0:
            yakusuu1lst.append(i)
            yakusuu1lst.append(min1//i)
yakusuu0count=[0 for i in range(len(yakusuu0lst))]
yakusuu1count=[0 for i in range(len(yakusuu1lst))]
length0=len(yakusuu0lst)
length1=len(yakusuu1lst)

for a in A:
    for i in range(length0):
        if a%yakusuu0lst[i]==0:yakusuu0count[i]+=1
    for i in range(length1):
        if a%yakusuu1lst[i]==0:yakusuu1count[i]+=1


div=1
for i in range(length0):
    if yakusuu0count[i]>=N-1 and div<yakusuu0lst[i]:
        div=yakusuu0lst[i]

for i in range(length1):
    if yakusuu1count[i]>=N-1 and div<yakusuu1lst[i]:
        div=yakusuu1lst[i]

print(div)


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	int n;
	std::cin >> n;
	int mi,ma;
	std::cin >> mi;
	ma = mi;
	for (size_t i = 1; i < n; i++) {
		int temp;
		std::cin >> temp;
		mi = min(mi, temp);
		ma = max(ma, temp);
	}
	std::cout << ma - mi << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int bl[2001][2001];
int sbl[2001][2001];

int cbl(int x1, int x2, int y1, int y2) {
    return sbl[x2][y2] - sbl[x1][y2] - sbl[x2][y1] + sbl[x1][y1];
}

void printbl(int k) {
    REPI(i,1,k+1) {
        REPI(j,1,k+1) {
            cout << bl[i][j];
        }
        cout << endl;
    }
}

int cnt(int i, int j, int k) {
    return cbl(0, i, 0, j) + cbl(i, i + k, j, j + k) + cbl(0, i, j + k, 2 * k) + cbl(i + k, 2 * k, 0, j) + cbl(i + k, 2 * k, j + k, 2 * k);
}

int main() {
    int n, k;
    cin >> n >> k;
    int x, y;
    char c;
    REP(i,n) {
        cin >> x >> y >> c;
        if (c == 'W') x += k;
        x %= 2 * k;
        y %= 2 * k;
        x++;
        y++;
        bl[x][y]++;
    }
    REPI(i,1,2001) {
        REPI(j,1,2001) {
            sbl[i][j] = bl[i][j] + sbl[i-1][j] + sbl[i][j-1] - sbl[i-1][j-1];
        }
    }
//    printbl(2 * k);
    int ans = 0;
    REP(i,k+1) {
        REP(j,k+1) {
            int r = cnt(i, j, k);
            if (ans < max(r, n - r)) {
                ans = max(r, n - r);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 31488
#include <stdio.h>
int main(void)
{
	int n;
	int a[100];
	int i, j;
	int color[] = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200};
	int cnt[9] = {0};
	int max = 0, min = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (1 <= a[i] && a[i] <= 399) cnt[0]++;
		for (j = 1; j < 8; j++) {
			if (color[j] - 400 <= a[i] && a[i] < color[j]) cnt[j]++;
		}
		if (3200 <= a[i] && a[i] <= 4800) cnt[8]++;
	}
	for (i = 0; i < 8; i++)
		if (cnt[i] > 0) min++;
	// printf("[%4d ~ %4d] : %d\n", 1, 399, cnt[0]);
	// for(i = 1; i < 8; i++) printf("[%4d ~ %4d] : %d\n", color[i] - 400, color[i] - 1, cnt[i]);
	// printf("[%4d ~ %4d] : %d\n", 3200, 4800, cnt[8]);
	// if (8 - min > cnt[8]) max = min + cnt[8];
	// else if (cnt[8] > 0)  max = min + (8 - min);
	max = min + cnt[8];
	if (min == 0) min = 1;
	printf("%d %d\n", min, max);
	return 0;
}

Measured memory_bytes: 128
N=int(input())
S=[sorted(list(input())) for _ in range(N)]
l=S[0]
len_s=len(S)
for i in range(len_s):
    l=list(set(l)&set(S[i]))
ans=''
len_l=len(l)
for i in range(len_l):
    cnt=50
    for j in range(len_s):
        if cnt>S[j].count(l[i]):
            cnt=S[j].count(l[i])
    ans+=(l[i]*cnt)
print(''.join(sorted(ans)))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<ll> VL;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)

bool pairCompare(const pair<ll, ll>& firstElof, const pair<ll, ll>& secondElof)
{
    return firstElof.second > secondElof.second;
}

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

  ll N, M;
  cin >> N >> M;
  ll A[N];
  for (ll i = 0; i < N; ++i) {
    cin >> A[i];
  }
  pair<ll, ll> BC[M];
  for (ll i = 0; i < M; ++i) {
    ll b, c;
    cin >> b >> c;
    BC[i] = make_pair(b, c);
  }

  sort(A, A + N);
  sort(BC, BC + M, pairCompare);

  ll cur = 0;

  for (ll i = 0; i < M; ++i) {
    ll b = BC[i].first;
    ll c = BC[i].second;
    for (ll j = 0; j < b; ++j) {
      if (cur == N) {
        break;
      }
      if (A[cur] < c) {
        A[cur] = c;
        ++cur;
      } else {
        break;
      }
    }
  }

  ll ans = 0;
  for (ll i = 0; i < N; ++i) {
    ans += A[i];
  }

  cout << ans << endl;

}


Measured memory_bytes: 2560
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int N;
  std::cin >> N;

  std::vector<int> V(N);
  std::vector<int> C(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> V[i];
  }
  for (int i = 0; i < N; ++i) {
    std::cin >> C[i];
  }

  // Main
  int res = 0;
  for (int i = 0; i < N; ++i) {
    if (V[i] - C[i] > 0)
      res += V[i] - C[i];
  }

  // Output
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

int main() {
  std::map<std::string, int> s_to_num;
  std::map<int, std::string> num_to_s;
  s_to_num["Sunny"] = 0;
  s_to_num["Cloudy"] = 1;
  s_to_num["Rainy"] = 2;
  num_to_s[0] = "Sunny";
  num_to_s[1] = "Cloudy";
  num_to_s[2] = "Rainy";

  std::string str;
  std::cin >> str;
  std::cout << num_to_s[(s_to_num[str] + 1) % 3] << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    ll X, c500, c5;
    cin >> X;

    c500 = X / 500;
    c5 = (X - c500 * 500) / 5;

    cout << (c500 * 1000 + c5 * 5) << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;
// サイズ可変mod
class mod{
    public:
    ll N, M;
    vector<ll>fact;
    vector<ll>inv;
    vector<ll>finv;

    ll m_plus(ll a, ll b){return (a + b) % M;}
    ll m_minus(ll a, ll b){return (a + M - b) % M;}
    ll m_times(ll a, ll b){return (a * b) % M;}
    ll m_pow(ll a, ll b){
        ll ret = 1;
        while(b > 0){
            if(b & 1)(ret *= a) %= MOD;
            (a *= a) %= MOD;
            b >>= 1;
        }
        return ret;
    }

    void update(ll n){
        if(N > n)return;
        for(ll i = N; i <= n; i++){
            fact.push_back(m_times(fact[i - 1], i));
            inv.push_back(m_pow(i, M - 2));
            finv.push_back(m_times(finv[i - 1], inv[i]));
        }
        N = n + 1;
    }

    // 除算
    ll m_divs(ll a, ll b){
        if(N <= b)update(b);
        return m_times(a, inv[b]);
    }

    // N種の要素を並び替えてできる通りの数
    ll m_fact(ll a){
        if(N <= a)update(a);
        return fact[a];
    }

    // 階乗で割る
    ll m_finv(ll a){
        if(N <= a)update(a);
        return finv[a];
    }

    // N種の要素からk個取り出して並べる通りの数
    ll m_nPk(ll n, ll k){
        return m_times(m_fact(n), m_finv(n - k));
    }
    // N種の要素からk個を選ぶ通りの数
    // a個の赤い玉とb個の青い球を並び替える通りは(a+b)C(a)
    ll m_nCk(ll n, ll k){
        return m_times(m_nPk(n, k), m_finv(k));
    }
    // N種の要素からk個を選ぶ通りの数(重複して良い)
    ll m_nHk(ll n, ll k){
        return m_nCk(n + k - 1, k);
    }
    
    mod(ll m = MOD){
        M = m;
        N = 1;
        fact = vector<ll>(1, 1);
        inv = vector<ll>(1, 1);
        finv = vector<ll>(1, 1);
    }
};
int main(){
    mod m;
    ll N, A, B, C;
    cin >> N >> A >> B >> C;
    ll pa = m.m_divs(A, A + B);
    ll pb = m.m_divs(B, A + B);
    ll ans = 0;
    rep(i, N){
        ll a = (m.m_nCk(N + i - 1, i) * m.m_times(m.m_pow(pa, N), m.m_pow(pb, i))) % MOD;
        ll b = (m.m_nCk(N + i - 1, i) * m.m_times(m.m_pow(pa, i), m.m_pow(pb, N))) % MOD;
        ans = (ans + ((m.m_plus(a, b) * (N + i)) % MOD)) % MOD;
    }
    ans = (ans * 100) % MOD;
    ans = m.m_divs(ans, A + B);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 5204
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.math;

void main() {
  int n = readln.chomp.to!int;
  int[] arr = readln.chomp.split.map!(to!int).array;
  long ans = 1000000000000007;

  for (int i = 0; i < 2; ++i) {
    auto a = arr.dup;
    long tmp;
    long[] sum_a = new long[](n);

    // 偶数番目が正の数
    if (i == 0) {
      for (int j = 0; j < n; ++j) {
        sum_a[j] = a[j] + (j == 0 ? 0 : sum_a[j - 1]);

        if (j % 2 == 0 && sum_a[j] <= 0) {
          long dif = 1 - sum_a[j];
          a[j] += dif;
          sum_a[j] += dif;
          tmp += dif.abs;
        }
        else if (j % 2 == 1 && sum_a[j] >= 0) {
          long dif = -1 - sum_a[j];
          a[j] += dif;
          sum_a[j] += dif;
          tmp += dif.abs;
        }
      }
    }
    else {
      for (int j = 0; j < n; ++j) {
        sum_a[j] = a[j] + (j == 0 ? 0 : sum_a[j - 1]);

        if (j % 2 == 1 && sum_a[j] <= 0) {
          long dif = 1 - sum_a[j];
          a[j] += dif;
          sum_a[j] += dif;
          tmp += dif.abs;
        }
        else if (j % 2 == 0 && sum_a[j] >= 0) {
          long dif = -1 - sum_a[j];
          a[j] += dif;
          sum_a[j] += dif;
          tmp += dif.abs;
        }
      }
    }

    ans = ans.min(tmp);
  }

  ans.writeln;

  return;
}


Measured memory_bytes: 7712
#include <bits/stdc++.h>
//#include "utils.cpp"
#define itr iterator
#define psb push_back
#define mkp make_pair
#define mkt make_tuple
#define fi first
#define se second
#define T tuple
#define E exit(0)
#define F function
#define V vector
#define pii pair<int, int>
#define tiii tuple<int, int, int>
#define ll long long
#define S string
#define bt cerr << "line " << __LINE__ << endl
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define MOD int(1e9 + 7)
#define INF (INT_MAX / 2)
using namespace std;

int x;
int main() {
	cin >> x;
	int h = 0;
	h += x / 500 * 1000;
	x %= 500;
	h += x / 5 * 5;
	cout << h << endl; 
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		sc.close();
		
		int otherIdx = 0;
		for(int i = 0;i < S.length();++i)
			if(S.charAt(i) != '1') {
				otherIdx = i;
				break;
			}
		
		if(otherIdx >= K)
			System.out.println(1);
		else
			System.out.println(S.charAt(otherIdx));
	}
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	ll a,v,b,w,t;
	cin >> a >> v;
	cin >> b >> w;
	cin >> t;
	
	if (v > w) {
		if (b > a) {
			if ((b - a) <=  (v - w) * t) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			if ((a - b) <=  (v - w) * t) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cctype>
#include<cstring>
#include<utility>
#include<algorithm>
#define fi first
#define se second
namespace IO
{
    char ibuf[(1<<21)+1],*iS,*iT;
    char Get(){return (iS==iT? (iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT? EOF:*iS++)):*iS++);}
    int read(){int x=0,c=Get();while(!isdigit(c))c=Get();while(isdigit(c))x=x*10+c-48,c=Get();return x;}
}
using IO::read;
using std::pair;
using pi=pair<int,int>;
const int N=200007,M=5000007;
int n,a[N],val[N],sum[N],mx[2],mn[2][2],c[2][2];pi pos[N];
char ans[N];
struct BIT
{
    int t[N],top;pi stk[M];
    void add(int p,int v){for(;p<=n;p+=p&-p)stk[++top]={p,t[p]},t[p]=std::max(t[p],v);}
    int ask(int p){int r=-1e9;for(p=std::min(p,n);p;p^=p&-p)r=std::max(r,t[p]);return r;}
    void undo(int p){for(;top>p;--top)t[stk[top].fi]=stk[top].se;}
}t[2];
int main()
{
    n=read();
    for(int i=1,x=n+1;i<=n;++i) if(x>(a[i]=n+1-read())) x=a[i],val[i]=2; else val[i]=1;
    memset(t[1].t,0x8f,sizeof t[1].t);
    for(int i=n;i;--i) sum[i]=sum[i+1]+(val[i]==2);
    for(int i=n;i^1;--i)
    {
	for(int j=0;j<2;++j) mx[j]=std::max(0,t[j].ask(a[i]));
	for(int j=0,x;j<2;++j) x=mx[j]+val[i],t[x&1].add(a[i],x);
	pos[i]={t[0].top,t[1].top};
    }
    mn[0][0]=mn[0][1]=n+1;
    for(int i=1,now=0;i<=n;++i)
    {
    	now^=1;
        if(i<n)	t[0].undo(pos[i+1].fi),t[1].undo(pos[i+1].se);
	for(int j=0,f;j<2;++j)
	{
	    memcpy(mn[now],mn[now^1],8),memcpy(c[now],c[now^1],8);
	    if(a[i]<mn[now^1][j]) mn[now][j]=a[i],c[now][j]=c[now^1][j]+1;
	    f=i==n? (c[now][0]==c[now][1]):0;
	    if(i<n)
	    {
		for(int k=0,x;k<2;++k)
		{
		    x=c[now][k]-c[now][k^1]+sum[i+1];
		    if(x>=0&&x<=t[x&1].ask(mn[now][k^1])) {f=1;break;}
		}
	    }
	    if(f) {ans[i]='0'+j;break;}
    	}
    	if(!ans[i]) return !printf("-1");
    }
    for(int i=1;i<=n;++i) putchar(ans[i]);
}


Measured memory_bytes: 85376
fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map(String::toLong)

    if (K % 2 == 0L) {
        var x = N / K
        var y = (N + K/2) / K
        println(x * x * x + y * y * y)
    } else {
        var x = N / K
        println(x * x * x)
    }
}

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

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    
    string T, S;
    cin >> T >> S;

    int ans = 0;
    rep(i, 3) {
        if (T[i] == S[i]) ans += 1;
    }

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

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

int main(){
  map<string,int>p;
  int n;
  string s;
  cin >> n;
  for(int i;i < n;i++){
    cin >> s;
    p[s]++;
  }
  if(p.size() == 4){
    s = "Four";
  }else s = "Three";
  cout << s << endl;
}


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

int main(){
    string s;
    int a,b;
    cin >>s;
    a=stoi(s.substr(0,2));
    b=stoi(s.substr(2,2));
    bool aM=false,bM=false;
    if(a>0&&a<13){
        aM=true;
    }
    if(b>0&&b<13){
        bM=true;
    }
    if(aM){
        if(bM){
            cout <<"AMBIGUOUS"<<endl;
        }else{
            cout << "MMYY"<<endl;
        }
    }else if(bM){
        cout << "YYMM"<<endl;
    }else{
        cout << "NA"<<endl;
    }
}

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

using namespace std;

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

	int N;
	cin >> N;

	vector<int> A(N, 0);

	for (int i = 0; i < N; ++i)
		cin >> skipws >> A[i];

	for (int i = 1; i <= A.size(); ++i)
	{
		for (int i = 0; i < N; ++i) {
			cout << A[i];
			if (i != N - 1)
				cout << " ";
		}
		cout << endl;

		int key = A[i];
		int j = i - 1;

		while (j >= 0 && A[j] > key) {
			A[j + 1] = A[j];
			j--;
		}

		A[j + 1] = key;
	}

	return 0;
}

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

int main(){
    int x;
    cin >> x;
    int M=1;
    int n;
    for(int i=2;i<=sqrt(x);i++){
        for(int j=2;1*pow(i,j)<=x;j++){
            n=pow(i,j);
            M=max(M,n);
        }
    }
    cout << M << endl;
}

Measured memory_bytes: 640
def makes( r,l ):
    s=""
    for i in range(r-1):
        s+="0 "
    rl=r+l
    rl2=rl//2
    if rl%2==0:
        s+=str(rl2)+" "
        s+=str(rl2)+" "
    else:
        if r%2==1 :
            s+=str(rl2+1)+" "
            s+=str(rl2)+" "
        if l%2==1 :
            s+=str(rl2)+" "
            s+=str(rl2+1)+" "
    for i in range(l-1):
        s+="0 "
    return s


s = input()
rc=lc=0
ans=""
for i in range(len(s)):
    if s[i]=="R":
        if rc!=0 and lc!=0 :
            ans += makes(rc,lc)
            rc=0
            lc=0
        rc+=1
    else:
        lc+=1
if rc!=0 and lc!=0 :
    ans += makes(rc,lc)
print(ans)

Measured memory_bytes: 9528
/*
    Problem 20
    https://atcoder.jp/contests/abc077/tasks/arc084_a
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 1000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<int> a, b, c;
int n;
/* function */
int bin1(int x) {
    int ok = 0;
    int ng = n+2;
    // a[i] < x なる最大の i を探す
    // ok , ..., ng
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (a[mid] < x) ok = mid;
        else ng = mid;
    }
    return ok;
}
int bin2(int x) {
    int ok = n+1;
    int ng = -1;
    // x < c[i] なる最小の i を探す
    // ng , ..., ok
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (x < c[mid]) ok = mid;
        else ng = mid;
    }
    return ok;
}
/* main */
int main(){
    cin >> n;
    a.resize(n);
    b.resize(n);
    c.resize(n);

    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    for (int i = 0; i < n; i++) scanf("%d", &b[i]);
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);

    a.push_back(-1), a.push_back(INF);
    c.push_back(-1), c.push_back(INF);
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        // 真ん中を決めて， (|a[i] < b[i]|) * (|b[i] < c[i]|)
        ans += (ll)bin1(b[i]) * (ll)(n+1 - bin2(b[i]));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define loop(i, a, b) for(li i=a; i<=b; i++)
#define stuff ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long li;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<li, li> lii;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ii> vii;
typedef vector<lii> vlii;
li mod = 1e9+7;
li expo(li base, li exponent)
{
	li ans=1;
	while(exponent)
	{
		if(exponent&1) ans = (ans*base)%mod;
		base = (base*base)%mod;
		exponent >>= 1;
	}
	return ans;
}
li gcd(li x, li y)
{
	if(y==0) return x;
	return gcd(y, x%y);
}


typedef tree<li, null_type, less<li>,
rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
	stuff;
	// #ifndef ONLINE_JUDGE 
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// freopen("error.txt", "w", stderr);
	// #endif

	li r;
	cin >> r;
	double pi = 3.14159265358979;
	double ans = 2*(pi)*r;
	cout << fixed << setprecision(8) << ans;
	return 0;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
int main(){
    bool flag =true;
    while(flag){
        priority_queue<pair<int,char> > data;
        while(!data.empty())data.pop();
        for(int i='A';i <='E';i++){
            int x,y;
            cin>>x>>y;
            int sum =x+y;
            if(sum==0){
                flag =false;
                break;
            }
            data.push(make_pair(sum,i));
        }
        if(flag)
            cout <<data.top().second<<" "<<data.top().first<<endl;
    }
    return 0;
}

Measured memory_bytes: 3072
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, H: "List[int]"):
    H.sort()
    H.reverse()
    return sum(h for h in H[K:])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, K, H))

if __name__ == '__main__':
    main()


Measured memory_bytes: 28928
#include <stdio.h>
int main(void)
{
	int a,b,c,tmp;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b){tmp=b;b=a;a=tmp;}
	if(b>c){tmp=c;c=b;b=tmp;}
	if(a>b){tmp=b;b=a;a=tmp;}
	if(a+b==c){printf("Yes\n");}
	else{printf("No\n");}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>
#define rep(i,n) for (int i = 0; i < n; ++i)


using namespace std;

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

	bool can = false;
	rep(i, 10)
	{
		rep(j, 10)
		{
			if (i * j == N)
			{
				can = true;
				break;
			}
		}
	}

	cout << (can ? "Yes" : "No");
}


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

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

    int n;
    cin >> n;
    map<int, int> mp;
    REP(i, n){
        int a, b;
        cin >> a >> b;
        mp[a] = b;
    }
    
    int rank = 0, cnt = 0, idx = 0;
    for(auto x : mp){
        if(idx == n - 1){
            cnt += x.second;
        }
        cnt += x.first - rank - 1;
        rank = x.first;
        idx++;
    }
    cout << cnt + n << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

int main(){
  int k, x;
  cin >> k >> x;

  for(int i = x-k+1; i <= x+k-1; i++) cout << i << " ";

  cout << endl;
  
  return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  vector<int> a(5);
  int k;
  REP(i,5) cin >> a[i];
  cin >> k;

  string ret = "Yay!";
  if(a[4] - a[0] > k) {
    ret = ":(";
  }
  cout << ret << endl;
  return 0;
}



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

int main() {
	// your code goes here
		int n, m;
		
		cin >> n;
		cin >> m;
		
		string s[n];
		
		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
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007


ll n,nn,h[200005],a[200005],t[600005];

void update(ll p,ll v)
{
    p+=nn; t[p]=v;
    for(p>>=1;p;p>>=1)t[p]=max(t[p<<1],t[p<<1|1]);
}

ll query(ll l,ll r)
{
    ll res=0;
    for(l+=nn,r+=nn;l<=r;l>>=1,r>>=1)
    {
        if(l&1) res=max(res,t[l++]);
        if(!(r&1)) res=max(res,t[r--]);
    }
    return res;
}

int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    ll y=0;
    for(int i=0;i<n;i++){cin>>h[i];y=max(y,h[i]);}
    for(int i=0;i<n;i++)cin>>a[i];
    
    nn=1; while(nn<=y)nn*=2;
    ll x, ans=0;
    for(int i=0;i<n;i++)
    {
        x=query(1,h[i]-1);
        ans=max(ans,x+a[i]);
        update(h[i],x+a[i]);
    }
    
    cout<<ans<<"\n";

}

Measured memory_bytes: 7680