akhauriyash/Code-Regression huggingface dataset:
import sys
input = lambda: sys.stdin.readline().rstrip()
NN = 19
BIT = [0] * (2 ** NN + 1)

def addbit(i, x=1):
    i += 1
    while i <= 2**NN:
        BIT[i] += x
        i += i & (-i)

def getsum(i):
    ret = 0
    while i != 0:
        ret += BIT[i]
        i -= i&(-i)
    return ret

N, Q = map(int, input().split())
A = [int(a) for a in input().split()]
for i, a in enumerate(A):
    addbit(i, a)

for _ in range(Q):
    a, b, c = map(int, input().split())
    if a == 0:
        addbit(b, c)
    else:
        print(getsum(c) - getsum(b))



Measured memory_bytes: 132192
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

const int MAX_N = 200100;
const int MAX_Q = 200100;
struct UnionFind
{
  int par[MAX_N];	//親
  int height[MAX_N];	//木の深さ
  int size[MAX_N];	//子の数

	//n要素で初期化
  void init (int n)
  {
    for (int i = 0; i < n; i++)
    {
      par[i] = i;
      height[i] = 0;
      size[i] = 1;
    }
  }

	//木の根を求める
  int find (int x)
  {
    if (par[x] == x)
    {
      return x;
    }
    else
    {
      return par[x] = find(par[x]);
    }
  }

	//xとyの属する集合を併合
  void unite (int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
    {
      return;
    }

    if (height[x] < height[y])
    {
      par[x] = y;
      size[y] = size[x] + size[y];
    }
    else
    {
      par[y] = x;
      size[x] = size[x] + size[y];
      if (height[x] == height[y])
      {
        height[x]++;
      }
    }
  }

	//xとyが同じ集合に属するか否か
  bool same (int x, int y)
  {
    return find(x) == find(y);
  }
};

int main()
{
  int ans = 0;
  int n, m;
  cin >> n >> m;
  UnionFind uf;
  uf.init(n);
  int x[100100], y[100100], z[100100];
  for (int i = 0; i < m; i++)
  {
    cin >> x[i] >> y[i] >> z[i];
    x[i]--;
    y[i]--;

    if (!uf.same(x[i], y[i]))
    {
      ans++;
    }
    uf.unite(x[i], y[i]);
  }
  cout << n - ans << "\n";
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0007
{
    class Program
    {
        static void Main(string[] args)
        {
            double rates = 1.05;
            double currentDept = 100000;
            double n = double.Parse(Console.ReadLine());
            for (double i = 0; i < n; ++i)
            {
                currentDept = currentDept * rates;
                double db = System.Math.Pow(10, -3);
                currentDept = System.Math.Ceiling(currentDept * db) / db;
            }
           
            Console.WriteLine(currentDept);
        }
    }
}



Measured memory_bytes: 13896
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
int main() {
	ll n, m;
	cin >> n >> m;
	vl a(m);
	vl b(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
	}
	vl ans(n, 0);
	ans[0] = 1;
	for (int i = 0; i < m; i++) {
		ans[a[i]-1] = b[i];
	}
	bool falg = true;
	for (int i = 0; i < m; i++) {
		if (ans[a[i]-1] == b[i]) {

		}
		else {
			falg = false;
		}
	}
	if (n >= 2) {
		if (ans[0] == 0) {
			falg = false;
		}
	}
	if (n == 1 && m == 0) {
		cout << 0 << endl;
	}
	else {
		if (falg) {
			for (int i = 0; i < n; i++) {
				cout << ans[i];
			}
		}
		else {
			cout << -1 << endl;
		}
	}
}

Measured memory_bytes: 3616
#和風いろはちゃんイージー
def ABC_42_A():
    A,B,C = map(int, input().split())
    iroha = [0 for i in range(3)]
    iroha = []
    iroha.append(A)
    iroha.append(B)
    iroha.append(C)

    if iroha.count(7)==1 and iroha.count(5)==2:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':

    ABC_42_A()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include<cstdlib>
#define ll long long
using namespace std;

const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;
const ll MAX = 500010;

#define lowbit(x) x&(-x)

ll tree[30][MAX];
char str[MAX];
char s[MAX];

void update(ll x, ll val, ll y)
{
    while(x <= MAX)
    {
        tree[y][x] += val;

        x += lowbit(x);
    }
}

ll query_sum(ll x, ll y)
{
    ll res=0;
    while(x)
    {
        res += tree[y][x];
        x -= lowbit(x);
    }

    return res;
}

int main (void)
{
    //int T;
    //cin>>T;
    //while(T--)
    {
        int len,n;
        scanf("%d%s%d",&len, str+1, &n);

        //cout<<str+1<<endl;

        for(int i=1; i<=len; i++)
        {
            update(i, 1, str[i]-'a');
            s[i] = str[i];
        }

        //cout<<s+1<<endl;

        while (n--)
        {
            ll z,x,y,val;
            char c;

            cin>>z;
            if(z == 1)
            {
                cin>>x>>c;

                update(x, -1, s[x]-'a');
                update(x, 1, c-'a');
                s[x] = c;
            }
            
            //cout<<s+1<<endl;

            if(z == 2)
            {
                cin>>x>>y;

                int cnt = 0;

                for(int i=0; i<26; i++)
                {
                    if(query_sum(y, i) - query_sum(x-1, i) > 0)
                    cnt++;
                }

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

Measured memory_bytes: 103680
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define int long long
#define ggr getchar();getchar();return 0;
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int a[114514];
signed main() {
	int n, cnt, ans = 0;
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	if (n == 1 && a[0] != 1)cout << 1 << endl;
	else {
		for (int i = 0; i < n; i++) {
			if (a[i - 1] != a[i] || i == 0) {
				cnt = upper_bound(a, a + n, a[i]) - lower_bound(a, a + n, a[i]);
				if (cnt < a[i])ans += cnt;
				else ans += cnt - a[i];
			}
		}
		cout << ans << endl;
	}
	ggr
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define tmp(x) std::cout<<"& "<<(x)<<" &\n"
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
typedef long long ll;

using namespace std;
const int maxn=2e5+100;
int n,t;
int a[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
  	cin>>n;
  	ll ans=0;
  	rep(i,1,n){
  		cin>>a[i];
  		if(a[i]<a[i-1]){
  			ans+=a[i-1]-a[i];a[i]=a[i-1];
		  }
  		
	  }
	  cout<<ans;
	
  	


    return 0;
}


Measured memory_bytes: 4388
#include<iostream>
using namespace std;
int main(){
  int N,K,Q,l;
  cin >> N;
  cin >> K;
  cin >> Q;
  int B[N],i=0;
  for(i=0;i<N+1;i++){
    B[i]=0;
  }
  for(i=0;i<Q;i++){
    cin>>l;
    B[l]++;
  }
  int Ans;
  for(i=1;i<N+1;i++){
    Ans=K-(Q-B[i]);
    if(Ans>0){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 1024
accept = input()
first = int(accept[0] + accept[1])
end = int(accept[2] + accept[3])
if first > 12 and end > 12:
    print("NA")
elif first == 0 and end == 0:
    print("NA")
elif first == 0 or first > 12:
    if end == 0:
        print("NA")
    else:
        print("YYMM")
elif end == 0 or end > 12:
    if first == 0:
        print("NA")
    else:
        print("MMYY")
else:
    print("AMBIGUOUS")

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int v[200000];
int u[1000001];


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

    for (int i = 0; i < 1000001; ++i)
    {
        u[i] = 0;
    }

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

    if (u[1] == 1)
    {
        cout << "1\n";
        return 0;
    }

    if (u[1] > 1)
    {
        cout << "0\n";
        return 0;
    }

    for (int gap = n/2; gap > 0; gap /= 2)
    {
        for (int i = gap; i < n; ++i)
        {
            for (int j = i - gap; j >= 0 && v[j] > v[j + gap]; j -= gap)
            {
                swap(v[j], v[j+gap]);
            }
        }
    }

    int ans = 0;

    for (int i = 0; i < n; ++i)
    {
        if (u[v[i]] == 0) {continue;}

        if (u[v[i]] == 1)
        {
            ans++;
        }

        for (int j = v[i]*2; j < 1000001; j += v[i])
        {
            u[j] = 0;
        }

        if (u[v[i]] > 1)
        {
            i += u[v[i]]-1;
        }
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8316
#include <bits/stdc++.h>
using namespace std;
const int maxn = 501;
int n, used[maxn][maxn], seen[maxn], dep[maxn], cs = 1;
void dfs(int u){
	seen[u] = 1;
	for(int v = 0; v < n; v++){
		if(used[u][v] || used[v][u]) continue;
		if(seen[v]){
			if((dep[u]&1) != (dep[v]&1)){
				used[u][v] = cs;
				used[v][u] = cs;
			}
		} else {
			dep[v] = dep[u] + 1;
			used[u][v] = cs;
			used[v][u] = cs;
			dfs(v);
		}
	}
}
int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		memset(seen, 0, sizeof(seen));
		memset(dep, 0, sizeof(dep));
		for(int j = 0; j < n; j++){
			if(!seen[j]){
				dfs(j);
			}
		}
		cs++;
	}
	for(int i = 0; i < n - 1; i++){
		for(int j = i + 1; j < n; j++){
			cout << used[i][j] << " ";	
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 1536
#ABC 049 C
S = input()
T = ''
S = S[::-1]
words = ["dream","dreamer","erase","eraser"]
rev_words = [w[::-1] for w in words]

flag = False
i=0
while(1):
	for w in rev_words:
		s = S[i:i+len(w)]
		if s == w:
			flag = True
			T += w
			i += len(w)
			break
	if T == S:
		ans = "YES"
		break
	if flag == False:
		ans = 'NO'
		break
	flag = False

print(ans)


Measured memory_bytes: 3316
s = input()

def solve(s, i, bind, ans):
    if i == len(s) - 1:
        return ans + int(bind)
    return solve(s, i+1, s[i+1], int(bind) + ans) + solve(s, i+1, bind + s[i+1], ans)

print(solve(s, 0, s[0], 0))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(i>=k+1)
		{
			if(a[i]>a[i-k])puts("Yes");
			else puts("No");
		}
	}
	return 0;
}


Measured memory_bytes: 4440
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
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);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, a;
    cin >> x >> a;
    if(x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;

signed main() {
	int H, W;
	cin >> H >> W;
	vector<string>C(H);
	rep(i, H)cin >> C[i];
	rep(i, H) {
		rep(k, 2) {
			rep(j, W)cout << C[i][j];
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
function main (input) {
    const N = input.split('\n')[0];
    var a = input.split('\n')[1].split(' ')
                 .map(function(e){return Number(e);})
                 .sort(function(a,b){return a-b;});

    ans = a[N-1] - a[0];
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        k: usize,
        q: usize,
        v: [usize1; q]
    }
    let mut p = vec![k; n];
    for &i in &v {
        p[i] += 1;
    }
    for i in 0..n {
        if p[i] > q {
            println!("Yes");
        } else {
            println!("No", );
        }
    }
}


Measured memory_bytes: 6780
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? (-(a)) : (a))

typedef long long ll;

using namespace std;

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

	string input;

	cin >> input;

	if (input == "hi" || input == "hihi" || input == "hihihi" || input == "hihihihi" || input == "hihihihihi") printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0].split("");
    
    if(S[2] === S[3] && S[4] === S[5]) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21192
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  string N;
  cin >> N;
  cout << "ABC" + N << endl;
  return 0;
}


Measured memory_bytes: 256
#encoding:utf-8 No.0167 2014.10.15
def bubble_sort_count ary
  sorted = []
  count = 0
  until ary.length == 0
    i = 0
    while i < ary.length - 1
      if ary[i] > ary[i+1]
        ary[i],ary[i+1] = ary[i+1],ary[i]
        count += 1
        i += 1
      else
        i += 1
      end
    end
    sorted.unshift ary.pop
  end
  return count
end

until (n = gets.chomp.to_i) == 0
  numbers = Array.new(n)
  n.times do |i|
    numbers[i] = gets.chomp.to_i
  end
  puts bubble_sort_count numbers
end

Measured memory_bytes: 6108
#include <bits/stdc++.h>
#define REP(i, n, s) for (LL i = (s); i < (n); i++)
#define SIZE 1
using namespace std;
typedef long long int LL;
typedef long double LD;

string S;

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

	cin >> S;
	regex r("(dream|dreamer|erase|eraser)+$");
	smatch match;
	if (regex_match(S, match, r)) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 39888
#coding: UTF-8

cnt = 0

def SelectionSort(A,N,G):
    global cnt
    for i in range(G,N):
        v = A[i]
        j = i - G
        while j >= 0 and A[j] > v:
            A[j + G] = A[j]
            j = j - G
            cnt += 1
        A[j + G] = v
        

def ShellSort(A,N):
    G = [None] * 20
    cnt = 0
    
    for i in range(1,21):
        G[i - 1] = int(((3 ** i) - 1) / 2)
    for i in range(1,21):
        if N < G[i - 1]:
            m = i - 2
            break
    for i in range(m,-1,-1):
        SelectionSort(A,N,G[i])
    
    print(str(m+1))
    for i in range(m,0,- 1):
        print(str(G[i]) + " ", end = "")
    print(G[0])


N = int(input())
A = [None] * N
for i in range(N):
    A[i] = int(input())


ShellSort(A,N)

print(cnt)
for i in range(N):
    print(A[i])

Measured memory_bytes: 47620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N;
  cin >> N;
  ll a[N];
  rep(i,N) cin >>a[i];
  ll pd=a[0];
  for(int i=2;i<=N-1;i++){
    pd ^=a[i];
  }
  if(a[1] == pd){
    cout << "Yes" << endl;   
  }
  else{
    cout << "No" <<endl;
  }
    
  return 0;
    

}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
using namespace std;

int main(){
  int q; cin>>q;
  set<int>s;
  while(q--){
    int x,y;
    cin>>x>>y;
    if(x)cout<<s.count(y)<<endl;
    else{
      s.insert(y);
      cout<<s.size()<<endl;
    }
  }
}


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

int main(){
    int a; // たて 
    int b; // よこ

    int area; // 面積
    int circumference; // 円周

    cin >> a >> b;
    
    area = a * b;
    circumference = (a + b) * 2;

    cout << area << " " << circumference << endl;

    return 0;
}


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


def solve(N: int, S: "List[str]"):
    s = set()

    for i in S:
        s.add(i)
    
    print(len(s))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


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

int main() {
  int A, B, C, D, calc;

  cin >> A >> B >> C >> D;

  calc = (A + B) - (C + D);

  if (calc < 0) {
    cout << "Right" << endl;
  } else if (calc == 0) {
    cout << "Balanced" << endl;
  } else {
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 256
using System;
public class Program{
    public static void Main(){
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        if(a%2==0 || b%2==0){
            Console.WriteLine("No");
        }else{
            Console.WriteLine("Yes");
        }
        
    }
}

Measured memory_bytes: 11092
#include<iostream>
using namespace std;
#include<stdio.h>
#include<string>

typedef struct fox{ int val; fox *parent, *left, *right; } fox_n;

fox_n* init()
{
    fox_n* root = new fox_n;
    root->val = -1;
    root->parent = NULL;
    root->left = NULL;
    root->right = NULL;
    return root;
}

void insert(fox_n* root, int key)
{
    static bool first = true;
    static bool add_leaf = true;  // true:left, false:right.
    if(first){ first = false; root->val = key; return; }  // initialize.
    fox_n* canis;
    fox_n* water = root;  // water from root to leaf.
    do{
        canis = water;
        if(key < canis->val){  // canis chases water.
            water = canis->left;
            add_leaf = true;
        }else{
            water = canis->right;
            add_leaf = false;
        }
    }while(water != NULL);

    fox_n* leaf = new fox_n;  // add new leaf.
    leaf->val = key;
    leaf->parent = canis;
    leaf->left = NULL;
    leaf->right = NULL;
    if(add_leaf){ canis->left = leaf; }else{ canis->right = leaf; }
    return;
}

void inorder(fox_n* root)
{
    if(!root) return;
    inorder(root->left);
    printf(" %d", root->val);
    inorder(root->right);
    return;
}

void preorder(fox_n* root)
{
    if(!root) return;
    printf(" %d", root->val);
    preorder(root->left);
    preorder(root->right);
    return;
}

int main()
{
    fox_n* root = init();
    int i, n, key; string str;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> str;
        if(str[0] == 'i'){ cin >> key; insert(root, key); }
        else{ inorder(root); printf("\n"); preorder(root); printf("\n"); }
    }
    return 0;
}

Measured memory_bytes: 24636
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll a,b,n;
 cin>>a>>b>>n;
 ll res = (a*n)/b - a*(n/b);
 if( b-1 <= n ){
  res = max( res , (a*(b-1) )/b- a*( (b-1)/b ) );
 }
 cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        class Solver
        {
            private readonly long[] costs;
            public Solver(int N, int K, List<Tuple<int, int>>[] paths)
            {
                var q = new Queue<int>();
                costs = Enumerable.Repeat(long.MaxValue, N).ToArray();
                costs[K] = 0;
                q.Enqueue(K);
                while (q.Count > 0)
                {
                    int i = q.Dequeue();
                    foreach (var path in paths[i])
                    {
                        int j = path.Item1;
                        int cost = path.Item2;
                        if (costs[j] > costs[i] + cost)
                        {
                            costs[j] = costs[i] + cost;
                            q.Enqueue(j);
                        }
                    }
                }
            }
            public IEnumerable<long> Solve(int Q, Tuple<int, int>[] queries)
            {
                var answers = new long[Q];
                for (int i = 0; i < Q; ++i)
                {
                    int x = queries[i].Item1;
                    int y = queries[i].Item2;
                    answers[i] = costs[x] + costs[y];
                }
                return answers;
            }
        }
        static void Main(string[] args)
        {
            int N = ReadInt();
            var paths = new List<Tuple<int, int>>[N];
            for (int i = 0; i < N; ++i) { paths[i] = new List<Tuple<int, int>>(); }
            for (int i = 0; i < N - 1; ++i)
            {
                int[] v2 = ReadInts();
                int a = v2[0] - 1;
                int b = v2[1] - 1;
                int c = v2[2];
                paths[a].Add(new Tuple<int, int>(b, c));
                paths[b].Add(new Tuple<int, int>(a, c));
            }
            int[] v1 = ReadInts();
            int Q = v1[0];
            int K = v1[1] - 1;
            var queries = new Tuple<int, int>[Q];
            for (int i = 0; i < Q; ++i)
            {
                int[] v2 = ReadInts();
                queries[i] = new Tuple<int, int>(v2[0] - 1, v2[1] - 1);
            }
            foreach (var ans in new Solver(N, K, paths).Solve(Q, queries))
            {
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 44948
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
ll inv(ll x){
    return power(x,mod-2);
}
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main(){
    ll a,b,c,i,j,k;
    cin>>a;
    ll sum=0;
    for(i=1;i<=a;i++){
        for(j=1;j<=a;j++){
            for(k=1;k<=a;k++){
                sum+=gcd(gcd(i,j),k);
            }
        }
    }
    cout<<sum;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;

typedef struct node Node;

#define PB push_back

struct node{
  int id;
  int depth;
  int before;
  vector<int> nexts;
};

void Calc(int,int);//引数：親ノード、深さ
void PrintNode();

vector<Node> nodes(100000);
int n;

int main(int argc,char* argv[]){
  bool flag[100000];
  int id,k,x,rootnode;

  memset(flag,0,sizeof(flag));

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>id>>k;
    for(int j=0;j<k;j++){
      cin>>x;
      nodes[id].nexts.PB(x);
      flag[x]=true;
    }
  }

  for(int i=0;i<n;i++){
    nodes[i].id=i;
    if(!flag[i])
      rootnode=i;
  }

  nodes[rootnode].before=-1;
  Calc(rootnode,0);
  PrintNode();

  return 0;
}

void Calc(int nowid,int depth){
  
  nodes[nowid].depth=depth;
  depth++;
  
  for(int i=0;i<(int)nodes[nowid].nexts.size();i++){
    nodes[nodes[nowid].nexts[i]].before=nodes[nowid].id;
    Calc(nodes[nowid].nexts[i],depth);
  }
}

void PrintNode(){
  Node tmp;
  for(int i=0;i<n;i++){
    tmp=nodes[i];
    cout<<"node "<<tmp.id<<": parent = "<<tmp.before<<", depth = "<<tmp.depth<<", ";

    if(tmp.before==-1)
      cout<<"root";
    else if((int)tmp.nexts.size()==0)
      cout<<"leaf";
    else
      cout<<"internal node";

    cout<<", [";
    for(int j=0;j<(int)tmp.nexts.size();j++){
      cout<<tmp.nexts[j];
      if(j!=(int)tmp.nexts.size()-1){
	cout<<", ";
      }
    }
    cout<<"]"<<endl;
  }
}

Measured memory_bytes: 6072
from collections import deque
k = int(input())
lunlun = deque(range(1, 10))
for i in range(k):
    x = lunlun.popleft()
    next = 10*x + (x % 10)
    if x % 10 != 0:
        lunlun.append(next - 1)
    lunlun.append(next)
    if x % 10 != 9:
        lunlun.append(next + 1)
print(x)

Measured memory_bytes: 11976
<?php
fscanf(STDIN, "%d%d%d", $N, $M, $Q);
for($i = 1; $i <= $N; $i++){
  for($j = 0; $j <= $N; $j++){
    $map[$i][$j] = 0;
  }
}
for($i = 0; $i < $M; $i++){
  fscanf(STDIN, "%d%d", $L, $R);
  $map[$L][$R] += 1;
}
for($i = 1; $i <= $N; $i++){
  for($j = 1; $j <= $N; $j++){
    $map[$i][$j] = $map[$i][$j] + @$map[$i][$j-1];
  }
}
for($i = 1; $i <= $Q; $i++){
  fscanf(STDIN, "%d%d", $L, $R);
  if(!isset($q[$L][$R])){
    $sum = 0;
    for($j = $L; $j <= $R; $j++){
      $sum += $map[$j][$R] - @$map[$j][$L-1];
    }
    $q[$L][$R] = $sum;
  }
  echo $q[$L][$R],"\n";
}


Measured memory_bytes: 21496
#include<bits/stdc++.h>
#define rep(i, n, k) for(int i=k; i<n; ++i)
#define drep(i, n, k) for(int i=n-1; i>=k; --i)
#define ll long long int
using namespace std;

int main(){
  ll n;
  cin >> n;
  vector<ll> h(n);
  rep(i,n,0){
    ll hight;
    cin >> hight;
    h[i] = hight;
  }
  int ans = 0;
  ll min = h[n-1];
  drep(i,n-1,0){
    if(min > h[i]) min = h[i];
    if(h[i] - min > 1){
      ans = 1;
      break;
    }
  }
  if(ans) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
            char[] hon = {'2','4','5','7','9'};
            
            String s = sc.next();
            char c = s.charAt(s.length()-1);
            if(c == '3'){
                System.out.println("bon");
            }else{
                for(char d : hon){
                    if(c == d){
                        System.out.println("hon");
                        return;
                    }
                }
                System.out.println("pon");
            }
    }
    
    private static double toRadians(double deg)
    {
        return deg * Math.PI / 180.0;
    }
}
 
class Point{
    int cnt,x,y;
    public Point(int cnt, int y, int x){
        this.cnt = cnt;
        this.x = x;
        this.y = y;
    }
}
 
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
 
    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
 
    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public double nextDouble() {
         return Double.parseDouble(next());
    }
 
    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }
 
    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


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

int n, m, q; 
vector<ll> a, b, c, d;

ll score(const vector<int> &A){
    ll res = 0;
    for(int i=0; i<q; ++i){
        if(A[b[i]]-A[a[i]]==c[i]){res += d[i];}
    }
    return res;
}

ll dfs(vector<int> &A){
    if(A.size()==n){return score(A);}
    int v; ll res = 0; 
    if(!A.empty()){v = A.back();}else{v = 1;}
    for(int nv=v; nv<=m; ++nv){
        A.push_back(nv);
        res = max(res, dfs(A));
        A.pop_back();
    }
    return res;
}

int main(){
    cin >> n >> m >> q;
    a.resize(q); b.resize(q); c.resize(q); d.resize(q);
    for(int i=0; i<q; ++i){
        cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--;
    }
    vector<int> X;
    cout << dfs(X) << endl;
    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String c = sc.next();
		Boolean result;

		switch (c) {
		case "a":
		case "i":
		case "u":
		case "e":
		case "o":
			result = true;
			break;
		default:
			result = false;
			break;
		}

		if (result) {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}
	}
}

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

inline bool is_acgt(const char& c) { return c == 'A' || c == 'C' || c == 'G' || c == 'T'; }

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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  int count = 0;
  for(int i = 0; i < s.size(); ++i) {
    if(is_acgt(s[i])) {
      count++;
    } else {
      chmax(ans, count);
      count = 0;
    }
  }
  chmax(ans, count);
  cout << ans << endl;
  return 0;
}


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

using ll = long long;
using ld = long double;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    int mx = -INF;
    int mn = INF;
    int mxi = -1;
    int mni = -1;
    REP(i, n) {
        cin >> a[i];
        if (chmax(mx, a[i])) mxi = i + 1;
        if (chmin(mn, a[i])) mni = i + 1;
    }
    if (mn >= 0) {
        cout << n - 1 << EOL;
        REP1(i, n - 1) cout << i << " " << i + 1 << EOL;
    } else if (mx <= 0) {
        cout << n - 1 << EOL;
        REPR(i, n - 1) cout << i + 2 << " " << i + 1 << EOL;
    } else if (mx >= -mn) {
        vector<int> minus;
        REP(i, n) if (a[i] < 0) minus.emplace_back(i + 1);
        cout << n - 1 + sz(minus) << EOL;
        for (int x : minus) cout << mxi << " " << x << EOL;
        REP1(i, n - 1) cout << i << " " << i + 1 << EOL;
    } else {
        vector<int> plus;
        REP(i, n) if (a[i] > 0) plus.emplace_back(i + 1);
        cout << n - 1 + sz(plus) << EOL;
        for (int x : plus) cout << mni << " " << x << EOL;
        REPR(i, n - 1) cout << i + 2 << " " << i + 1 << EOL;
    }
}



Measured memory_bytes: 256
# https://atcoder.jp/contests/dp/tasks/dp_g
import sys
input = sys.stdin.readline

N, M = [int(x) for x in input().split()]

# メモ化再帰版
# E = [[] for _ in range(N)]
# for i in range(M):
#     e = tuple([int(x) for x in input().split()])
#     E[e[0] - 1].append(e[1] - 1)
#
# dp = [-1] * N
# def rec(v):
#     if dp[v] != -1:
#         return dp[v]
#
#     res = 0
#     for n in E[v]:
#         res = max(res, rec(n) + 1)
#     dp[v] = res
#     return res
#
# res = 0
# for n in range(N):
#     res = max(res, rec(n))
#
# print(res)

# BFS版
from collections import deque


deg = [0] * N  # 各頂点の入力数
dp = [0] * N   # 各頂点のスタートからの距離

E = [[] for _ in range(N)]
for i in range(M):
    e = tuple([int(x) - 1 for x in input().split()])
    E[e[0]].append(e[1])
    deg[e[1]] += 1

que = deque([i for i, v in enumerate(deg) if v == 0])

while len(que) > 0:
    v = que.popleft()
    for to in E[v]:
        deg[to] -= 1
        if deg[to] == 0:
            que.append(to)
            dp[to] = max(dp[to], dp[v] + 1)

print(max(dp))

Measured memory_bytes: 23020
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	
	int n = scan.nextInt();
	
	int ans = 0;
	for(int i = 1; i <= n; i += 2){
	    int count = 0;
	    for(int j = i; j >= 1; j--){
		if(i % j == 0){
		    count++;
		}
	    }
	    if(count == 8){
		ans++;
	    }
	}
	
	System.out.println(ans);
    }
}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2748&lang=jp

void bfs(int n, vector<vector<int>>& G,vector<int>& used,vector<int>& t) {
	used[n] = 1;
	for (auto e : G[n]) {
		if (used[e] != 0)continue;
		bfs(e, G, used, t);
	}
	t.push_back(n);
}

vector<int> search(int n, vector<vector<int>>& G, vector<vector<int>>& S) {
	vector<int> ret;
	for (int i = 0; i < S[n].size(); i++) {
		for (int j = 0; j < G[S[n][i]].size(); j++) {
			int next = G[S[n][i]][j];
			for (int k = 0; k < S.size();k++) {
				if (find(S[k].begin(), S[k].end(),next) == S[k].end()) continue;
				if (k == n) break;
				ret.push_back(k);
			}
		}
	}
	sort(ret.begin(), ret.end());
	ret.erase(unique(ret.begin(), ret.end()), ret.end());
	return ret;
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N;
	while (cin >> N, N) {
		vector<double> p(N);
		vector<vector<int>> G(N),rG(N);
		/* input */
		for (int i = 0; i < N;i++) {
			cin >> p[i];
			int m; cin >> m;
			for (int j = 0; j < m;j++) {
				int a; cin >> a; a--;
				G[i].push_back(a);
				rG[a].push_back(i);
			}
		}

		/* SCC */
		vector<int> used(N, 0);
		vector<int> t;
		for (int i = 0; i < N;i++) {
			if (used[i] != 0) continue;
			bfs(i, G, used, t);
		}
		for (int i = 0; i < N;i++) used[i] = 0;
		vector<vector<int>> S;
		vector<double> Sp;
		for (auto it = t.rbegin(); it != t.rend(); it++) {
			if (used[*it] != 0)continue;
			S.push_back(vector<int>());
			bfs(*it, rG, used, S[S.size() - 1]);
			double _Sp = 1;
			for (int i = 0; i < S[S.size() - 1].size();i++) {
				_Sp *= p[S[S.size() - 1][i]];
			}
			Sp.push_back(_Sp);
		}

		/* solve */
		vector<vector<int>> new_rG(S.size());
		for (int i = 0; i < S.size();i++) {
			auto v = search(i, G, S);
			for (auto V : v) new_rG[V].push_back(i);
		}
		double ans = 1;
		for (int i = 0; i < S.size();i++) {
			if (new_rG[i].size() != 0) continue;
			ans *= (1 - Sp[i]);
		}
		cout << fixed << setprecision(10) << ans << endl;

	}
	return 0;
}

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

typedef long long ll;
using namespace std;
int main()
{
ll n,c=0; cin>>n;
ll a[n];
ll mx=INT_MIN;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
    mx=max(mx,a[i]);
    //cout<<mx<<endl;
    c+=mx-a[i];
}
cout<<c<<endl;
}


Measured memory_bytes: 5168
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int r,c;
    cin >> r >> c;
    int ar[r+5][c+5];
    for(int i=0;i<r;i++){
        int x=0;
        for(int j=0;j<c;j++){
            cin >> ar[i][j];
            x+=ar[i][j];
        }
        ar[i][c]=x;
    }
    for(int j=0;j<=c;j++){
        int x=0;
        for(int i=0;i<r;i++) x+=ar[i][j];
        ar[r][j]=x;
    }
    for(int i=0;i<=r;i++){
        for(int j=0;j<c;j++) cout << ar[i][j] << ' ';
        cout << ar[i][c] << '\n';
    }
}


Measured memory_bytes: 3120
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int A, B, C, X;
int ans = 0;

int main() {
    cin >> A >> B >> C >> X;
    int total = 0;
    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int k = 0; k <= C; k++){
                total = 500 * i + 100 * j + 50 * k;
                if (total == X) ans++;
            }
        }
    }
    
    cout << ans << endl;
}


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

int main(){
    int n;
    cin>>n;
    vector<vector<int>> g(n);
    int u,k,v;
    for(int i=0;i<n;++i){
        cin>>u>>k;
        if(k==0)continue;
        for(int j=0;j<k;++j){
            cin>>v;
            g[i].push_back(v-1);
        }
    }
    vector<int> dist(n,-1);
    queue<int> que;
    dist[0]=0;
    que.push(0);
    while(!que.empty()){
        int q=que.front();
        que.pop();
        for(int nv:g[q]){
            if(dist[nv]!=-1)continue;
            dist[nv]=dist[q]+1;
            que.push(nv);
        }
    }
    for(int i=0;i<n;++i){
        cout<<i+1<<" "<<dist[i]<<endl;
        //if(i<n-1)cout<<""<<endl;
    }
    return 0;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i=0; i<N; ++i) cin >> S[i];
  sort(S.begin(), S.end());
  int ans = 1;
  for(int i=0; i<N-1; ++i){
    if(S[i] != S[i+1]) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 9548
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>//cout << fixed << setprecision() <<
#include <set>
#include <map>
using ll = long long;
using namespace std;

int main(void){
    ll k;
    string s;
    cin>>k>>s;
    if(s.length()>k){
        for(int i=0;i<k;i++){
            cout<<s[i];
        }
        cout<<"...";
    }
    else{
        cout<<s;
    }
}


Measured memory_bytes: 3624
A, B, C, D, E, F = map(int, input().split())

W = set()
for a in range(0, F+1, A*100):
    for b in range(0, F+1-a, B*100):
        W.add(a+b)

S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1-c, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w+s <= F and s <= w*E // 100:
            if s/(w+s) > rate:
                rate = s/(w+s)
                ans = w+s, s
                
print(ans[0], ans[1])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rint register int
#define fo(i, n) for(rint i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
int n, vis[233];
char str[233];
main(void) {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  int ok = 0, cnt = 0;
  
  for(int i = 1; i <= n; i ++) {
    if(str[i] != 'z' - i + 1)
      ok = 1;
  }
  if(!ok && n == 26) return puts("-1"), 0;
  for(int i = 1; i <= n; i ++)
    vis[str[i]] = 1, ++ cnt;
  if(cnt < 26) {
    for(int i = 1; i <= n; i ++)
      putchar(str[i]);
    for(int i = 'a'; i <= 'z'; i ++)
      if(!vis[i]) {putchar(i); break;}
    puts("");
  }
  else {
    for(int i = n; i >= 1; i --) {
      for(int j = i; j <= n; j ++)
        vis[str[j]] = 0;
      for(int k = str[i] + 1; k <= 'z'; k ++)
        if(!vis[k]) {
          for(int j = 1; j <= i - 1; j ++)
            putchar(str[j]);
          putchar(k); puts("");
          return 0;
        }
    }
    puts("");
  }
}


Measured memory_bytes: 256
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int N = line[0];
            int K = line[1];
            Console.WriteLine(N % K == 0 ? 0 : 1);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    string s; cin >> s;

    map<string, ll> mp;
    mp["SUN"] = 7;
    mp["MON"] = 6;
    mp["TUE"] = 5;
    mp["WED"] = 4;
    mp["THU"] = 3;
    mp["FRI"] = 2;
    mp["SAT"] = 1;

    p(mp[s]);    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int v[n],c[n];
  int ans=0;
  for(int i=0;i<n;i++)
  {
    cin>>v[i];
  }
  for(int i=0;i<n;i++)
  {
    cin>>c[i];
  }
  for(int i=0;i<n;i++)
  {
     if(v[i]>c[i])
        {
          ans=ans+(v[i]-c[i]);
        }
  }
    cout<<ans<<endl;
 }
  


Measured memory_bytes: 3588