akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,M;
	map<int,int> D;
	map<int,int> T;
	cin>>N;
	rep(i,N){int t; cin>>t; ++D[t];}
	cin>>M;
	rep(i,M){int t; cin>>t; ++T[t];}
	bool ans = true;
	for(auto x: T){
		if(x.second > D[x.first])ans = false;
	}
	cout<<((ans)?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 18944
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readM(T)(size_t r,size_t c,ref T[][]t){t=new T[][](r);foreach(ref v;t)readA(c,v);}

void main()
{
  int n, c; readV(n, c);
  int[][] d; readM(c, c, d);
  int[][] a; readM(n, n, a);

  foreach (i; 0..n) a[i][] -= 1;

  auto b = new int[][](3, c);
  foreach (i; 0..n)
    foreach (j; 0..n)
      ++b[(i+j)%3][a[i][j]];

  auto calc(int[] b, int t)
  {
    auto r = 0;
    foreach (i; 0..c) r += b[i]*d[i][t];
    return r;
  }

  auto r = 10^^9;
  foreach (c0; 0..c)
    foreach (c1; 0..c)
      foreach (c2; 0..c) {
        if (c0 == c1 || c0 == c2 || c1 == c2) continue;
        r = min(r, calc(b[0], c0)+calc(b[1], c1)+calc(b[2], c2));
      }

  writeln(r);
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


int main() {
  int n, k, q; cin >> n >> k >> q;
  Vll a(n+2);
  rep(i, n) cin >> a[i+1];


  auto f = [&] (ll z) {
    if (z < 0) return false;

    int res = 0;
    rep2(i, 1, n+1) {
      ll &y = a[i];
      ll x = y + z;

      V idx;
      rep(j, n+2) if (a[j] < y) idx.push_back(j);

      int now = 0;
      rep(j, idx.size()-1) {
        int cnt = 0;
        rep2(l, idx[j]+1, idx[j+1]) if (a[l] <= x) ++cnt;
        now += min(cnt, max(idx[j+1] - idx[j] - k, 0));
      }
      chmax(res, now);
    }
    return (res >= q);
  };

  ll ok = ll(1e9) + 5;
  ll ng = -1;
  while (llabs(ok - ng) > 1) {
    ll md = (ok + ng) / 2;
    if (f(md)) ok = md;
    else ng = md;
  }

  ll ans = ok;
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val n = sc.nextInt()
    println((n - 2) * 180)

  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}


Measured memory_bytes: 25656
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, k := io.NextInt(), io.NextInt()
	a := io.NextInts(n)
	ans := solve(k, a)
	io.Println(ans)
}

// O(n log n)
func solve(k int, a []int) (ans int) {
	sort.Slice(a, func(i, j int) bool { return Abs(a[i]) < Abs(a[j]) })
	pNums, nNums := []int{}, []int{}
	for i := len(a) - 1; i >= 0; i-- {
		if a[i] >= 0 {
			pNums = append(pNums, a[i])
		} else {
			nNums = append(nNums, a[i])
		}
	}

	ok := false
	if len(pNums) > 0 {
		if len(a) == k {
			ok = len(nNums)%2 == 0
		} else {
			ok = true
		}
	} else {
		ok = k%2 == 0
	}

	if !ok {
		ans = 1
		for i := 0; i < k; i++ {
			ans = ModMul(ans, (a[i]+mod)%mod, mod)
		}
		return ans
	}

	ans = 1
	if k%2 == 1 {
		ans = ModMul(ans, pNums[0], mod)
		pNums = pNums[1:]
	}
	nums := []int{}
	for len(pNums) >= 2 {
		nums = append(nums, pNums[0]*pNums[1])
		pNums = pNums[2:]
	}
	for len(nNums) >= 2 {
		nums = append(nums, nNums[0]*nNums[1])
		nNums = nNums[2:]
	}
	sort.Slice(nums, func(i, j int) bool { return nums[i] > nums[j] })
	for i := 0; i < k/2; i++ {
		ans = ModMul(ans, nums[i], mod)
	}
	return ans
}

const mod = 1e9 + 7

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// NextInts returns n integers from stdin
func (io *Io) NextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = io.NextInt()
	}
	return ret
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

// Abs retuns absolutevalue of input
func Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ModMul returns a*b with mod
func ModMul(a, b, mod int) int {
	a, b = a%mod, b%mod
	if b == 0 {
		return 0
	}
	if a*b/b == a {
		return a * b % mod
	}
	panic("overflow")
}


Measured memory_bytes: 23464
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 1010;
int A[maxn],cnt = 0,B[maxn],C[maxn],ans=0;
int solve(int x)
{
    memset(A,0,sizeof(A));
    cnt = 0;
    if(x != 0)
    while(x)
    {
       A[cnt++] = x%10;
       x/=10;
    }
    else{
        A[0] = 0;
        cnt++;
    }
    for(int i=0;i<cnt;i++){
        for(int j=0;j<ans;j++ ){
            if(A[i] == C[j])
                return 0;
        }

    }
    return 1;

}

int main()
{
    int n,sum;
    cin>>sum>>n;
    memset(B,0,sizeof(B));
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        B[temp] = 1;
    }
    ans = 0;
    for(int i=0;i<10;i++)
    {
        if(B[i]==1)
            C[ans++]=i;
    }
//    for(int i=0;i<ans;i++)
//        cout<<C[i]<<endl;

    for(int i=sum;i<100010;i++)
    {
        if(solve(i)){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


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

int main() {
  long long int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c &&a%2==0){
    cout<<-1<<endl;
    return 0;
  }
  
  long long int ans=0;
  for(int i=0;;i++){
    if(a%2==1 || b%2==1 || c%2==1)
      break;
    long long int x=a,y=b,z=c;
    a=(y+z)/2;
    b=(x+z)/2;
    c=(x+y)/2;
    ans++;
    
  }
  cout<<ans;
}

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

int main()
{
    string st;
    cin >> st;
    int Count = 0;
    for(int i = 0;i < 4; i++)
    {
        if(st[i] == '2')
        {
            Count++;
        }
    }
    cout << Count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
struct f{
	long long int x;
	long long int y;
	
}ff[100005];
bool cmp(f a,f b)
{
	return a.x<b.x;
}
int main()
{
	long long int a,b;
	long long int s=0;
	cin>>a>>b;
	for(long long int i =0;i<a;i++)
		cin>>ff[i].x>>ff[i].y;
	sort(ff,ff+a,cmp);
	for(long long int i =0;i<a;i++)
	{
		s+=ff[i].y;
		if(s>=b)
		{
			cout<<ff[i].x<<endl;
			break;
		}
	}
	return 0;
 } 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
vector<int>v[100003];
int color[100003];
int main(){
	queue<int>q;
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>a>>b;
		a--;b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	q.push(0);q.push(n-1);
	color[0]=1;color[n-1]=2;
	while(q.size()){
		for(int i=0;i<v[q.front()].size();i++)
			if(!color[v[q.front()][i]])
				color[v[q.front()][i]]=color[q.front()],
				q.push(v[q.front()][i]);
		q.pop();
	}
	a=0;b=0;
	for(int i=0;i<n;i++)
		if(color[i]==1)
			a++;
		else
			b++;
	if(a>b)
		cout<<"Fennec";
	else
		cout<<"Snuke";
}

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

int main(){
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size();++i){
		ans=(ans+(s[i]-'0'))%9;
	}
	if(ans)printf("No");
	else printf("Yes");
}

Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
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(void){
    ll q,h,s,d; cin>>q>>h>>s>>d;
    ll Q = 4*q, H = 2*h;
    ll n; cin>>n;
    ll ans1,  ans2, ans3;
    ll smallest = INF;
    chmin(smallest,Q); chmin(smallest,H); chmin(smallest,s);
    
    /// 2Lで頑張る
    int rest = n%2;
    if(rest) ans1 = (n/2)*d + smallest;
    else ans1 = (n/2)*d;
    //
    ans2 = n*smallest;
    if(ans1<ans2) cout<<ans1<<endl;
    else cout<<ans2<<endl;
}


Measured memory_bytes: 256
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1
n = int(input())
A = list(map(int, input().split()))
p = partition(A, 0, n - 1)
A[p] = f"[{A[p]}]"
print(*A)


Measured memory_bytes: 16396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

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

const int MAXA = 26;

int a[MAXA];

int main()
{
    int n, j, now;
    while(cin >> j && j)
    {
        REP(j) cin >> a[i];
        
        n = 32; now = 0;
        while(n)
        {
            n -= (n - 1) % 5;
            cout << n << endl;
            
            if(n - a[now] <= 0){cout << 0 << endl; break;}
            n -= a[now];
            cout << n << endl;
            now = (now + 1 ) % j;
        }

    }

    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[2333],b[2333];
long long ans=0x3f3f3f3f3f3f3f3fll,sum;
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i],b[i]=0x3f3f3f3f;
	for(int s=0;s<=n;s++)
	{
		sum=1ll*s*k;
		for(int i=1;i<=n;i++)
		{
			b[i]=min(b[i],a[(i-s+n-1)%n+1]);
			sum+=b[i];
		}
		ans=min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    vector<string>v(n);
    rep(i,n) cin >> v[i];
    char last;
    map<string,int>used;
    rep(i,n){
        if(i){
            if(last != v[i].front() or used[v[i]])return puts("No")*0;
        }
        last = v[i].back();
        used[v[i]]++;
    }
    cout << "Yes" << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

u64 n[1000];

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

    int N;
    cin >> N;
    u64 T, A;
    u64 prevT, prevA;

    rep (i, N)
    {
        cin >> T >> A;
        if (i == 0)
        {
            n[i] = 1;
        }
        else
        {
            n[i] = MAX(MAX(CEIL(n[i - 1] * prevA, A), CEIL(n[i - 1] * prevT, T)), CEIL(n[i - 1] * (prevT + prevA), T + A));
        }
        prevT = T; prevA = A;
    }

    cout << (T + A) * n[N - 1] << "\n";
    return 0;
}



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

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

int main() {
    int d; cin >> d;
    cout << "Christmas";
    for(int i=d; i<25; i++) cout << " Eve";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
typedef long long ll;
typedef long double ld;
#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;



int main(){
    ll A,B,K;
    cin >>A>>B>>K;
    A-=K;
    if(A<0){
        B+=A;
        A=0;
        if(B<0){
            B=0;
        }
    }
    cout<<A<<" "<<B<<endl;
  
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
        int A = stdIn.nextInt();
	int B = stdIn.nextInt();
	int C = stdIn.nextInt();
	int l =B/A;
	if(l>C){
	    l=C;
	}
	System.out.println(l);
    }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
typedef long long i64;

i64 result;
int N;
int cnt[30];
string str;

int main(int argc, char **argv)
{
	cin >> str ;
	for(const char & x : str)
		cnt[x - 'a']++, N++;

	result = 1LL * N * (N - 1) / 2 + 1;
	for(const int & x : cnt)
		if(x != 0)
			result -= 1LL * x * (x - 1) / 2;
	cout << result << endl ;
	return 0;
}



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

ll solve(ll a, string b) {
  ll bb = (b[0] - '0') * 100 + (b[2] - '0') * 10 + b[3] - '0';
  return (a * bb) / 100;
}

int main() {
  ll a;
  string b;
  cin >> a >> b;
  cout << solve(a, b);
}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int i=0;
  if(s[0] == '1'){
    i++;
  }
  if(s[1] == '1'){
    i++;
  }
  if(s[2] == '1'){
    i++;
  }
    
  cout << i <<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
 
typedef long long lld;
typedef vector<lld> vlld;
typedef pair<lld,lld> pi;
typedef tuple<lld,lld,lld> tup;
const lld mod=(lld)1e9+7;
 
 
int main() {

	
 lld n;
 cin>>n;
 vlld a(n);
 for(auto &i:a)
 	cin>>i;
 vlld b(n);
 b[0]=a[0];
 for(int i=1;i<n;i++)
 {
   b[i]= max(b[i-1],a[i]);
 }
   lld s=0;
 forn(i,n)
 {
    s+=abs(b[i]-a[i]);
 }
 cout<<s;
  
  return 0;
}

Measured memory_bytes: 6416
#include<bits/stdc++.h>
#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define sz size()
#define pb push_back
#define ve vector<int>
#define pii pair < int,int >
#define pll pair < ll,ll >
#define ll long long
#define Graph vector<vector < int > >
#define Fp cout << fixed <<  setprecision(9)
#define Fast  ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
const int M = 1e6+30 , N= 1e5+20 , MOD = 1e9+7 , OO = 1e7;
int m ,n ,k , x, y , dp[N] , bla ,c=1,cnt ,ans,sum , a[N] , ok=1 ;
pii p[N];
ve v;
set <ll> ss;
string s[N] ,t;
map < int , int > mp;
Graph G ;
int Dp(int i){

if(i>=n) return OO;
if(i == n-1) return 0;
if(dp[i]!=-1) return dp[i];
return dp[i] =  min(Dp(i+1) + abs(a[i+1]- a[i]) , Dp(i+2) + abs(a[i+2] - a[i]));



}

int main() {
memset(dp , -1);
cin >> n ;
for(int i=0;i<n;i++) cin >> a[i];
cout << Dp(0);
return 0;
}


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

int main()
{
  char s[101];
  cin >> s;
  int i;
  int no=0;
  for(i=0;i<100;++i){
    if(s[i]=='L'){
      ++no;
    }
    ++i;
    if(s[i]=='R'){
      ++no;
    }
  } 
  
  if(no==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
# D - Lucky PIN
N = int(input())
S = input()
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp = 0
            while tmp<N and int(S[tmp])!=i:
                tmp += 1
            if tmp==N:
                continue
            tmp += 1
            while tmp<N and int(S[tmp])!=j:
                tmp += 1
            if tmp==N:
                continue
            tmp += 1
            while tmp<N and int(S[tmp])!=k:
                tmp += 1
            if tmp==N:
                continue
            ans += 1            
print(ans)

Measured memory_bytes: 73572
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    int ans = 1e9;
    rep(S,(1<<n)){
        int cost = 0;
        vector<int> score(m, 0);
        rep(i,n){
            if(S>>i & 1){
                cost += c[i];
                rep(j,m){
                    score[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        rep(j,m){
            if(score[j] < x) ok = false;
        }
        if(ok) chmin(ans, cost);
    }
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  string s;
  cin >> s;
  int cnt=0;
  if (s.at(0) == 'o'){ cnt ++;}
  if (s.at(1) == 'o'){ cnt ++;}
  if (s.at(2) == 'o'){ cnt ++;}
  cout << 700 + 100*cnt << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d %d %d', $w, $h, $x, $y);

$s = (double)($w * $h / 2);
if ($x === $w / 2 && $y === $h / 2) echo $s.' '.(1).PHP_EOL;
else echo $s.' '.(0).PHP_EOL;

Measured memory_bytes: 4728
import Control.Applicative ((<$>))
import Control.Monad (replicateM, unless)
import Data.List (unfoldr)

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve <$> replicateM (n-1) (map read <$> words <$> getLine) >>= putStrLn
    main

solve :: [[Int]] -> String
solve xs = unwords . map show $ [maxx ls - minx ls + 1, maxy ls - miny ls + 1]
  where ls = (0,0) : unfoldr f xs
        f [] = Nothing
        f ([n, d]:rs) = Just (place (ls !! n) d, rs)

place (x, y) d | d == 0 = (x-1, y)
               | d == 1 = (x, y-1)
               | d == 2 = (x+1, y)
               | otherwise = (x, y+1)
                             
maxx = maximum . map fst
maxy = maximum . map snd
minx = minimum . map fst
miny = minimum . map snd



Measured memory_bytes: 5380
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 2000005;
const int MM = 1000000007;

ll cnt[30];
int main()
{
	string A;
	cin >> A;
	for(char c : A) cnt[c-'a']++;
	ll ans = (ll)A.size() * (A.size()-1) / 2;
	for(int i = 0; i < 26; i++) ans -= cnt[i] * (cnt[i]-1) / 2;
	printf("%lld\n", ans + 1);
}


Measured memory_bytes: 640
import java.io.*
import java.util.*
import kotlin.math.*

fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val n = f.readLine().toInt()
	val array = f.readLine().split(" ").map{it.toInt()}.toIntArray()

	var xor = 0
	for(k in 0 until n){
		xor = xor xor array[k]
	}

	val answer = IntArray(n)
	for(k in 0 until n){
		answer[k] = xor xor array[k]
	}

	println(answer.joinToString(" "))
}


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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

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




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


// 繰り返し二乗法
ll power(ll a, ll b){
  if(a==1)return a;
  // if(a==0)re
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);

  ll k, n; cin>>k>>n;
  vint a(n); rep(i,n) cin>>a[i];

  ll ans = k;
  sort(ALL(a));
  vint diff;
  rep(i, n-1){
    diff.push_back(a[i+1]-a[i]);
  }
  diff.push_back(a[0] + (k - a[n-1]));

  sort(ALL(diff));

  ans -= diff.back();
  cout<<ans<<endl;

}






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

# AtCoder Beginner Contest
# Problem C


# See:
# https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9
def get_prime_dict(number: int) -> dict:
    ''' number: 2 or greater.
    '''
    from collections import OrderedDict
    from math import sqrt

    prime_dict = OrderedDict()
    j = 2
    prime_dict[j] = 0
    number_list = [int(i) for i in range(2, number + 1)]

    while number_list[0] <= int(sqrt(number)):
        for i in number_list:
            if i % j == 0:
                number_list.remove(i)

        j = number_list[0]
        prime_dict[j] = 0

    for prime in number_list:
        prime_dict[prime] = 0

    return prime_dict


def execute_prime_factorization(primes: dict, number: int):
    for key in primes.keys():
        if number >= key:
            tmp = number

            while tmp >= key:
                if tmp % key == 0:
                    primes[key] += 1
                    tmp = int(tmp / key)
                else:
                    break
    return primes


if __name__ == '__main__':
    number = int(input())

    if number == 1:
        print(1)
        exit()

    primes = get_prime_dict(number)
    count = 1

    for i in range(2, number + 1):
        execute_prime_factorization(primes, i)

    for value in primes.values():
        count = ((value + 1) * count) % (10 ** 9 + 7)

    print(count)


Measured memory_bytes: 3444
"""
https://atcoder.jp/contests/abc144/tasks/abc144_b
"""
import numpy as np


def calc(N: int) -> bool:
    if N == 1:
        return True
    for i in range(2, 10):
        if N % i == 0 and N / i < 10:
            return True
    return False


def load_input_as_int_array() -> np.ndarray:
    return np.array([int(v) for v in input().split(" ")])


def main() -> None:
    N, = load_input_as_int_array()
    result = calc(N)
    print("Yes" if result else "No")


main()


Measured memory_bytes: 21448
import java.util.Scanner
import math._

object Main extends App{
	val sc=new Scanner(System.in)
	val a,b,h,m=sc.nextDouble
	val theta=abs((h*60+m)/(12*60)-m/60)*2*Pi
	val res=sqrt(a*a+b*b-2*a*b*cos(theta))
	println(res)
}

Measured memory_bytes: 55412
import java.util.Scanner;
import java.util.ArrayList;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        if(n == 100000) {
            System.out.println(9+900+90000);
        }else if(n >= 10000){
            System.out.println(909+(n-10000+1));
        }else if(n >= 1000) {
            System.out.println(909);
        }else if(n >= 100) {
            System.out.println(9+(n-100+1));
        }else if(n >= 10) {
            System.out.println(9);
        }else {
            System.out.println(n);
        }
    }

}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;

	cin >> s;

	if (s.size() == 2) {
		cout << s << endl;
	}
	else {
		cout << s[2] << s[1] << s[0] << endl;
	}

	return 0;
}




Measured memory_bytes: 256
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2019-12-16 13:11:10
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int A, P, ans;
    cin >> A >> P;

    P += 3*A;
    ans = P/2;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI (acos(-1))
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using Complex = std::complex<double>;
using namespace std;


int N;
int s[110];
bool dp[10010];


void makeDP(){
	dp[s[0]] = true;
	rep(i, 1, N)
		reper(j, 10000, 0)
			if(j == 0 || dp[j]) dp[j+s[i]] = true;
}


int solve(){
	int ans = 0;
	repe(i, 0, 10000)
		if(dp[i] && i%10 != 0) chmax(ans, i);
	return ans;
}


signed main(){
	cin >> N;
	rep(i, 0, N) cin >> s[i];

	makeDP();

	cout << solve() << endl;

	return 0;
}

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

using namespace std;

int main() {
    int n;

    cin >> n;

    vector<string> s(1);
    vector<int> q = {1};

    cin >> s.at(0);

    for (int i = 1; i < n; ++i) {
        string t;

        cin >> t;

        bool isExist = false;

        for (int j = 0; j < s.size(); ++j) {
            if (t == s.at(j))
                q.at(j)++, isExist = true;
        }

        // 存在しないとき
        if (!isExist) {
            s.push_back(t);

            q.push_back(1);
        }
    }

    int m;

    cin >> m;


    for (int j = 0; j < m; ++j) {

        string t;

        cin >> t;

        bool isExist = false;

        for (int k = 0; k < s.size(); ++k) {
            if (t == s.at(k))
                q.at(k)--, isExist = true;
        }

        // 存在しないとき
        if (!isExist) {
            s.push_back(t);

            q.push_back(1);
        }

    }

    int x = q.at(0);

    for (int k = 1; k < s.size(); ++k) {
        x = max(x, q.at(k));
    }

    if (x < 0)
        x = 0;

    cout << x << endl;

}


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

import io
import sys
import math

def solve():
    # implement process
    pass

def main():
    # input
    n, *a = open(0).read().split()
    
    # process
    s_list = list(a)
    ans = str( len( set(s_list)) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
5
grape
grape
grape
grape
grape
"""
_EXPECTED = """\
1
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 39296
// AOJ_C++.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include <iostream>

void Output(int i, int arr[][2]);

int main()
{
	
	int arr[3000][2];
	for (int i = 0; true; ++i) {
		int a, b;
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			Output(i, arr);
			break;
		}
		if (a < b) {
			arr[i][0] = a;
			arr[i][1] = b;
		}
		else {
			arr[i][0] = b;
			arr[i][1] = a;
		}
		
	}
    return 0;
}

void Output(int i, int arr[][2]) {
	for (int j = 0; j < i; ++j) {
		std::cout << arr[j][0] << " " << arr[j][1] << std::endl;
	}
}


Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(long long i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000
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(){
  ios::sync_with_stdio(false);
  
  int N;
  cin>>N;
  ll a[N];
  rep(i,N) cin>>a[i];  
  
  ll dp[N+1][N+1];
  dp[0][0]=0;
  
  rep(i,N){
    dp[i][i]=0;
  }
  
  for(int len=1;len<N+1;len++){
  	for(int i=0;i+len<N+1;i++){
      int j= len+i;
      
    	if((N-len)%2==0){
          
          dp[i][j] = max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1]);
          
          
        }else {
     		dp[i][j]= min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1]);
        }
    }
  }
  

  
  cout<<dp[0][N];
  
}

Measured memory_bytes: 70528
N,M = map(int,input().split())

memo = [list() for _ in range(N)]

for i in range(M):
  p,y = map(int,input().split())
  memo[p-1].append((y,i))

for l in memo:
  l.sort()

result = [None]*M

for p,l in enumerate(memo):
  for i,(_,orig) in enumerate(l):
    result[orig] = '%06d%06d' % (p+1,i+1)

for s in result:
  print(s)

Measured memory_bytes: 35944
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int N;
  cin >> N;
  int d[N];

  for (int i = 0; i < N; i++){
    cin >> d[i];
  }
  int total = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      // cout << total << " " << d[i] << " " << d[j] << endl;
      total += d[i] * d[j];
    }
  }
  
  cout << total << endl;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int W,H,x,y,r;
   cin >> W >> H >> x >> y >> r;
   if(((x-r)>=0 && (x+r)<=W) && ((y-r)>=0 && (y+r)<=H)){
       cout << "Yes";
   }else{
       cout << "No";
   }
   cout << endl;

}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=3;
    int a[n+1];
    for(int i=1; i<=n; i++) cin >> a[i];
    sort(a+1, a+n+1);
    int m=a[2];
    long long res=0;
    for(int i=1; i<=n; i++){
        res+=abs(a[i]-m);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll rpa[1000000];
ll lpa[1000000];

int main()
{
    bool flag=true;
    
        memset(rpa,0,sizeof rpa);
        memset(lpa,0,sizeof lpa);


        int a;
        cin>>a;
       

        vector<ll>v;
        vector<ll>ans;
        stack<ll>s;
        stack<ll>ss;
        ll b;
        for(ll i=0;i<a;i++)
        {
            cin>>b;
            v.pb(b);
        }
        //

        s.push(0);
        for(ll ii=1;ii<a;ii++)
        {
            ll x=s.top();
            if(v[ii]>=v[x])
            {

                s.push(ii);
            }
            else
            {
                while(!s.empty() && v[ii]<v[s.top()] )
                {
                    rpa[s.top()]=ii-s.top();
                    s.pop();
                }
                s.push(ii);
            }
        }
        if(!s.empty())
        {
            while(!s.empty())
                {
                     rpa[s.top()]=a-s.top();
                     s.pop();
                }

        }
      ss.push(0);
      //lpa[0]=0;
      for(ll j=1;j<a;j++)
      {
          ll x=ss.top();
          if(v[j]>v[ss.top()])
          {
              lpa[j]=0;
              ss.push(j);
          }
          else if(v[j]==v[ss.top()])
          {
              lpa[j]=lpa[ss.top()]+1;
              ss.pop();
              ss.push(j);
          }
          else
          {
              while(!ss.empty() && v[j]<v[ss.top()])
              {
                  ss.pop();
              }
              if(!ss.empty())
              {
                  lpa[j]=j-ss.top()-1;
                  ss.push(j);
              }
              else {
                lpa[j]=j;
                ss.push(j);
              }
          }
      }
      if(!ss.empty())
      {
          while(!ss.empty())
          {
               ss.pop();
          }

      }

        for(ll k=0;k<a;k++)
        {
            ll c=(lpa[k]+rpa[k])*v[k];
            ans.pb(c);
        }
      /*  for(int jj=0;jj<a;jj++)cout<<rpa[jj]<<" ";
        cout<<endl;
        for(int l=0;l<a;l++)cout<<lpa[l]<<" ";
        cout<<endl;*/
        cout<<*max_element(ans.begin(),ans.end())<<endl;
        v.clear();
        ans.clear();


    
}



Measured memory_bytes: 21340
#include <iostream>
#include <algorithm>

using namespace std;

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

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

  int num = partition(A, 0, n-1);

  for(int i = 0; i < n; i++){
    if(i > 0){ cout << " "; }
    if(i == num){ cout << "[" << A[i] << "]"; }
    else{ cout << A[i]; }
  }
  cout << endl;
  
  return 0;
}



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

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

using namespace std;
typedef int Weight;
Weight INF = 1000000000;
struct Edge{
  int src, dest; Weight weight;
  bool operator < (const Edge &rhs) const {return weight > rhs.weight;}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void add_edge(Graph &g, int src, int dest, Weight weight) {
  g[src].push_back((Edge){src, dest, weight});
}

// Dijkstra (Verified: AOJ2005)
void dijkstra(Graph &g, Array &d, int s) {
  d.assign(g.size(), INF);
  d[s] = 0;
  typedef pair<Weight,int> P;
  priority_queue<P, vector<P>, greater<P> > que;
  que.push(P(0, s));
  while (!que.empty()) {
    Weight dist = que.top().first;
    int v = que.top().second;
    que.pop();
    if (d[v] < dist) continue;
    REP(i, g[v].size()) {
      Edge e = g[v][i];
      if (d[e.dest] > d[v] + e.weight) {
        d[e.dest] = d[v] + e.weight;
        que.push(P(d[e.dest], e.dest));
      }
    }
  }
}

int main() {
  while(true) {
    int c,n,m,s,d;
    cin>>c>>n>>m>>s>>d;
    if(!c) break;
    --s;--d;
    Graph g(n*(c+1));
    REP(i,m) {
      int a,b,f;
      cin>>a>>b>>f;
      --a;--b;
      REP(j,c+1) {
        add_edge(g, j*n+a, j*n+b, f);
        add_edge(g, j*n+b, j*n+a, f);
      }
      REP(j,c) {
        add_edge(g, j*n+a, (j+1)*n+b, f/2);
        add_edge(g, j*n+b, (j+1)*n+a, f/2);
      }
    }
    REP(i,n) {
      REP(j,c) {
        add_edge(g, j*n+i, (j+1)*n+i, 0);
      }
    }
    Array ary;
    dijkstra(g, ary, s);
    cout<<ary[c*n+d]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1552
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void) {
	
	int N ;
	double x, okane =0;
	char u[3];
	scanf("%d", &N);

	
	
	for (int i = 0;i < N;i++) {
		scanf("%lf %s", &x, u);
		if (u[0] == 'J') okane += x;
		else okane += x * 380000;
		
	}

	printf("%lf", okane);
	
}

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

int main(){
    int k;
    cin>>k;
    queue<unsigned long long> que;
    for(long long i=1;i<10;++i) que.push(i);
    for(long long i=0;i<k-1;++i){
        long long x=que.front();
        que.pop();
        if(x%10!=0) que.push(10*x+x%10-1);
        que.push(10*x+x%10);
        if(x%10!=9) que.push(10*x+x%10+1);
    }

    cout<<que.front()<<endl;
}

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

int cnt(int n) {
    if (n <= 1) return 0;
    return n + cnt(n / 2) + cnt(n - n / 2);
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < n; ++i) {
        cout << v[i];
        if (i < n - 1)
            cout << " ";
    }
    cout << "\n";
    cout << cnt(n) << "\n";

    return 0;
}

Measured memory_bytes: 4580
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()

int main() {
    int n;
    scanf("%d", &n);
    vector<vector<int> > data(n);
    rep(i,n) {
        int m;
        scanf("%d", &m);
        rep(j,m) {
            int c;
            scanf("%d", &c);
            data.at(i).push_back(c);
        }
    }
    reverse(all(data));
    priority_queue<int> qu;
    intt ans = 0;
    rep(i,n) {
        for (auto x: data.at(i)) {
            qu.push(x);
        }
        ans += qu.top();
        qu.pop();
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 19080
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll a,b,sum;
    cin >> a >> b;
    if((b-1)%(a-1)==0)
        sum = (b-1)/(a-1);
        else
            sum = (b-1)/(a-1) +1;
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
typedef struct node
{
    double x,y;
}point;
point num[200];
double ask[200];
double dir[200];
int main(void)
{
    int n;
    scanf("%d",&n);
    for(int i = 0;i < n;i++)
    {
        scanf("%lf %lf",&num[i].x,&num[i].y);
    }
    for(int i = 0;i < n;i++)
    {   int cn = 0;
        for(int j = 0;j < n;j++)
        {
            if(i!=j)
            {
                dir[cn++] = atan2(num[i].y - num[j].y,num[i].x - num[j].x);
            }
        }
        sort(dir,dir+cn);
        ask[i] = max(2*pi + dir[0] - dir[cn-1] - pi,0.0);
        for(int j = 1;j < cn;j++)
            ask[i] = max(dir[j] - dir[j-1] - pi,ask[i]);
        ask[i]/=2*pi;
    }
    for(int i = 0;i < n;i++)
        printf("%.10f\n",ask[i]);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))

lisfnt = [0] * (max(v)+1)
lisbk = [0] * (max(v)+1)
for i in range(n):
    if i % 2 == 0:
        lisfnt[v[i]-1] += 1
    else:
        lisbk[v[i]-1] += 1

ans = sum(lisfnt) + sum(lisbk)
valfnt = 0
point = 0
for i in range(len(lisfnt)):
    if lisfnt[i] > valfnt:
        valfnt = lisfnt[i]
        point = i
valbk = 0
for i in range(len(lisbk)):
    if (lisbk[i] > valbk) and i != point:
        valbk = lisbk[i]
ans1 = ans - (valfnt + valbk)
valbk = 0
point = 0
for i in range(len(lisbk)):
    if lisbk[i] > valbk:
        valbk = lisbk[i]
        point = i
valfnt = 0
for i in range(len(lisfnt)):
    if (lisfnt[i] > valfnt) and i != point:
        valfnt = lisfnt[i]
ans2 = ans - (valfnt + valbk)

print(min(ans1,ans2))

Measured memory_bytes: 14204
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N,M;
string s,t;
map<int, char> ok;
ll ans;
int main() {
    cin>>N>>M>>s>>t;
    ll lcm = N*M/__gcd(N,M);
    ans = lcm;
    for(ll i=0;i<=lcm;i+=(lcm/N)){
        ok[i]=s[i/(lcm/N)];
    }
    //REP(i,0,lcm) p(ok[i]);
    for(ll i=0;i<=lcm;i+=(lcm/M)){
        if(ok.find(i)==ok.end()) continue;
        if(ok[i]==t[i/(lcm/M)]) continue;
        ans=-1;
    }
    p(ans);
    return 0;
}


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


int main(void) {
  int n;
  cin >> n;
  string s;
  cin >> s;

  int ans = 0;
  int l = 0;
  int r = n - 1;
  while (l < r) {
    while (l < n && s[l] == 'R') {
      l++;
    }
    if (l >= n) break;
    while (r >= 0 && s[r] == 'W') {
      r--;
    }
    if (r <= 0) break;
    if (l < r && s[l] == 'W' && s[r] == 'R') {
      ans++;
      l++;
      r--;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3752