akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define D 365
#define INF 1001001001
typedef long long ll;
ll calcSat(int *tmpt, int s[][26], int *c) {
	int last[26] = {0};
	ll tmpSat = 0;
	for (int i = 0; i < D; i++) {
		tmpSat += s[i][tmpt[i] - 1];
		last[tmpt[i] - 1] = i + 1;
		for (int j = 0; j < 26; j++) {
			tmpSat -= (c[j] * (i + 1 - last[j]));
		}
		/**
		printf("%lld\n", tmpSat);
		/**/
	}
	return tmpSat;
}
int main() {
	srand(628);
	scanf("%*d");
	int c[26], s[D][26];
	int t[D] = {0};
	ll bestSat = 0;
	for (int i = 0; i < 26; i++) {
		scanf("%d", &c[i]);
	}
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			scanf("%d", &s[i][j]);
		}
	}
	/**/
	int last[26] = {0};
	for (int i = 0; i < D; i++) {
		ll bestNowSat = -INF;
		int bestType = 0;
		for (int j = 0; j < 26; j++) {
			ll tmpSat = 0;
			tmpSat += s[i][j];
			for (int k = 0; k < 26; k++) {
				if (k != j) {
					tmpSat -= (c[k] * (i + 1 - last[k]));
				}
			}
			if (bestNowSat < tmpSat) {
				bestNowSat = tmpSat;
				bestType = j;
			}
		}
		bestSat += bestNowSat;
		t[i] = bestType + 1;
		last[bestType] = i + 1;
	}

	for (int cnt = 0; cnt < 200000; cnt++) {
		int tmpt[D];
		int pos = rand() % D;
		for (int i = 0; i < D; i++) {
			tmpt[i] = t[i];
		}
		tmpt[pos] = rand() % 26 + 1;
		ll tmpSat = calcSat(tmpt, s, c);
		if (tmpSat > bestSat) {
			bestSat = tmpSat;
			t[pos] = tmpt[pos];
		}
	}
	// printf("%lld\n", bestSat);

	for (int i = 0; i < D; i++) {
		printf("%d\n", t[i]);
	}
	return 0;
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define rep(i,n) for(int i=0; i<(n);++i)

int main(){
    string s,t;cin>>s>>t;
    int m=s.size(),n=t.size();
    vector<vector<int>> dp(m+1,vector<int>(n+1));
    rep(i,m)rep(j,n){
        if(s[i]==t[j]){
            dp[i+1][j+1]+=dp[i][j]+1;
        }else{
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
        }
    }
    int i=m;
    int j=n;
    string res="";
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            res=s[i-1]+res;
            i--;j--;
        }else if (dp[i][j]==dp[i-1][j])i--;
        else j--;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb push_back;
#define sp " ";
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    string s;
    cin>>s;
    bool c=true;
    map<char,int> ans;
    rep(i,4){
        if(ans.count(s.at(i))){
            ans.at(s.at(i))+=1;
        }
        else{
            ans[s.at(i)]=1;
        }
    }
    if(ans.size()!=2) c=false;
    for(auto v:ans){
        if(v.second!=2) c=false;
    }
cout<<(c?"Yes":"No")<<endl;

}

Measured memory_bytes: 256
N = input()
S = input()
count = 0

list_str = S
count_black = 0
count_white = S.count('.')
ans = count_black + count_white

for i in S:
    if i == '#':
        count_black += 1
    else:
        count_white -= 1

    if ans >= count_white + count_black:
        ans = count_black + count_white

# print(count_black)
# print(count_white)

print(ans)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, P; cin >> n >> P;
    string in; cin >> in;

    if(P == 2 or P == 5){
        ll res = 0LL;
        rep(i, n){
            int x = in[i] - '0';
            if(x % P == 0){
                res += i + 1;
            }
        }
        cout << res << endl;
        return 0;
    }

    vi S(n + 1);
    vi hist(P);
    int cur = 0;
    int mul = 1;
    rrep(i, n){
        int x = in[i] - '0';
        (cur += x * mul) %= P;
        S[i] = cur;
        mul = 10 * mul % P;
    }
    for(auto& e : S) hist[e]++;

    ll res = 0LL;
    for(auto& e : hist){
        res += 1LL * e * (e - 1) / 2;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1428
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)
	for i := 0; i < k; i++ {
		fmt.Print("ACL")
	}
	fmt.Println()
}

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

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1756
n=int(input())
B=[int(i) for i in input().split()]
Ans=[]
for i in range(n-1):
  N=[j+1 for j in range(n-i)]
  b=-1
  for k in range(n-i):
    if B[k]==N[k]:
      b=k
  if b==-1:
    break
  else:
    Ans.append(b+1)
    B=B[:b]+B[b+1:]
if B!=[1]:
  print(-1)
else:
  print(*([1]+Ans[::-1]),sep="\n")

Measured memory_bytes: 3064
//agc032_a.cpp
//Sat Aug  3 16:24:26 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

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

	int used[n];
	fill(used,used+n,0);
	int ans[n];
	fill(ans,ans+n,0);
	int flag = 0;
	int count = 0;
	int remain = n;
	while (remain>0){
		count = remain;
		flag = 1;
		for (int i=n-1;i>=0;i--){
			if (used[i]==1){
				continue;
			}
			if (count==b[i]){
				ans[remain-1]=count;
				flag = 0;
				used[i] = 1;
				break;
			}
			count--;
		}
		if (flag){
			cout << -1 << endl;
			return 0;
		}
		remain--;
	}

	for (int i=0;i<n;i++){	
		cout << ans[i] << endl;
	}
//	printf("%.4f\n",ans);
}

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

int main() {
    int A, B, M; cin >> A >> B >> M;
    vector<int> a(A), b(B);
    for(int i=0; i<A; ++i) cin >> a[i];
    for(int i=0; i<B; ++i) cin >> b[i];
    int res = *min_element(begin(a), end(a)) + *min_element(begin(b), end(b));

    while(M--) {
        int x,y,c; cin >> x >> y >> c;
        res = min(res, a[x - 1] + b[y - 1] - c);
    }

    cout << res << '\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;

int main() {
	int N,M,X,A,ans=0,c=0;
	bool masu[101]={};
	cin>>N>>M>>X;
	for(int i=0;i<M;i++)
	{
		cin>>A;
		masu[A]=true;
	}
	for(int i=X;i<N;i++)
	{
		if(masu[i])c++;
	}
	for(int i=X;i>0;i--)
	{
		if(masu[i])ans++;
	}
	cout<<min(ans,c);
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL //デバッグ出力系
#define dout(s) cout<<s<<"\n";
#define debug() if(true)
#else
#define dout(s)
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	int N, K;
	cin >> N >> K;
	K--;
	string S;
	cin >> S;
	switch (S.at(K)) {
	case 'A':
		S.at(K) = 'a';
		break;
	case 'B':
		S.at(K) = 'b';
		break;
	case 'C':
		S.at(K) = 'c';
		break;
	}
	cout << S << "\n";
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


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

int main(){
    int n;

    std::cin >> n;

    std::vector<int> a(n);
    for(int i = 0; i < n; i++){
        std::cin >> a.at(i);
    }
    int ans = 0;
    int tmp = 1;
    int size = a.size();
    for(int i = 0; i < a.size(); i++){
        if(a.at(i) != tmp){
            ans++;
        }else{
            tmp++;
        }
    }
    if(ans == size){
        ans = -1;
    }
    std::cout << ans << std::endl;

    return 0;
}


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


def solve(a: int, b: int):
    if a <= b:
        print(str(a)*b)
    else:
        print(str(b)*a)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline

class SegmentTree(object):
 
    def __init__(self, init_array, seg_func=min, seg_func_null=10 ** 9 + 7):
 
        self.seg_func = seg_func
        self.seg_func_null = seg_func_null
        self.n = 1
        while self.n < len(init_array):
            self.n *= 2
        self.dat = [0] * (2 * self.n - 1)
        for i in range(len(init_array)):
            self.dat[self.n - 1 + i] = init_array[i]
        for i in range(self.n - 2, -1, -1):
            self.dat[i] = self.seg_func(self.dat[2 * i + 1], self.dat[2 * i + 2])
 
    def update(self, k, a):
        k += self.n - 1
        self.dat[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.dat[k] = self.seg_func(self.dat[k * 2 + 1], self.dat[k * 2 + 2])
 
    def query(self, p, q):
        # [p, q)
        if q <= p:
            return self.seg_func_null
 
        p += self.n - 1
        q += self.n - 2
        res = self.seg_func_null
 
        while q - p > 1:
            if p & 1 == 0:
                res = self.seg_func(res, self.dat[p])
            if q & 1 == 1:
                res = self.seg_func(res, self.dat[q])
                q -= 1
            p = p // 2
            q = (q-1) // 2
        if p == q:
            res = self.seg_func(res, self.dat[p])
        else:
            res = self.seg_func(self.seg_func(res, self.dat[p]), self.dat[q])
 
        return res
 
N = int(input())
X = [0]*N
D = [0]*N
XD = [None]*N
for i in range(N):
    X, D = (int(i) for i in input().split())
    XD[i] = (X, D)
XD.sort()

import bisect
seg = SegmentTree(list(range(N)), max, -1)
L = list(range(N))

for i in range(N)[::-1]:
    x, d = XD[i]
    b = bisect.bisect_left(XD, (x+d-0.5, d))-1
    m = seg.query(i,b+1)
    seg.update(i,m)
    L[i] = m

ans = [0]*N
res = 1
for i in range(N)[::-1]:
    if L[i] == i:
        ans[i] = res
        res *= 2
    else:
        ans[i] = ans[L[i]]
        res += ans[i]
    res %= 998244353
print(res)

Measured memory_bytes: 83124
import Foundation

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

let n = Int(readLine()!)!
let m = readInt()
var c = 1
var c2 = 0
for i in m{
  if(c % 2 == 1 && i % 2 == 1){
    c2 += 1
  }
  c += 1
}
print(c2)

Measured memory_bytes: 13424
#include<stdio.h>
int main() {
	int A[100];
	int N, i, j, dum, ct=0;

	scanf("%d", &N);

	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	for(i=0;i<N;i++){
		for (j = N - 1; j > 0; j--) {
			if (A[j] < A[j - 1]) {
				dum = A[j - 1];
				A[j-1]=A[j];
				A[j]=dum;
				ct++;
			}
		}
	}
	for (i = 0; i < N-1; i++) {
		printf("%d ",A[i]);
	}
	printf("%d\n",A[N-1]);
	printf("%d\n", ct);
	return 0;
}


Measured memory_bytes: 2124
N = STDIN.gets.to_i
a = STDIN.gets.split(' ').map(&:to_i)

a = a.sort.reverse

alice = 0
bob = 0

a.each_with_index do |val, i|
  if i % 2 == 0
    alice += val
  else
    bob += val
  end
end

puts alice - bob


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

#define int long long
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define vint vector<int>
#define vchar vector<char>
#define vstr vector<string>
#define pb(n) push_back(n)

signed main(){
  int A,B,N,M,O,P,count=0,count2=0,count3=0,stack=0;
  str S,T;
  cin>>N>>M;
  bool card[N];rep(0,N)card[i]=false;
  vint L(M);
  vint R(M);
  rep(0,M)cin>>L[i]>>R[i];
  sort(all(L));
  sort(all(R));
  if(R[0]-L[M-1]>=0)cout<<R[0]-L[M-1]+1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int H;cin >> H;
  int N;cin >> N;
  int sum = 0;
  rep(i,N){
    int A;cin >> A;
    sum += A;
  }
  YesNo(sum>=H);
  return 0;
}


Measured memory_bytes: 384
s = gets.chomp.chars
t = gets.chomp.chars
s_hash = Hash.new(0)
t_hash = Hash.new(0)
s.each { |c| s_hash[c] += 1 }
t.each { |c| t_hash[c] += 1 }

if s_hash.values.sort == t_hash.values.sort
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 22780
n = [x for x in input()]
l=len(n)-1
for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if ((i>>j)&1):
            op[l-1-j]="+"
    formula=""
    for p,q in zip(n,op + [""]):
        formula+=(p+q)
    if eval(formula)==7:
        print(formula + "=7" )
        break

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  string s,t;cin>>s>>t;
  ll n=s.size(),m=t.size();
  ll dp[n+1][m+1];
  rep(i,0,n+1)CLR(dp[i],0);

  rep(i,0,n){
    rep(j,0,m){
      if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
      chmax(dp[i+1][j+1],dp[i+1][j]);
      chmax(dp[i+1][j+1],dp[i][j+1]);
    }
  }

  string ans="";
  ll i=n,j=m;
  while (i > 0 && j > 0){
    if (dp[i][j] == dp[i-1][j])i--;
    else if (dp[i][j] == dp[i][j-1])j--;
    else {
      ans = s[i-1] + ans;
      i--,j--;
    }
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 70656
from math import sqrt
def koch(d, p1, p2):
    if d == 0:
        return
     
    v = [p2[0] - p1[0], p2[1] - p1[1]]
    s = [p1[0] + v[0] / 3, p1[1] + v[1] / 3]
    t = [p1[0] + 2 * v[0] / 3, p1[1] + 2 * v[1] / 3]
    u = [p1[0] + v[0] / 2 - v[1] *sqrt(3) / 6, p1[1] + v[1] / 2 + v[0] *sqrt(3) / 6]
 
    koch(d - 1, p1, s)
    print(" ".join(map(str, s)))
    koch(d - 1, s, u)
    print(" ".join(map(str, u)))
    koch(d - 1, u, t)
    print(" ".join(map(str, t)))
    koch(d - 1, t, p2)
 
n = int(input())
print("0 0")
koch(n, [0, 0], [100, 0])
print("100 0")


Measured memory_bytes: 5716
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/





int main() {

	int n;
	cin >> n;
	vector<int> a(n);

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

	for (int i = 0; i < n;i++)
	{
		ans++;
		while (i + 1 < n && a[i] == a[i+1]) {
			i++;
		}

		if (i == n - 1) {
			break;
		}

		if (a[i] < a[i + 1]) {
			while (i + 1 < n && a[i] <= a[i+1]) {
				i++;
			}
		}
		else
		{
			while (i + 1 < n && a[i] >= a[i+1]) {
				i++;
			}
		}
	}


	cout << ans << endl;



	return 0;
}

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

int main(){
	int N,M,K;
	cin>>N>>M>>K;
	for(int i=0;i<=N;i++){
		for(int j=0;j<=M;j++){
			if(M * i + N * j - 2 * i * j == K){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
n=int(input())
k=0
t=n

while t>0:
  t //= 10
  k += 1

s=0
if k%2:
  s = n+1-10**(k-1)
  k -= 1

while k>0:
  if k%2:
    s += 9 * 10**(k-1)
  k -= 1

print(s)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,a;
    cin>>h>>a;
    int n[100010];
    int sum=0;
    for(int i=0;i<a;i++)
    {
    	cin>>n[i];
    	sum+=n[i];
	}
	cout<<((sum>=h)?"Yes":"No");
	return 0;
}

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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val % MOD + (val > 0 ? 0 : MOD)) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

Mint a[212345];
Int n, k;

int main(){
	cin >> n >> k;
	a[0] = 1;
	ARC(i, 1, n){
		Mint tmp = Mint(i) * Mint(i);
		a[i] = a[i - 1] * Mint(n - i + 1) * Mint(n - i) / tmp;
	}
	if(k > n) k = n;
	Mint sum = 0;
	RC(i, k + 1){
		sum += a[i];
	}
	cout << sum << endl;
}


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

int main()
{
    int a,b;
    char c;
    cin>>a>>b;
    string s1="",s2="";
    for(int i=0; i<a; i++)
    {
        c=b+'0';
        s1+=c;
    }
    for(int i=0; i<b; i++)
    {
        c=a+'0';
        s2+=c;

    }
    if(s1.size()>s2.size())
    {
        for(int i=0; i<s1.size(); i++)
        {
            if((s1[i]-'0')<(s2[i]-'0'))
            {
                cout<<s1;
                return 0;
            }
            else if((s1[i]-'0')>(s2[i]-'0'))
            {
                cout<<s2;
                return 0;
            }
        }
    }
    else
    {
        for(int i=0; i<s2.size(); i++)
        {
            if((s1[i]-'0')<(s2[i]-'0'))
            {
                cout<<s1;
                return 0;
            }
            else if((s1[i]-'0')>(s2[i]-'0'))
            {
                cout<<s2;
                return 0;
            }
        }
    }
    cout<<s1;
    return 0;
}

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        long kai = 0;
        long worst = -1;
        for (int i = 0; i < N; i++)
        {
            int a = cin.nextint;
            int b = cin.nextint;
            if (a > kai)
            {
                kai = a;
                worst = b;
            }
        }
        WriteLine(kai + worst);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 17336
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DLunlunNumber {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int K;
        cin >> K;

        vector<int> res;
        res.push_back(0);
        REP(i, K) {
            int j = 0;
            while (j + 1 < res.size() && (res[j] > res[j + 1] || res[j] == 9)) j++;
            if (j == res.size() - 1) {
                if (res[j] == 9) {
                    REP(k, res.size()) res[k] = 0;
                    res.push_back(1);
                } else {
                    int val = res[j] + 1;
                    while (j >= 0) {
                        res[j] = val >= 0 ? val : 0;
                        val--;
                        j--;
                    }
                }
            } else {
                int val = res[j] + 1;
                while (j >= 0) {
                    res[j] = val >= 0 ? val : 0;
                    val--;
                    j--;
                }
            }
        }
        reverse(res.begin(), res.end());
        for (auto n : res) cout << n;
        cout << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DLunlunNumber solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);
using namespace std;
int main(){
	fast;
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	int a,b,f[n+1];
	f[0]=0;
	for(int i=1;i<n;i++){
		f[i]=f[i-1];
		if(s[i]=='C'&&s[i-1]=='A')f[i]++;
	}
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		cout<<f[b-1]-f[a-1]<<endl;
	}
}

Measured memory_bytes: 1488
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def integer_factorization_perm(N):
    prime_count = collections.Counter()
    for n in range(1, N+1):
        for i in range(2, int(math.sqrt(n)) + 2):
            while n % i == 0:
                n //= i
                prime_count[i] += 1
        if n > 1:
            prime_count[n] += 1
    return prime_count

def main():
    N = I()
    primes = integer_factorization_perm(N)
    over74, over24, over14, over4, over2 = 0, 0, 0, 0, 0
    for k, v in primes.items():
        if v >= 74:
            over74 += 1
        if v >= 24:
            over24 += 1
        if v >= 14:
            over14 += 1
        if v >= 4:
            over4 += 1
        if v >= 2:
            over2 += 1
    cnt = 0
    '''
    print('74: ', over74)
    print('24: ', over24)
    print('14: ', over14)
    print('4: ', over4)
    print('2: ', over2)
    '''

    cnt += over74
    if over2 > 1:
        cnt += over24 * (over2 - 1)
    if over4 > 1:
        cnt += over14 * (over4 - 1)
    if over2 > 1 and over4 > 0:
        cnt += (over2 - 2) * over4 * (over4 - 1) // 2
    print(cnt)

main()


Measured memory_bytes: 5464
n = input()

A=list(map(int, input().split()))


ans = 0
while True:
    # print(A)
    if len(A)==1:
        break
    A.sort()

    c = 0
    for i in range(1, len(A)):
        # print(i)
        res = A[i]% A[0]
        if res == 0:
            c+=1
        A[i]=res
    for i in range(c):
        A.remove(0)

print(A[0])

Measured memory_bytes: 14252
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	int H,W;
	cin >> H >> W;
	string str;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> str;
			if (str == "snuke") {
				cout << (char)('A' + j) << i+1 << endl;
			}
		}
	}
	return 0;
}


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

int main() {
  int n;
  string s;
  int len;
  cin >> n >> s;
  len = s.size();
  for (size_t i = 0; i < len; i++) {
    s[i] += n;
    if (s[i] > 90) s[i] -= 26;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

bool solve(int n) {
  set<string> ss;
  string old, current;
  cin >> old;
  ss.insert(old);
  while (n--) {
    cin >> current;
    if (old.back() != current.front())
      return false;
    if (ss.find(current) != ss.end())
      return false;
    ss.insert(current);
    old = current;
    // cout << old << endl;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  if (solve(n - 1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]) = {
      val list = io.Source.stdin.getLines().map{_.toInt}.toList
      val N = list(0)
      val K = list(1)
      val X = list(2)
      val Y = list(3)

      val answer = if(N > K) K * X + (N-K) * Y else N * X

      println(answer)
  }
}


Measured memory_bytes: 21564
#include <stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    int a[n],b[n],c[n-1];
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=0;i<n;i++) scanf("%d",&b[i]);
    for(i=0;i<n-1;i++) scanf("%d",&c[i]);
    int sum = b[a[0]-1];
    for(i=1;i<n;i++){
        sum+=b[a[i]-1];
        if(a[i]-1==a[i-1]) sum+=c[a[i-1]-1];
    }
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] fruits = new int[n];
		for (int i = 0; i < n; i++) {
			fruits[i] = sc.nextInt();
		}
		Arrays.parallelSort(fruits);
		int sum = 0;
		for (int i = 0; i < k; i++) {
			sum += fruits[i];
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 38792
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key) {
    Node *cur = nil->next;
    while ( cur != nil && cur->key !=key ) {
        cur = cur->next;
    }
    return cur;
}

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;
    while ( 1 ) {
        if ( cur == nil ) break;
        if ( isf++ > 0 ) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t) {
    if ( t == nil ) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void insert(int key) {
    Node *node = (Node *)malloc(sizeof(Node));
    node->key = key;
    nil->next->prev = node;
    node->next = nil->next;
    node->prev = nil;
    nil->next = node;
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ) {
        scanf("%s%d", com, &key);
        if ( com[0] == 'i' ) { insert(key); np++; size++; }
        else if ( com[0] == 'd' ) {
            if ( strlen(com) > 6 ) {
                if ( com[6] == 'F' ) deleteFirst();
                else if ( com[6] == 'L' ) deleteLast();
            } else {
                deleteKey(key); nd++;
            }
            size--;
        }
    }
    
    printList();

    return 0;
}


Measured memory_bytes: 34004
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

signed main () {
	start_routine;
	#ifndef ONLINE_JUDGE
	// ("input.txt", "r", stdin);
	#endif

	int a[3];
	cin >> a[0] >> a[1] >> a[2];

	sort(a, a + 3);

	cout << a[2] - a[1] + a[1] - a[0] << endl;
	end_routine;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
int a;
string s;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>s;
	if(a>=3200)
		cout<<s<<endl;
	else
		cout<<"red"<<endl;
	return 0;
}


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();
        String[] str = new String[N];
        boolean test = true;
        
        for(int i=0; i<N; i++){
            str[i] = sc.next();
            //System.out.println(str[i]);
            if(i>0){
                //System.out.println(str[i]);
                if(str[i-1].charAt(str[i-1].length()-1)!=str[i].charAt(0)){
                    test = false;
                }
                for(int j=0; j<i; j++){
                    if(str[i].equals(str[j])){
                        test = false;
                    }
                }
            }
            if(!test){
                break;
            }
        }
        if(test){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

int main(){
  int n;
  int ans = 1000000000;
  cin >> n;
  for (int i=0; i<n; i++){
    int tmp, tmpans;
    cin >> tmp;
    tmpans = 0;
    while(tmp%2==0 && ans !=0){
      tmpans ++;
      tmp = tmp/2;
    }
    ans = min(ans,tmpans);
  }
  cout << ans << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

int grundy(int A, int K) {
	if (A % K == 0)return A / K;
	if (A < K)return 0;
	int X = (A / K) * K;
	int B = max((A - X) / (A / K + 1), 1);
	return grundy(A - (A / K + 1) * B, K);
}

int main() {
	int N, A, K;
	cin >> N;
	int gg = 0;
	for (int i = 0;i < N;i++) {
		cin >> A >> K;
		gg ^= grundy(A, K);
	}
	if (gg)cout << "Takahashi" << endl;
	else cout << "Aoki" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 

int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  string s,t;cin>>s>>t;
  string ans="No";
  rep(i,s.size()){
    if(s==t)ans="Yes";
    s=s.substr(s.size()-1,1)+s.substr(0,s.size()-1);
  }
  
  cout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

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

#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 = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vd = vector<double>;
void cxxio() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}
#define forn(i,n) for (int i=0; i<int(n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back

const double PI=acos(-1);

struct point {
    double x, y;
};

double angle(point p, point q) {
    return atan2(q.x-p.x, q.y-p.y)/(2.0*PI);
}

int main() {
    cxxio();
    int n;
    cin>>n;
    vector<point> ps(n);
    forn(i, n) cin>>ps[i].x>>ps[i].y;
    vd ans(n);
    forn(i, n) {
        vd rs;
        forn(j, n) if (i!=j) {
            rs.pb(angle(ps[i], ps[j]));
        }
        sort(all(rs));
        rs.pb(rs[0]+1.0);
        forn(j, rs.size()-1) {
            ans[i]+=max(0.0, rs[j+1]-rs[j]-0.5);
        }
    }
    cout<<fixed<<setprecision(8);
    for (double d:ans)
        cout<<d<<'\n';
}


Measured memory_bytes: 256
s = input()
t = input()

s_dict = {}
t_dict = {}
s_drdp = sorted(set(s), key=s.index)
t_drdp = sorted(set(t), key=t.index)
for i, ss in enumerate(s_drdp):
    s_dict[ss] = i
for i, tt in enumerate(t_drdp):
    t_dict[tt] = i

import numpy as np

def s2vec(d, d_dict):
    return d_dict[d]

vecf = np.vectorize(s2vec)
if list(vecf(list(s), s_dict)) == list(vecf(list(t), t_dict)):
    print('Yes')
else:
    print('No')

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int N, L; cin >> N >> L;
    vector<string> v(N); cin >> v;
    sort( ALL(v) );
    string ans = "";
    REP(i, N) ans += v[i];
    cout << ans << endl;
}


Measured memory_bytes: 256
li = input().split()
N = li[0]
A = li[1]
B = li[2]
N = int(N)
A = int(A)
B = int(B)
out = 0

for i in range(N+1):
    tmp = 0
    i_ori = i
    s = str(N)
    for j in range(len(s)):
        tmp += i%10
        i = i//10
    if (tmp <= B and tmp >= A):
        out += i_ori

print(out)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int x = sc.nextInt();
			int [] data = new int[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.nextInt();
			}
			Arrays.sort(data);
			int count = 0;
			for(int i = 0; i < n; i++){
				if(data[i] > x){
					break;
				}
				count++;
				x -= data[i];
			}
			if(x > 0 && count > 0 && count == n){
				count--;
			}
			System.out.println(count);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


Measured memory_bytes: 21972
import           Data.List

fs :: Double -> [Double]
fs a0 = concat $ iterate f [a0, a0 * 2]
  where f (_:an:_) = let an1 = an / 3
                         an2 = an1 * 2
                     in  [an1, an2]

s10 :: Double -> Double
s10 = sum . take 10 . fs

main :: IO ()
main = getContents >>= mapM_ (print . s10 . read) . lines

Measured memory_bytes: 4436
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 2e9
#define ALL(v) v.begin(), v.end()
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    int countr = 1;
    int countl = 0;
    int c;
    int ans[s.size()];
    for (int i = 0; i < s.size(); i++)
    {
        ans[i] = 0;
    }
    vector<p> count;
    for (int i = 1; i < s.size(); i++)
    {
        //cout << countr << " " << countl << "\n";
        if (s[i] == 'R' && s[i - 1] == 'R')
        {
            countr++;
        }
        else if (s[i] == 'L' && s[i - 1] == 'L')
        {
            countl++;
        }
        else if (s[i] == 'R' && s[i - 1] == 'L')
        {
            count.push_back(make_pair(countl, i));
            countl = 0;
            countr++;
        }
        else if (s[i] == 'L' && s[i - 1] == 'R')
        {
            count.push_back(make_pair(countr, i));
            countr = 0;
            countl++;
        }
        if (i == s.size() - 1)
        {
            count.push_back(make_pair(countl, i + 1));
        }
    }

    for (int i = 0; i < count.size(); i += 2)
    {
        int left = 0;
        int right = 0;
        if (count[i + 1].first % 2 == 1)
        {
            left += count[i + 1].first / 2 + 1;
            left += count[i].first / 2;
        }
        else
        {
            left += count[i + 1].first / 2;
            left += count[i].first / 2;
        }
        if (count[i].first % 2 == 1)
        {
            right += count[i].first / 2 + 1;
            right += count[i + 1].first / 2;
        }
        else
        {
            right += count[i].first / 2;
            right += count[i + 1].first / 2;
        }
        ans[count[i].second - 1] = right;
        ans[count[i].second] = left;
    }
    for (int i = 0; i < s.size(); i++)
    {
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 1864
#include <bits/stdc++.h>
#define ll  long long

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, "\e[31;1m"); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\e[0m")
#else
    #define eprintf(...) 42
#endif

std::string solve(std::string S)
{
    std::vector<std::string> P(4);
    P[0] = "dreamer";
    P[1] = "dream";
    P[2] = "eraser";
    P[3] = "erase";

    while (0 < S.length())
    {
        std::string T = S;
        for (auto itr = P.begin(); itr != P.end(); ++itr)
        {
            if (S.length() < itr->length())
            {
                continue;
            }
            if (S.substr(S.length() - itr->length()) == *itr)
            {
                S = S.substr(0, S.length() - itr->length());
                break;
            }
        }
        if (T == S)
        {
            break;
        }
    }

    if (0 == S.length())
    {
        return "YES";
    }
    return "NO";
}

int main(void)
{
    std::string S;
    std::cin >> S;
    std::cout << solve(S) << std::endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9
const ll MOD = 1000000007;

int main(){
    ll n; cin >> n;
    if(n == 0) {cout << 0 << endl; return 0;}
    if(n == 1) {cout << 1 << endl; return 0;}
    vector<int> ans;
    while(n != 0){
        if(n % 2 != 0) {
            ans.pb(1);
            n -= 1;
        }
        else ans.pb(0);
        n /= (-2);
    }
    for(int i = ans.size()-1; i >= 0; i--) cout << ans[i];    
}

Measured memory_bytes: 256