akhauriyash/Code-Regression huggingface dataset:
use proconio::{input, marker::Usize1};

fn main() {
    input! {
        r: usize,
        c: usize,
        k: usize,
        rcv: [(Usize1, Usize1, u64); k],
    }

    let b = make_board(&rcv, r, c);

    let mut dp = vec![vec![vec![None; 3 + 1]; c]; r];
    dp[0][0][0] = Some(0);
    for i in 0..r {
        for j in 0..c {
            for k in (0..3).rev() {
                if let Some(v) = dp[i][j][k] {
                    set_v(&mut dp, i, j, k + 1, v + b[i][j])
                }
            }
            for k in 0..=3 {
                if let Some(v) = dp[i][j][k] {
                    if i + 1 < r {
                        set_v(&mut dp, i + 1, j, 0, v)
                    }
                    if j + 1 < c {
                        set_v(&mut dp, i, j + 1, k, v)
                    }
                }
            }
        }
    }

    let mut ans = 0;
    for k in 0..=3 {
        if let Some(v) = dp[r - 1][c - 1][k] {
            ans = ans.max(v);
        }
    }

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

fn set_v(dp: &mut Vec<Vec<Vec<Option<u64>>>>, i: usize, j: usize, k: usize, v: u64) {
    let nv = &mut dp[i][j][k];
    let v = if let Some(nv) = *nv { nv.max(v) } else { v };
    *nv = Some(v);
}

fn make_board(rcv: &Vec<(usize, usize, u64)>, r: usize, c: usize) -> Vec<Vec<u64>> {
    let mut b = vec![vec![0; c]; r];
    for &(i, j, v) in rcv {
        b[i][j] = v;
    }
    b
}


Measured memory_bytes: 995416
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
    return 0;
}


Measured memory_bytes: 3592
<?php

class Simulator
{
    public $array = array();
    public $n_operations;
    public $operations;

    public function __construct()
    {
        fscanf(STDIN, '%d', $this->n_operations);
        $this->operations = new \SplDoublyLinkedList();
        while ($this->n_operations > 0) {
            $word = trim(fgets(STDIN));
            if ($word[0] === 'i') {
                $this->operations->unshift(substr($word, 7));
            } elseif ($word[6] === 'F') {
                $this->operations->shift();
            } elseif ($word[6] === 'L') {
                $this->operations->pop();
            } else {
                foreach ($this->operations as $key => $element) {
                    if ($element === substr($word, 7)) {
                        $this->operations->offsetUnset($key);
                        break;
                    }
                }
            }
            $this->n_operations -= 1;
        }
    }

    public function getAnswer()
    {
        $str = array();
        // var_dump($this->operations);
        while (1) {
            if (count($this->operations) > 0) {
                $array[] = $this->operations->shift();
            } else {
                break;
            }
        }
        echo implode(' ', $array), PHP_EOL;

        // var_dump($array);
        // while (1) {
        //     try {
        //         $element = $this->operations->shift();
        //         $str[] = $element;
        //     } catch (Exception $e) {
        //         echo implode(' ', $str), PHP_EOL;
        //         break;
        //     }
        // }
    }
}

$answer = new Simulator();
$answer->getAnswer();



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


int a[1010];
int convert(int l,int r){
	int ret=0;
	for(int i=l;i<=r;++i) ret=10*ret+a[i];
	return ret;
}

set<int> s;

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

	for(int l=0;l<n;++l){
		for(int r=l;r<n;++r){
			if(r-l+1>=10) continue;
			s.insert(convert(l,r));
		}
	}

	int ans=0;
	while(s.find(ans)!=s.end()) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3388
N=int(input())
data=[]
for i in range(0,N):
  a,b=map(int,input().split())
  data.append([a,b])
  
#print(data)

dalta_data=[]
for i in range(0,N-1): #iは比較親
  Ai=data[i]
  for j in range(i+1,N): #jは比較子
    Aj=data[j]
    x=Ai[0]-Aj[0]
    y=Ai[1]-Aj[1]
    dalta_data.append([x,y])
    
#print(dalta_data)
    
M=len(dalta_data)
maxx=0
for i in range(0,M-1):
  max1=0
  for j in range(0,M):
    if dalta_data[i]==dalta_data[j] and i!=j:
      max1=max1+1
    else:
      di=dalta_data[i]
      dj=dalta_data[j]
      if di[0]==-dj[0] and di[1]==-dj[1]:
        max1=max1+1
  if max1>maxx:
    maxx=max1
  
if N==1:
  print(1)
else:
  print(N-maxx-1)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string s; cin >> s;

    rep(i,s.size()-8) {
        cout << s[i];
    }
    cout << endl;
}



Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
n = int(readline())
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def dot(a, b):
    return a.real * b.real + a.imag * b.imag
for _ in [0] * n:
    line_axis = tuple(map(int, readline().split()))
    p0, p1, p2, p3 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))
    if dot(p1 - p0, p3 - p2) == 0:
        print('1')
    elif cross(p1 - p0, p3 - p2) == 0:
        print('2')
    else:
        print('0')

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

signed main(){
  string A,S,C;
  cin>>A>>S>>C;
  char SS=toupper(S[0]);
  cout<<'A'<<SS<<'C'<<endl;
  return 0;
}

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

int main(){
    int N;
    int Alice=0;
    int Bob=0;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    for(int i=0;i<N;i++){
        if(i%2==0)Alice+=a.at(i);
        else Bob+=a.at(i);
    }
    cout<<Alice-Bob<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,sum,tot,a[200005],b[200005];
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; i++){
		scanf("%d",&a[i]);
	}
	for (int i=n; i>=1; i--){
		if (i*2>n){
			b[i]=a[i];
		} 
		else{
			sum=0;
			for (int j=2*i; j<=n; j+=i){
				sum=(sum+b[j])%2;
			}
			b[i]=sum^a[i];
		}
	}
	for (int i=1;i<=n;++i){
		tot+=b[i];
	} 
	printf("%d\n",tot);
	for (int i=1;i<=n;++i){
		if (b[i]){
			printf("%d ",i);
		} 
	}
	return 0;
}


Measured memory_bytes: 2432
a = []
for i in range(3):
    ai = list(map(int, input().split()))
    a += [ai]
bingo = [[False, False, False], [False, False, False], [False, False, False]]
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        if b in a[j]:
            bingo[j][a[j].index(b)] = True
            break
e = []
d = []
c = []
r = []
l = []
count = 0
for i in range(3):
    if not (False in bingo[i]):
        print("Yes")
        exit()
    e.append(bingo[i][0])
    d.append(bingo[i][1])
    c.append(bingo[i][2])
    r.append(bingo[i][count])
    l.append(bingo[i][2 - count])
    count += 1
if not (False in e):
    print("Yes")
    exit()
elif not (False in d):
    print("Yes")
    exit()
elif not (False in c):
    print("Yes")
    exit()
elif not (False in r):
    print("Yes")
    exit()
elif not (False in l):
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); //cinの高速化
  
  int A,B;
  cin >> A >> B;
  
  if(B%A == 0) OUT(B+A);
  else OUT(B-A);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;cin >> a>> b >> c;
	if(a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
}


Measured memory_bytes: 892
import sys

def main():
  if 'get_ipython' not in globals():  
    # For Subsession
    N = int(input())
    b = [int(i) for i in input().split()] 
  else:
    # b = [1,2,1]
    # b = [2,2]
    b = [1,1,1,2,2,1,2,3,2]
    N = len(b)

  ans = []
  while True:
    for i in range(N-1,-1,-1):
      if b[i] == i+1:
        ans.append(i+1)
        del b[i]
        N = N -1
        break
      if i == 0:
        print(-1)
        sys.exit()
    if N == 0:
      break

  for i in reversed(ans):
    print(i)
    
main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cstdlib>
using namespace std;


int L[100];

int main(){
	int N;
	int counts = 0;
	cin >> N;
	
	for(int i=0; i<N; i++) {
		cin >> L[i];
	}
	
	for(int i=0; i<N-2; i++) {
		for(int j=i+1; j<N-1; j++) {
			for(int k=j+1; k<N; k++) {
				if(L[i] != L[j] && L[j] != L[k] && L[i] != L[k]){
					if(L[i] > L[j] && L[i] > L[k]){ 
						if(L[i] < L[j] + L[k]) counts++;
					} else if(L[k] > L[j] && L[k] > L[i]){ 
						if(L[k] < L[j] + L[i]) counts++;
					} else {
						if(L[j] < L[i] + L[k]) counts++;
					}
				}
			}
		}
	}
	
	cout << counts;
	return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

MOD = 10**9 + 7

N, K = map(int, input().split())
adjL = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    adjL[a].append(b)
    adjL[b].append(a)

nums = [1] * N
def dfs(vNow, vPar):
    numCh = 0
    for v2 in adjL[vNow]:
        if v2 == vPar: continue
        dfs(v2, vNow)
        numCh += 1
    num = 1
    if vPar == -1:
        for i in range(K-numCh, K):
            num *= i
            num %= MOD
    else:
        for i in range(K-numCh-1, K-1):
            num *= i
            num %= MOD
    nums[vNow] = num

dfs(0, -1)

ans = K
for num in nums:
    ans *= num
    ans %= MOD

print(ans)


Measured memory_bytes: 88152
#include <bits/stdc++.h>
#define INF 1023456789
#define sacnf scanf
#define scnf scanf
#define scnaf scanf
#define CRLF <<'\n';
#define ALL(v) v.begin,v.end()
#define SIZE(v) (int)v.size()
#define PRPAIR(x) x.first << x.second
#define DEBUG(x) do { std::cerr <<(x)<<'\n'; } while (0)
#define rep(i,a,b) for(int i=(a);i!=(int)b-((a)>(b));(a)>(b)?--i:++i)
using namespace std;
typedef pair<int,int> ii;
typedef pair<int,ii> pip;
typedef vector<int> vi;
typedef long long ll;
#define MAXN 3005

ll grid[MAXN][MAXN];
ll memo[MAXN][MAXN][4];

int n,m,k;
ll dp(int x,int y,int num){
    if ((x == n && y == m-1)  || (y == m && x == n-1)){
        return 0;
    }
    if (x == n || y == m || x == -1 || y == -1)
        return -INF;
    if (memo[x][y][num] != -1)
        return memo[x][y][num];

    if (num == 3){
        return memo[x][y][num] = max(dp(x+1,y,0),dp(x,y+1,num));
    } else{
        return memo[x][y][num] = max(grid[x][y]+dp(x+1,y,0),max(grid[x][y]+dp(x,y+1,num+1),dp(x,y+1,num)));
    }

}

int main(){
    scanf("%d%d%d",&n,&m,&k);
    memset(grid,0,sizeof grid);
    rep(i,0,k){
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        a--,b--;
        grid[a][b] = c;
    }
    memset(memo,-1,sizeof memo);
    cout << dp(0,0,0);

}


Measured memory_bytes: 357160
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const ll LINF=1e18;
const int MOD=1e9+7;
//const int MOD=998244353;

int main(){
	int a,b,c; cin>>a>>b>>c;
	int x=min({a,b,c});
	int y=max({a,b,c});
	int z=a+b+c-x-y;
	cout<<x*z/2<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int m,d,cnt=0;
  scanf("%d%d",&m,&d);
  if(d<=21){
    printf("0");
    return 0;
  }
  for(int i=2;i<=m;i++){
    for(int j=22;j<=d;j++){
      if((j/10)*(j%10)==i&&j/10>1&&j%10>1){
        cnt++;
   //     printf("%d%d\n",i,j);
      }
    }
  }
  printf("%d",cnt);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  ll N, A, B; cin >> N >> A >> B;
  ll ans = N / (A + B) * A;
  N %= A + B;
  ans += min(A, N);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long x = sc.nextLong();
      long[] a = new long[n];
      for(int i = 0;i < n;i++)a[i]=sc.nextLong();
      long res = 0;
      for(int i = 0;i < n-1;i++){
      	if(a[i+1]+a[i]>x){
          res+=a[i+1]+a[i]-x;
       	  a[i+1] = Math.max(x-a[i],0);
        }
      }
      System.out.println(res);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}


Measured memory_bytes: 61020
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}
int main(){
    ll N,M;
    cin>>N>>M;

    cout<<N*(N-1)/2+M*(M-1)/2;
    return 0;
}

Measured memory_bytes: 256
//@author :  |< U $ |-|
#include<iostream>
#include<vector>
#include<math.h>
#define TakeInput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;



int main(){
    
    #ifndef ONLINE_JUDGE
    TakeInput
    #endif
    
    int i,j,k,n,m,c;
    cin>>n;
    m = ceil((float)n/1000);
    cout<<abs(1000*(m) - n);

}
 
 
 

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value,vector<ll> a)
{
	
	for (ll i = 0; i < a.size();i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}
ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}
//E869120 
void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
 string s;
 cin>>s;
 if(s[0]=='1')s[0]='9';
 else s[0]='1';
 if(s[1]=='1')s[1]='9';
 else s[1]='1';
 if(s[2]=='1')s[2]='9';
 else s[2]='1';
 cout<<s;

	return 0;
}













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

using namespace std;
#define int long long
#define double long double
#define all(a) a.begin(), a.end()

template <typename T1, typename T2> inline void chkmax(T1 & x, const T2 & y) {if (y > x) x = y;}
template <typename T1, typename T2> inline void chkmin(T1 & x, const T2 & y) {if (y < x) x = y;}

void read() {
	string s;
	cin >> s;
	int n = s.size();
	int posL = 0;
	int posR = 0;
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'L') {
			ans[posR + (i - posR) % 2]++; 
		}
		else {
			while (posL <= i || s[posL] != 'L')
				posL++;
			ans[posL - (posL - i) % 2]++;
			posR = i;
		}
	}
	for (auto i : ans)
		cout << i << " ";
	cout << endl;
}

void run() {

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 1488
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	//	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func solve(H, W int) int {
	res := math.MaxInt64 >> 4

	for i := 0; i < H; i++ {
		sel0 := i * W
		// 水平に３つ
		N := H - i
		n := N / 2
		sel1 := n * W
		sel2 := (N - n) * W
		d := max(sel0, max(sel1, sel2)) - min(sel0, min(sel1, sel2))
		if d < res {
			res = d
		}
		// 水平に１つ、垂直に２つ
		h := H - i
		w := W / 2
		sel1 = h * w
		sel2 = (W - w) * h
		d = max(sel0, max(sel1, sel2)) - min(sel0, min(sel1, sel2))
		if d < res {
			res = d
		}
	}
	return res
}

func main() {
	sc.Split(bufio.ScanWords)

	H, W := getInt(), getInt()

	res0 := solve(H, W)
	res1 := solve(W, H)
	fmt.Println(min(res0, res1))
}


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

int main(){
    int A,B;
    cin >> A >> B;
    double a,b;
    int answer;
    a = A / 0.08;
    b = B / 0.1;
    //単純な計算結果
    int a_dash,b_dash;
    if((a - (int)a) > 0){
        a_dash = (int)a +1;
    }else{
        a_dash = (int)a;
    }
    if((b - (int)b) > 0){
        b_dash = (int)b + 1;
    }else{
        b_dash = (int)b;
    }
    int a_dash_dash,b_dash_dash;
    a_dash_dash = (int)(a_dash * 0.1);//aをbに換算
    b_dash_dash = (int)(b_dash * 0.08);//bをaに換算
    if(a_dash == b_dash){
        answer = a_dash;
    }else if(a_dash > b_dash && a_dash_dash == B){
        answer = a_dash;
    }else if(b_dash > a_dash && b_dash_dash == A){
        answer = b_dash;
    }else{
        answer = -1;
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String[] wek = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
            String s = in.next();
            for (int i = 0; i < 7; i++) {
                if (s.equals(wek[i])) {
                    out.println(7 - i);
                }
            }
        }

    }
}



Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N, M;
  cin >> N >> M;
  if (N % 2 == 0)
  {
    for (i64 i = 1; i <= M; i++)
    {
      if (N / 2 < N + 1 - 2 * i)
        cout << i << " " << N - i + 1 << endl;
      else
        cout << i << " " << N - i << endl;
    }
  }
  else
    for (i64 i = 1; i <= M; i++)
      cout << i << " " << N - i + 1 << endl;

  return 0;
}


Measured memory_bytes: 3636
///
// File:  alds1_4_c.cpp
// Author: ymiyamoto
//
// Created on Sat Oct  7 19:25:59 2017
//

#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define SIZE 1046527

struct dict_key_t {
  int64_t key;

  dict_key_t(string str)
  {
    int64_t temp = 0;
    for (uint32_t i = 0; i < str.size(); i++) {
      if (str[i] == 'A') {
        temp += 0b001;
      } else if (str[i] == 'C') {
        temp += 0b010;
      } else if (str[i] == 'G') {
        temp += 0b011;
      } else {
        temp += 0b100;
      }
      temp <<= 3;
    }
    key = temp;
  }

  int64_t hash(int64_t i)
  {
    return (h1() + i * h2()) % SIZE;
  }

private:
  int64_t h1()
  {
    return key % SIZE;
  }

  int64_t h2()
  {
    return 1 + (key % (SIZE - 1));
  }
};

static vector<string> array(SIZE, "");

int32_t main()
{
  uint32_t n;
  cin >> n;

  for (uint32_t i = 0; i < n; i++) {
    string command, val;
    cin >> command >> val;
    if (command[0] == 'i') {
      dict_key_t key(val);
      for (int64_t i = 0;; i++) {
        int64_t hash = key.hash(i);
        if (array[hash] == "") {
          array[hash] = val;
          break;
        }
      }
    } else if (command[0] == 'f') {
      dict_key_t key(val);
      for (int64_t i = 0;; i++) {
        int64_t hash = key.hash(i);

        if (array[hash] == "" || i >= SIZE) {
          cout << "no" << endl;
          break;
        }

        if (array[hash] == val) {
          cout << "yes" << endl;
          break;
        }
      }
    }
  }

  return 0;
}

Measured memory_bytes: 41432
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int n,m;
    cin >> n >> m;
    vector<int>c(m);
    rep(i,m) cin >> c[i];
    int dp[51000];
    rep(i,51000) dp[i] = n;
    dp[0] = 0;
    for(int i = 0;i<n;i++) {
        for(int j = 0;j<m;j++) {
            if(i+c[j]>n) continue;
            dp[i+c[j]] = min(dp[i+c[j]],dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
    
    
}


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

vector<ll>prime_factorize(ll n){
    vector<ll>res;
    for(ll p = 2;p <= sqrt(n);p++){
      if (n%p != 0) continue;
      ll num = 0;
      while(n % p == 0){
        num++;
        n /= p;
      }
      res.push_back(num);
    }
    if (n != 1) res.push_back(1);
    return res;
}

int main() {
  ll n,ans = 0;
  cin >> n;
  vector<ll>data;
  data = prime_factorize(n);
  for(auto i : data){
    ll a = i,t = 1;
    while(true){
      if(a-t >= 0){
        a -= t;
        t++;
        ans++;
      }
      else break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3724
n, k = map(int, input().split())
k = min(n - 1, k)
h = list(map(int, input().split()))
cost = [0 for _ in range(n)]
for i, hi in enumerate(h):
    if i == 0: continue
    st = i - k if i > k else 0
    cost[i] = min([ck + abs(hi - hk) for ck, hk in zip(cost[st:i], h[st:i])])
print(cost[-1])


Measured memory_bytes: 13976
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,s,ans=0; cin>>n>>s;
    vector<ll> a(n,0);
    rep(i,n) cin>>a[i];
    vector<vector<ll>> dp(n+1,vector<ll>(3001,0));
    rep(i,n)rep(j,3001){
        dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
        if(j==0) dp[i+1][a[i]]=i+1;
        else{
            if(j+a[i]<=3000)
            dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
        }
        if(j+a[i]==s)
            ans=(ans+dp[i+1][j+a[i]]*(n-i))%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 73748
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long int n1,n2,cnt=1; cin>>n1>>n2;
	long long int n=__gcd(n1,n2); 
	for(int i=2;i<=sqrt(n);i++) {
		if(n%i==0) {
			cnt++;
			while(n%i==0) n/=i;
		}
	}
	
	if(n>1) cnt++;
	cout<<cnt<<endl;
	
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	var p float64
	for i := 1; i <= n; i++ {
		x := i
		q := 1.0 / float64(n)
		for x < k {
			q = q / 2.0
			x = x * 2
		}
		p += q
	}

	fmt.Println(p)
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define MAXN 100001
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {printf("0\n"); return 0;}
#define FAIL_1 {printf("-1\n"); return 0;}

int N;
vector<int> edges[MAXN];
LL dp[MAXN][2];
int B[MAXN][2];

void mul(LL &a, LL b) {
    a = (a*b) % MOD;
}

LL f(int u, int c, int p) {
    if (B[u][c]) return dp[u][c];
    B[u][c] = 1;

    LL &ret = dp[u][c] = 1;
    //int has_ch = 0;
    for (auto ch: edges[u]) { 
        if (ch != p) {
            LL cnt1 = f(ch, 0, u);
            LL cnt2 = (c == 0) ? f(ch, 1, u) : 0LL;
            mul(ret, cnt1+cnt2);
            //has_ch = 1;
        }
    }

    //printf("%d %d %lld\n", u, c, ret);

    return ret;
}

int main(int argc, char **argv)
{
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif

    scanf("%d", &N);
    for (int i = 0; i < N-1; i++) {
        int u,v;
        scanf("%d %d", &u, &v);
        u--;v--;

        edges[u].pb(v);
        edges[v].pb(u);
    }

    LL ans = (f(0,0,-1) + f(0,1,-1)) % MOD;
    //for (int i = 0; i < N; i++)
        //printf("%d %lld %lld\n", i+1, dp[i][0], dp[i][1]);
    //printf("\n");

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

    return 0;
}


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

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  ll a, b;
  cin >> a >> b;
  
  if(a <= 0 && b >= 0){
    cout << "Zero" << endl;
  }else if(a > 0){
    cout << "Positive" << endl;
  }else if(b < 0 && (b-a) % 2 == 1){
    cout << "Positive" << endl;
  }else{
    cout << "Negative" << endl;
  }
  
  return 0;
}


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

using namespace std;
typedef long long ll;

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

  ll L[N + 1];
  L[0] = 2;
  L[1] = 1;
  for (int i = 2; i <= N; i++) {
    L[i] = L[i - 2] + L[i -1];
  }
  cout << L[N] << endl;
  return 0;
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int n, k; cin >> n >> k;
  vector<ll> h(n); cin >> h;
  sort(whole(h)); reverse(whole(h));
  ll res = 0;
  for(int j = k; j < n; j++)res += h[j];
  cout << res << endl;
  return 0;
}


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

int main()
{
    setprecision(10);
    long long int n,k;
    cin>>n>>k;
    
    long long int arr[n],cnt=0;
    
    for(int i=0;i<n;i++)
    cin>>arr[i];
    
    for(int i=0;i<n;i++)
    {
        if(arr[i]>= k)
        cnt++;
    }
    
    cout<<cnt<<endl;
    return 0;
}

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

int a, b;
vector<vector<int> > d;

int saitan(vector<vector<pair<int, int> > > edges)
{
    vector<int> dist_tmp(202, 101);
    dist_tmp[0] = 0;

    for (int i=0; i<201; i++)
    {
        for (auto to : edges[i])
        {
            dist_tmp[to.first] = min(dist_tmp[to.first], dist_tmp[i] + to.second);
        }
    }
    return dist_tmp[201];
}

int main()
{
    cin >> a >> b;
    d = vector<vector<int> >(a, vector<int>(b, 0));

    for (int i=0; i<a; i++) for (int j=0; j<b; j++) cin >> d[i][j];

    vector<vector<int> > length(101, vector<int>(101, 0));
    for (int ii=0; ii<a; ii++)
        for (int jj=0; jj<b; jj++)
            for (int i=0; i<=100; i++)
                for (int j=0; j<=100; j++)
                    length[i][j] = max(length[i][j], d[ii][jj] - i * (ii+1) - j * (jj+1));

    vector<vector<pair<int, int> > > edge(201);
    for (int i=0; i<=100; i++)
    {
        for (int j=0; j<=100; j++)
        {
            edge[i].push_back(make_pair(201-j, length[i][j]));
        }
    }

    for (int x=1; x<=a; x++)
    {
        for (int y=1; y<=b; y++)
        {
            vector<vector<pair<int, int> > > edge_copy = edge;
            for (int i=0; i<100; i++)
            {
                edge_copy[i].push_back(make_pair(i+1, x));
                edge_copy[101+i].push_back(make_pair(i+102, y));
            }
            if (saitan(edge_copy) != d[x-1][y-1])
            {
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }
    cout << "Possible" << endl;

    cout << "202 10401" << endl;
    for (int i=1; i<=100; i++)
    {
        cout << i << " " << i+1 << " X" << endl;
        cout << i+101 << " " << i+102 << " Y" << endl;
    }
    for (int i=0; i<=100; i++)
    {
        for (int j=0; j<=100; j++)
        {
            cout << i+1 << " " << 202-j << " " << length[i][j] << endl;
        }
    }
    cout << "1 202" << endl;
    return 0;
}

Measured memory_bytes: 752
#include <stdio.h>
#include <string.h>

int main(){
  int a,b;
  scanf("%d%d", &a, &b);
  if (a <= b){
    for (int i = 0; i < b; i++){
      printf("%d", a);
    }
  }
  else{
    for (int i = 0; i < a; i++){
      printf("%d", b);
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

double dp[3005][3005];

int main()
{
    ll n;
    cin >> n;
    vector<double> p(n);
    rep(i,n){
        cin >> p[i];
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1.0-p[i-1]);
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++){
        ans+=dp[n][i];
    }
    cout << setprecision(10) << fixed;
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 68992
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;

ll extgcd(ll a, ll b, ll &x, ll &y){
    if(b == 0){
        x = 1; y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
    return d;
}

//* calculate a^-1 mod m
ll mod_inverse(ll a, ll m){
    ll x, y;
    extgcd(a, m, x, y);
    return(m + x%m) % m;
}
//* calculate C(n, 0), C(n, 1), ... C(n, n) mod p in O(n) 
vll mod_comb_list(ll n, ll p){
    vll res(n+1, 1);
    for(ll k=1; k <= n; k++){
        res[k] = (res[k-1] * (n - k + 1)) % p;
        res[k] = (res[k] * mod_inverse(k, p)) % p;
    }
    return res;
}

void solve(long long K, std::string S){
    ll N = S.length();
    vll pow26(K+1, 1); //* 26**i
    vll pow25(K+1, 1); //* 25**i
    vll comb(K+1, 1);
    REP(i, K){
        pow26[i+1] = (pow26[i]*26) % MOD;
        pow25[i+1] = (pow25[i]*25) % MOD;
    }
    REP(i, K){
        comb[i+1] = (comb[i] * (i + N)) % MOD;
        comb[i+1] = (comb[i+1] * mod_inverse(i+1, MOD)) % MOD;
    }
    ll ans = 0;
    REP(i, K+1){
        ll tmp = comb[i];
        tmp = (tmp * pow25[i]) % MOD;
        tmp = (tmp * pow26[K-i]) % MOD;
        ans = (ans + tmp) % MOD;
    }
    cout<<ans<<endl;
    

}
int main(){
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(K, S);
    return 0;
}


Measured memory_bytes: 28352
import collections
n=int(input())
cnt=[]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      a=x**2+y**2+z**2+x*y+y*z+z*x
      if a<=n:
        cnt.append(a)
c=collections.Counter(cnt)
for i in range(1,n+1):
  print(c[i])

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

int ps[10][10];

int main() {
	int n;
	cin>>n;
	vector<int> a(n);
	vector<int> b(n);
	for(int i = 0; i < n; i++) {
		int p;
		cin >> p;
		a[i] = p;
		b[i] = p;
	}
	sort(a.begin(),a.end());
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			int c = b[i];
			b[i] = b[j];
			b[j] = c;
			bool flg = true;
			for(int k = 0; k < n; k++) {
				flg &= (a[k]==b[k]);
			}
			if(flg) {
				cout << "YES" << endl;
				return 0;
			}
			c = b[i];
			b[i] = b[j];
			b[j] = c;
		}
	}
	bool flg = true;
	for(int k = 0; k < n; k++) {
		flg &= (a[k]==b[k]);
	}
	if(flg) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    string s,t,u="No";
    char f;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
    	f=s[0];
    	for(int j=0;j<s.size()-1;j++){
    		s[j]=s[j+1];
    	}
    	s[s.size()-1]=f;
    	if(s==t){
    		u="Yes";
    	}
    	
    }
   cout<<u<<endl;
    return 0;
}

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

#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, ii, n) for (int i = ii; i < n; i++)
#define FRO(i, ii, n) for (int i = ii; i > n; i--)
#define MP make_pair
#define PB push_back
#define INF (int) 1e9
#define MOD 1000000007 // 998244353
#define PI 3.141592653589793238462643383279502884197169399375105820974945
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef vector<string> VS;
typedef vector<VI> VII;

int main() {
	int n, inp;
	double prob[3005];
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	vector<vector<double>> dp (n+1, vector<double> (n+1));
	for (int i = 0; i < n; i++)
		cin >> prob[i];
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			int heads = j, tails = i - j;
			if (heads)
				dp[heads][tails] += dp[heads-1][tails] * prob[i-1];
			if (tails)
				dp[heads][tails] += dp[heads][tails-1] * (1 - prob[i-1]);
		}
	}

	double ret = 0;
	int heads = n, tails = 0;
	while (heads > tails) {
		ret += dp[heads][tails];
		heads--; tails++;
	}
	printf("%.10f", ret);
}

Measured memory_bytes: 70784
// https://atcoder.jp/contests/abc120/tasks/abc120_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

string S;
int cnt = 0, r = 0, l = 0;
char n;

int ss(int p)
{
  if (p == l)
    return r;

  if (cnt == 0)
  {
    n = S[p];
    cnt = 1;
  }
  else
  {
    if (n == S[p])
    {
      cnt++;
    }
    else
    {
      cnt--;
      r++;
    }
  }
  return ss(p + 1);
}

int main()
{
  cin >> S;
  l = S.length();

  cout << ss(0) * 2 << '\n';

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll K=1000000007;
ll gcd(ll a, ll b){
    ll c, d, e;
    while(b>0){
        d=a%b;
        e=a/b;
        c=b;
        b=d;
        a=c;
    }
    return a;
}

int main (){
    ll N;
    cin>>N;
    vector<ll> Vec(N);
    for(ll i=0; i<N; i++){
        cin>>Vec.at(i);
    }
    //解説のパクリ
    vector<ll> L(N), R(N);
    L.at(0)=Vec.at(0);
    R.at(0)=Vec.at(N-1);
    for(int i=0; i<N-1; i++){
        L.at(i+1)=gcd(L.at(i), Vec.at(i+1));
        R.at(i+1)=gcd(R.at(i), Vec.at(N-2-i));
    }
    ll Max=0;
    Max=max(L.at(N-2), R.at(N-2));
  	//cout<<L.at(N-2)<<endl;
  	//cout<<R.at(N-2)<<endl;
    for(int i=0; i<=N-3; i++){
        ll GCD=gcd(L.at(i), R.at(N-i-3));
      	//cout<<GCD<<endl;
        Max=max(Max, GCD);
    }
    cout<<Max<<endl;
}



Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define FOR(var,start,end) for(int var=start; var<end; var++)
#define REP(var,cnt) FOR(var,0,cnt)

int length[100010];

int main(void) {
	
	int datas;
	cin >> datas;
	REP(ddd, datas) {
		
		int N, K;
		cin >> N >> K;
		
		int prev = 0;
		REP(i, N) {
			int x;
			cin >> x;
			
			if ( i!=0 ) {
				length[i-1] = x - prev;
			}
			prev = x;
		}
		
		sort(length, length+N-1);
		reverse(length, length+N-1);
		
		int ret = 0;
		REP(i, N-1) {
			if ( i < K-1 ) { continue; }
			ret += length[i];
		}
		
		cout << ret << endl;
	}
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int n;
vector<int> a;
/**********************************************/

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    a.resize(n);
    REP(i, n) cin >> a[i];
    vector<int> aa = a;
    sort(all(aa));
    int ans1 = aa[n/2 -1], ans2 = aa[n/2];
    REP(i, n){
        if(ans1 >= a[i]){
            cout << ans2 << endl;
        }else{
            cout << ans1 << endl;
        }
    }

}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;


int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({a * c, a * d, b * c, b * d});
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> l(n);
  rep (i, n) cin >> l[i];
  sort(all(l));
  cout << (l.back() < accumulate(l.begin(), --l.end(), 0) ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256