akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scanf("%d%d", &N, &K)
	var a int
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a)
	}
	i := 0
	for {
		i++
		N -= K
		if N <= 0 {
			break
		}
		N++
	}
	fmt.Printf("%d\n", i)
	return
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<long long>T(N);
    for (int i = 0; i < N; i++) {
        cin >> T.at(i);
    }

    if (N == 1){
        cout << T.at(0) << endl;
        return 0;
    }

    long long gcd;
    long long lcm = T.at(0);

    long long X = T.at(0);
    long long Y = T.at(1);
    long long Z = X % Y;
    int count;

    for (int i = 1; i < N; i++) {
        count = 0;
        while (count == 0){
            if (Z == 0){
                gcd = Y;
                lcm = lcm / gcd * T.at(i);
                if (i != N-1){
                    X = T.at(i+1);
                    Y = lcm;
                    Z = X % Y;
                }
                count++;
            }
            else {
               X = Y; 
               Y = Z;
               Z = X % Y;
            } 
        }
    }
    cout << lcm << endl;
}





Measured memory_bytes: 3604
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  string s;
  cin >> s;
  vector<int> v(26);
  for (char c : s) ++v[c - 'a'];
  for (int i = 0; i < 26; ++i) {
    if (v[i] == 0) {
      cout << char(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}



Measured memory_bytes: 512
#pragma G++ optimize (2)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#define INF 0x3f3f3f3f
#define NO 30005
#define MO 100005
typedef long long ll;
//by Oliver
using namespace std;
ll read()
{
	char ch = ' ', last;
	ll ans = 0;
	while (ch < '0' || ch > '9')
		last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')
		ans = ans * 10 + int(ch - '0'), ch = getchar();
	if (last == '-')
		return -ans;
	return ans;
}
void write(ll x)
{
	if (x >= 10)
		write(x / 10);
	putchar(x % 10 + '0');
}
//head

int n, T, A, h[NO], ans;
double t[NO];
//variable

void init()
{
	n = read(), T = read(), A = read();
	for (int i = 1; i <= n; i++)
		h[i] = read(), t[i] = T - 0.006 * h[i];
}
//functions

int main()
{
	init();
	ans = 1;
	for (int i = 1; i <= n; i++)
		if (abs(t[ans] - A) > abs(t[i] - A))
			ans = i;
	cout << ans << endl;
	return 0;
}
//main


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextInt()
    val b = scanner.nextInt()
    val C = scanner.nextInt()

    val x = Math.cos(C.toDouble() / 180 * Math.PI) * b
    val h = Math.sin(C.toDouble() / 180 * Math.PI) * b
    val c = Math.sqrt(Math.pow(h, 2.toDouble()) + Math.pow(a - x, 2.toDouble()))

    val S = h * a / 2
    val L = a + b + c

    println(S)
    println(L)
    println(h)
}


Measured memory_bytes: 25444
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;

int main() {

  string in, l;

  while( true ) {
    if ( cin.eof() ) break;

    getline( cin, l );
    if ( l.size() == 0 ) break;

    stack<double> s;
    stringstream st(l);

    while( st >> in ) {

      if ( in == "+" || in == "-" || in == "*" || in == "/" ) {
	double a, b;
	a = s.top();
	s.pop();
	b = s.top();
	s.pop();
	if ( in == "+" ) {
	  //cout << b << " + " << a << endl;
	  b += a;
	}else if ( in == "-" ) {
	  //cout << b << " - " << a << endl;
	  b -= a;
	}else if ( in == "*" ) {
	  //cout << b << " * " << a << endl;
	  b *= a;
	}else if ( in == "/" ) {
	  //cout << b << " / " << a << endl;
	  b /= a;
	}
	s.push( b );
      }else {
	double s_in;
	stringstream ss(in);
	ss >> s_in;
	s.push( s_in );
      }

    }

    cout << fixed << setprecision( 10 ) << s.top() << endl;

  }

  return 0;

}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

namespace
{
	int sign(int src)
	{
		return src == 0 ? 0 : src > 0 ? 1 : -1;
	}
}
void AGC008A()
{
	int X, Y;
	cin >> X >> Y;
	int ct = 0;
	if (sign(X) * sign(Y) >= 0)
	{
		if (X > Y)
		{
			++ct;
			ct += X - Y;
			if(X * Y != 0)
				++ct;
		}
		else
		{
			ct = Y - X;
		}
	}
	else
	{
		ct = abs(abs(X) - abs(Y)) + 1;
	}
	cout << ct << endl;
}
int main()
{
	AGC008A();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

vector <vector <int> > gr;
int n;

const int N = 307;

int tp[N];

void dfs(int v, int now) {
	if (tp[v]) {
		if (tp[v] != now) {
			cout << "-1\n";
			exit(0);
		}
		return;
	}
	tp[v] = now;
	for (int u : gr[v]) {
		dfs(u, 3 - now);
	}
}

const int INF = 1e9 + 7;

int main(){
#ifdef LOCAL
	freopen("B_input.txt", "r", stdin);
	//freopen("B_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	gr.resize(n);
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < n; j++) {
			if (s[j] == '1') {
				gr[i].push_back(j);
			}
		}
	}
	dfs(0, 1);
	int res = 0;
	for (int s = 0; s < n; s++) {
		vector <int> d(n, INF);
		queue <int> q;
		d[s] = 0;
		q.push(s);
		int mx = 0;
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			mx = max(mx, d[v]);
			for (int u : gr[v]) {
				if (d[u] == INF) {
					d[u] = d[v] + 1;
					q.push(u);
				}
			}
		}
		res = max(res, mx + 1);
	}
	cout << res << "\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>
 
using namespace std;
 
#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)
 
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)
 
 
#define y0 y3487465
#define y1 y8687969
 
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
 
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
 
double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;
 
ll N;
const ll MAX_N = 100000;
ll x[MAX_N], y[MAX_N];
char d[MAX_N];
 
int main(){
  cin >> N;
  REP(i, N) cin >> x[i] >> y[i] >> d[i];
  map<char, ll> xmax, xmin, ymax, ymin;
  char cs[4] = {'R', 'L', 'U', 'D'};
  for (auto c: cs) {
    xmax[c] = -INFll;
    xmin[c] = INFll;
    ymax[c] = -INFll;
    ymin[c] = INFll;
  }
  REP(i, N) {
    xmax[d[i]] = max(xmax[d[i]], x[i] * 2);
    xmin[d[i]] = min(xmin[d[i]], x[i] * 2);
    ymax[d[i]] = max(ymax[d[i]], y[i] * 2);
    ymin[d[i]] = min(ymin[d[i]], y[i] * 2);
  }
 
  vll ts;
  ts.pb(0);
  ts.pb(xmax['L'] - max(xmax['U'], xmax['D']));
  ts.pb((xmax['L'] - xmax['R']) / 2);
  ts.pb(max(xmax['U'], xmax['D']) - xmax['R']);
  
  ts.pb(min(xmin['U'], xmin['D']) - xmin['R']);
  ts.pb((xmin['L'] - xmin['R']) / 2);
  ts.pb(xmin['L'] - min(xmin['U'], xmin['D']));
 
  ts.pb(ymax['D'] - max(ymax['L'], ymax['R']));
  ts.pb((ymax['D'] - ymax['U']) / 2);
  ts.pb(max(ymax['L'], ymax['R']) - ymax['U']);
 
  ts.pb(min(ymin['L'], ymin['R']) - ymin['U']);
  ts.pb((ymin['D'] - ymin['U']) / 2);
  ts.pb(ymin['D'] - min(ymin['L'], ymin['R']));
 
  ll ans = INFll;
 
  for (auto t: ts) {
	  t = abs(t);
    if(t >= 0 && t < 50000000000) {
      ll r = max(max(xmax['L'] - t, xmax['R'] + t), max(xmax['U'], xmax['D']));
      ll l = min(min(xmin['L'] - t, xmin['R'] + t), min(xmin['U'], xmin['D']));
      ll u = max(max(ymax['U'] + t, ymax['D'] - t), max(ymax['L'], ymax['R']));
      ll d = min(min(ymin['U'] + t, ymin['D'] - t), min(ymin['R'], ymin['L']));
 
      ans = min(ans, (r - l) * (u - d));
    }
  }
 
  cout << setprecision(15) << std::fixed << ans / 4.0 << endl;
 
 
  return 0;
}


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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n;
    cin >> n;
    map<i64, i64> acnt;
    for (i64 i = 0; i < n; i++) {
        i64 a;
        cin >> a;
        acnt[a]++;
    }

    vector<i64> invalid(1e6 + 1);
    i64 ans = 0;
    for (auto& [ a, cnt ] : acnt) {
        if (invalid[a]) continue;
        if (cnt == 1) ans++;
        for (i64 i = 1; i * a <= (i64) 1e6; i++) invalid[i * a] = 1;
    }
    cout << ans << endl;
}

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


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int cnt = 0, mi = 2e9;
  long sum = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) < 0) cnt++;
    mi = min(mi, abs(A.at(i)));
    sum += abs(A.at(i));
  }
  cout << ((cnt % 2) ? sum - mi * 2 : sum) << "\n";
}

Measured memory_bytes: 640
#include <stdio.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2
#define M 101


void dfs(int);
void visit(int);


int g[M][M];
int color[M];
int d[M];
int f[M];
int time, n;


int main(){
  int u, k, v;
  int i, j;

  scanf("%d", &n);

  for(i = 0; i <= n; i++){
    for(j = 0; j <= n; j++){
      g[i][j] = 0;
    }
  }

  for(i = 1; i <= n; i++){
    scanf("%d", &u);
    scanf("%d", &k);

    for(j = 1; j <= k; j++){
      scanf("%d", &v);

      g[u][v] = 1;
    }
  }

  dfs(n);

  for(i = 1; i <= n; i++) printf("%d %d %d\n", i, d[i], f[i]);

  return 0;
}


void dfs(int u){
  int i;

  for(i = 1; i <= n; i++){
    color[i] = WHITE;
  }

  time = 0;

  for(i = 1; i <= n; i++){
    if(color[i] == WHITE) visit(i);
  }
}


void visit(int u){
  int i;
  int v;
  
  color[u] = GRAY;

  d[u] = ++time;

  for(v = 1; v <= n; v++) {
    if(color[v] == WHITE && g[u][v] == 1) visit(v);
  }

  color[u] = BLACK;

  f[u] = ++time;
}



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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;

bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key,vi a) {
    int left = -1;
    int right = (int)a.size();
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        
        if (isOK(mid, key,a)) right = mid;
        else left = mid;
    }
    return right;
}

int modpow(int a,int b,int p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    if(a*b<=0){
        cout << "Zero" << endl;
    }elif(a>0&&b>0){
        cout << "Positive" << endl;
    }elif(a<0&&b<0){
        cout << ((b-a+1)%2?"Negative":"Positive") << endl;
    }
    return 0;
}


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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a+=b;
    c+=d;
    if(a==c){
        cout<<"Balanced\n";
    }else if(a>c){
        cout<<"Left\n";
    }else{
        cout<<"Right\n";
    }
}


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

int Set(int n,int pos)
{
    return (n | (1<<pos));
}
bool Check(int n,int pos)
{
    return (n & (1<<pos));
}


int frr[30];

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

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=30;j++)
        {
            if(Check(arr[i],j))frr[j]++;
        }
    }

    vector<long long>v;

    for(int i=0;i<n;i++)
    {
        long long k=0;
        for(int j=0;j<=30;j++)
        {
            if(Check(arr[i],j))
            {
                int a=frr[j]-1;
                if(a%2==1)k=Set(k,j);
            }
            else
            {
                int a=frr[j];
                if(a%2==1)k=Set(k,j);
            }
        }
        v.push_back(k);
    }
    for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;
}


Measured memory_bytes: 6056
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
struct rect{
    int x1,y1,x2,y2;
    rect(int x1, int y1, int x2, int y2){
        this->x1=x1; this->y1=y1;
        this->x2=x2; this->y2=y2;
    }
    bool isInclude(double x, double y){
        return x1<=x&&x<=x2&&y2<=y&&y<=y1;
    }
};

vector<double> X,Y;
long long int map[102][102];
bool isChecked[102][102];

void dfs(int y, int x){
    int d[5]={-1,0,1,0,-1};
    if(isChecked[y][x]) return;
    isChecked[y][x]=true;
    for(int i=0;i<4;i++){
        int dx=d[i],dy=d[i+1];
        if(0<=x+dx&&x+dx<=X.size()&&0<=y+dy&&y+dy<=Y.size()){
            if(isChecked[y+dy][x+dx])continue;
            if(map[y+dy][x+dx]==map[y][x]) dfs(y+dy,x+dx);
        }
    }
}

int main(){
    int n;
    vector<rect> R;
    while(cin>>n,n){
        R.clear();
        X.clear(); Y.clear();
        for(int i=0;i<n;i++){
            int l,t,r,b;
            cin>>l>>t>>r>>b;
            R.emplace_back(l,t,r,b);
            X.push_back(l);
            X.push_back(r);
            Y.push_back(t);
            Y.push_back(b);
        }
        X.push_back(-1);
        X.push_back(1e6+1);
        Y.push_back(-1);
        Y.push_back(1e6+1);
        sort(X.begin(),X.end());
        X.erase(unique(X.begin(),X.end()),X.end());
        sort(Y.begin(),Y.end());
        Y.erase(unique(Y.begin(),Y.end()),Y.end());

        fill(map[0],map[102],-1);
        fill(isChecked[0],isChecked[102],false);
        for(int i=0;i<Y.size()-1;i++){
            for(int j=0;j<X.size()-1;j++){
                double x=(X[j]+X[j+1])/2.0, y=(Y[i]+Y[i+1])/2.0;
                long long int region=0;
                for(int i=0;i<n;i++){
                    if(R[i].isInclude(x,y))region|=((long long int)1<<i);
                }
                map[i][j]=region;
            }
        }
        int count =0;
        for(int i=0;i<Y.size()-1;i++){
            for(int j=0;j<X.size()-1;j++){
                if(isChecked[i][j])continue;
                count++;
                dfs(i,j);
            }
        }
        cout<<count<<endl;
    }
    return 0;
}

Measured memory_bytes: 4144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)

int main()
{
    string S;
    cin >> S;
    ll cnt = 0;
    repi(i, 3, 0)
    {
        if (S.at(i) == 'o')
        {
            cnt++;
        }
    }
    cout << cnt*100 + 700 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int A = ni();
        int B = ni();
        int C = ni();
        long ans = 0;
        ans = A +B;
        ans = Math.min(ans, B+C);
        ans = Math.min(ans, A+C);
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);
    int upperBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new UpperBoundComparator<Long>());
        return ~i;
    }
    class UpperBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) > 0) ? 1 : -1;
        }
    }
    int lowerBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new LowerBoundComparator<Long>());
        return ~i;
    }
    class LowerBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) >= 0) ? 1 : -1;
        }
    }
    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 32976
#include<stdio.h>
#include<math.h>
int main(void)
{
    long long int kai,N;
    double h,v,t,t2,speed;
    while(scanf("%lf",&speed)!=EOF)
    {
        for(N=1;;N++)
        {
            kai=5*N;
            h=kai-5;
            t2=h/4.9;
            t=sqrt(t2);
            v=9.8*t;
            if(v>speed)
                break;
        }
        printf("%d\n",N);
    }
    return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <math.h>
using namespace std;


int main()
{
  int n;
  cin >> n;
  double s = 0;
  for (int i = 0; i < n; ++i)
  {
    double x;
    cin >> x;
    s += (1 / x);
  }
  cout << (1 / s) << endl;
  return 0;
}

Measured memory_bytes: 256
n=input()
a,b,c,d=n[0],n[1],n[2],n[3]
X=['+','-']
for x1 in X:
    for x2 in X:
        for x3 in X:
            if eval(a+x1+b+x2+c+x3+d)==7:
                print(a+x1+b+x2+c+x3+d+"=7")
                exit()

Measured memory_bytes: 3060
from collections import deque

k = int(input())

LL = [i for i in range(1, 10)]
LL = deque(LL)
for j in range(k):
    num = LL.popleft()
    amari = num % 10
    kouho = [amari - 1, amari, amari + 1]
    for nn in kouho:
        if nn >= 0 and nn < 10:
            LL.append(10 * num + nn)
print(num)


Measured memory_bytes: 74772
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
vector<int > A , B ;
map <int , int > frA , frB ; 
int main() {
int  m  , n  ;
scanf("%d" , &n);
int x;
for(int  i=0 ; i< n ;i++){
	scanf("%d" , &x);
if(frA[x]==0){
A.push_back(x);	
}
frA[x]++;
}
scanf("%d" , &m);
for(int i =0 ; i< m ;i++){
	scanf("%d" , &x);

if(frB[x]==0){
B.push_back(x);	
}
frB[x]++;
}

sort(A.begin(),A.end()) ;
sort(B.begin() , B.end()) ;
	bool b =true ;
	if(n<m){
		cout<<"NO";
		return  0 ;
	}

	for(int  i=0 ; i < B.size() ;i++){

//cout<<B[i]<<endl;
		int y  = lower_bound(A.begin() , A.end() , B[i])-A.begin() ;
		if(y==A.size() ){
			b=0;break;
		}
		if(A[y]==B[i]){
			if(frB[B[i]] > frA[A[y]]){
				b=0;
			}else{
				frA[A[y]]--;
//			cout<<" SS" ;
				
			}
		}else{
			b=0;
		}
	}
	if(b)printf("YES");
	else
	printf("NO");
		return 0;
}

Measured memory_bytes: 20596
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;
typedef vector<vector<ll>> matrix;

ll modpow(ll b, ll e, ll m) {
  ll r = 1;
  while(e) {
    if(e%2) {
      r*=b;
      r%=m;
    }
    b*=b;
    b%=m;
    e/=2;
  }
  return r;
}
ll inv(ll b, ll m) {
  return modpow(b, m-2, m);
}
const int MOD = 1000003;
ll prefFact[MOD + 1];

void realsolve() {
  int x, d, n;
  cin >> x >> d >> n;
  if(d == 0) {
    cout << modpow(x, n, MOD) << "\n";
    return;
  }
  ll start = x * inv(d, MOD);
  start %= MOD;
  if(start == 0 || start + n-1 >= MOD) {
    cout << "0\n";
    return;
  }
  ll ret = prefFact[start+n-1] * inv(prefFact[start-1], MOD);
  ret %= MOD;
  ret *= modpow(d, n, MOD);
  ret %= MOD;
  cout << ret << "\n";
}

void solve() {
  prefFact[0] = 1;
  for(int i = 1; i <= MOD; i++) {
    prefFact[i] = prefFact[i-1] * i;
    prefFact[i] %= MOD;
  }
  int q;
  cin >> q;
  while(q--) realsolve();
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 8704
N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]

AB.sort(key = lambda x:x[1])
t = 0

for i in range(N):
  t += AB[i][0]
  if t > AB[i][1]:
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 53600
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int n, k;
	cin >> n >> k;
	int cnt = 0, cur = 1;
	while(cur <= n) {
		cnt++;
		cur *= k;
	}
	cout << cnt << endl;
	
}





Measured memory_bytes: 256
# Hello from https://codeforces.com/gym/101341/problem/A

class BracketString:
    def __init__(self, s, i):
        self.i = i
 
        balance = 0
        minimum = 0
        for c in s:
            if c == "(":
                balance += 1
            else:
                balance -= 1
                minimum = min(minimum, balance)
 
        revBalance = 0
        revMinimum = 0
        for c in reversed(s):
            if c == ")":
                revBalance += 1
            else:
                revBalance -= 1
                revMinimum = min(revMinimum, revBalance)
 
        assert balance == -revBalance
 
        self.balance = balance
        self.minimum = minimum
        self.revMinimum = revMinimum
 
    @staticmethod
    def cmpForPositive(a, b):
        return b.minimum - a.minimum
 
    @staticmethod
    def cmpForNegative(a, b):
        return a.revMinimum - b.revMinimum
 
 
n = int(raw_input())
positive = []
negative = []
neutral = []
sumBalance = 0
for i in xrange(n):
    s = raw_input()
    bs = BracketString(s, i)
    if bs.balance > 0:
        positive.append(bs)
    elif bs.balance < 0:
        negative.append(bs)
    else:
        neutral.append(bs)
    sumBalance += bs.balance
 
if sumBalance != 0:
    print "No"
    exit()
 
positive.sort(cmp=BracketString.cmpForPositive)
negative.sort(cmp=BracketString.cmpForNegative)
 
ans = []
curBalance = 0
 
for bs in positive + neutral + negative:
    if curBalance + bs.minimum < 0:
        print "No"
        exit()
    curBalance += bs.balance
    ans.append(bs.i + 1)
 
print "Yes"


Measured memory_bytes: 264340
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

@mt
def slv(N, S):
    if S[0] != 'B' or S[-1] != 'B':
        return 0

    LR = [''] * N * 2
    l = 0
    ans = 1
    M = Mod(10**9+7)
    for i in range(2*N):
        if S[i] == 'B':
            if l % 2 == 0:
                LR[i] = 'L'
                l += 1
            else:
                LR[i] = 'R'
                ans = M.mul(ans, l)
                l -= 1

        else:
            if l % 2 == 0:
                LR[i] = 'R'
                ans = M.mul(ans, l)
                l -= 1
            else:
                LR[i] = 'L'
                l += 1

    C = Counter(LR)
    if C['L'] != C['R']:
        return 0

    for i in range(1, N+1):
        ans = ans = M.mul(ans, i)


    return ans


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 64844
s = input()
K = int(input())

Ts = [s[i:] for i in range(len(s))]
Ts.sort()

subs = set()
for T in Ts:
    for i in range(len(T)):
        subs.add(T[:i + 1])
        if len(subs) == K:
            print(T[:i + 1])
            exit()


Measured memory_bytes: 15604
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                    ll n;
                    cin>>n;
                    vector<ll> vec(n);
                    for(int i = 0; i < n; i++)
                        cin>>vec[i];
                    sort(vec.begin(), vec.end());
                    reverse(vec.begin(), vec.end());
                    ll ans = 0, idx = 1;
                    ans = vec[0];
                    // cout<<ans;
                    n -= 2;
                    while(n>0){
                        if(n == 1){
                            ans += vec[idx];
                            break;
                        }
                        else{
                            ans += 2*vec[idx];
                            n-=2;
                            ++idx;
                        }
                        // cout<<ans;
                    }
                    cout<<ans;
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         
 
 

Measured memory_bytes: 4772
#include <iostream>

const int MAX_N = 10000;

int f[MAX_N + 3];

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  int n;
  std::cin >> n;
  for (int x = 1; x <= 1000; ++x) {
    for (int y = 1; y <= 1000; ++y) {
      if (x * x + y * y + x * y > n) break;
      for (int z = 1; z <= 1000; ++z) {
        int tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp > n) break;
        ++f[tmp];
      }
    }
  }
  for (int i = 1; i <= n; ++i) std::cout << f[i] << '\n';
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final long initialHitPoint = scanner.nextLong();

    System.out.println(getAttackCount(initialHitPoint));
  }

  private static long getAttackCount(long hitPoint) {
    if (hitPoint == 1) {
      return 1;
    }

    return getAttackCount(hitPoint / 2) * 2 + 1;
  }
}

Measured memory_bytes: 26904
#include<bits/stdc++.h>
using namespace std;
#define in_fre freopen("redir.txt", "r", stdin);
#define out_fre freopen("out5.txt", "w", stdout);

int main(){
#ifndef ONLINE_JUDGE
	in_fre
	out_fre
#endif 
	int a,b,c,d;
  cin>>a>>b>>c>>d;
  //if(b>a)swap(a,b);
  //if(d>c)swap(c,d);
  int ch=1;
  while((c>0)&&(a>0))
  {
    if(ch==1){
    ch=2;
      c=c-b;
      //d=d-b;
    }
    else if(ch==2){
    ch=1;
    	a=a-d;
      //b=b-d;
    }
    //cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
  }
  if(c<=0)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
}

Measured memory_bytes: 3604
s = int(input())

dp = [0]*(2001)
MOD = 10**9+7

dp[0] = 1
dp[1] = 0
dp[2] = 0

if s >= 3:
    for i in range(3, s+1):
        dp[i] = (dp[i-1] + dp[i-3]) % MOD
    print(dp[s])
else:
    print("0")


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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
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, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll T, A, B; cin >> T >> A >> B;
    cout << min(T * A, B) << endl;
}


Measured memory_bytes: 256
while True:
	H,W = map(int, raw_input().split(" "))
	if H == 0 and W == 0:
		break
	else:
		for h in xrange(H):
			sw = True if (h % 2) == 0 else False
			s = ""
			for w in xrange(W):
				s += "#" if sw else "."
				sw = not sw
			print s
		print ""

Measured memory_bytes: 4212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AOJ_Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            var oneLine = Console.ReadLine().Split(' ').Select(double.Parse).ToList();

            var h = Math.Sin(oneLine[2] * Math.PI / 180.0) * oneLine[1];

            var powA = oneLine[0] * oneLine[0];
            var powB = oneLine[1] * oneLine[1];

            var twoABcosC = 2 * oneLine[0] * oneLine[1] * Math.Cos(oneLine[2] * Math.PI / 180.0);

            var powC = powA + powB - twoABcosC;
            var c = Math.Sqrt(powC);
            var area = oneLine[0] * h / 2.0;
            var aroundLength = oneLine[0] + oneLine[1] + c;

            Console.WriteLine(area.ToString("F5"));
            Console.WriteLine(aroundLength.ToString("F5"));
            Console.WriteLine(h.ToString("F5"));
        }
    }
}



Measured memory_bytes: 16388
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

def main():
    L, R = map(int, input().split())

    for i in range(1, 990589):
        if L <= 2019*i <= R:
            print(0)
            exit()

    ans = 10**19
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            num = (i * j) % 2019
            ans = min(ans, num)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 77500
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
	int num,cap,price,i;

	while(std::cin >> num >> cap){

		if(num == 0 && cap == 0){
			break;
		}

		std::vector<int> vegetables;

		for(i=0; i<num; ++i){
			std::cin >> price;
			vegetables.push_back(price);
		}

		sort(vegetables.begin(), vegetables.end(), std::greater<int>());

		int sum = 0;
		i = 0;

		while(i < num){

			if((i+1) % cap != 0){
				sum += vegetables.at(i);
			}

			++i;
		}

		std::cout << sum << std::endl;
	}

}

Measured memory_bytes: 1228
# -*- coding: utf-8 -*-
s = input()
easy = True
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "L":
            easy = False
            break
    else:
        if s[i] == "R":
            easy = False
            break

if easy:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
N, K  = map(int, input().split())

zero = 0
even = 0

for i in range(1, N+1):
  if i % K == 0:
    zero += 1
  
  if K % 2 == 0:
    if i % K == K//2:
      even += 1

ans = 0
ans += zero**3
ans += even**3

print(ans)

Measured memory_bytes: 3064
from heapq import *
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    heappush(b,a[i])
s=sum(b)
d=[0]*(n+1)
d[0]=s
for i in range(n,2*n):
    t=heappop(b)
    if t>a[i]:
        heappush(b,t)
    else:
        s=s-t+a[i]
        heappush(b,a[i])
    d[i-n+1]=s
b=[]
for i in range(2*n,3*n):
    heappush(b,-a[i])
s=sum(b)
d[n]+=s
for i in range(2*n-1,n-1,-1):
    t=heappop(b)
    if t>-a[i]:
        heappush(b,t)
    else:
        s=s-t-a[i]
        heappush(b,-a[i])
    d[i-n]+=s
print(max(d))

Measured memory_bytes: 37212
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int [] count = new int [4];
        
        for(int i=0; i<6; i++){
            int tmp = sc.nextInt();
            count[tmp-1]++;
        }
        
        boolean judge = true;
        for(int i=0; i<4; i++){
            if(count[i]>2){
                judge = false;
                break;
            }
        }
        
        if(judge) System.out.println("YES");
        else System.out.println("NO");
    }
}


Measured memory_bytes: 35580
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>
#include <climits>
#include <ctime>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef double db;
#define lowbit(x) (x)&(-x)
#define gcd(a,b) __gcd(a,b)
#define sqre(x) (x)*(x)
#define mem(x,y) memset(x,y,sizeof(x))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
const int MaxN = 2e4 + 5;
const int inf = 1e8;
const double PI = acos(-1.0);
const LL mod = 100000007;

const int w = 1e4;
const int k = 5e3;
const int p = 1e3;
struct node{
	int cnt;
	int w,k,p;
	int sum(){
		return w+k+p;
	}
};

int main()
{
	int n,m;
	cin >> n >> m;
	if(m < (n*p) || m > (n*w)){
		cout << "-1" << " -1" << " -1" << endl; 
	}
	else{
		bool flag = true;
		for(int i = n ; i >= 0 && flag; i--)
			for(int j = n - i ; j >= 0 && flag; j--){
				int z = n - i - j;
				if(z < 0)continue;
				if(i*w + j*k + z*p == m){
					cout << i << " " << j << " " << z << endl;
					flag = false;
				}
			}
		if(flag)cout << "-1 -1 -1"<<endl;
	}
	return 0;
}

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

int main(void){
  int n, m;
  cin >> n >> m;
  int l[m], r[m];
  for(int i = 0; i < m; i++)
    cin >> l[i] >> r[i];
  sort(l, l + m);
  sort(r, r + m);
  int ans = r[0] - l[m-1] + 1;
  if(ans < 0) ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n, m; cin >> n >> m;
	vector<vint> adj(n+1);
	
	rep(i, m){
		int a, b; cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	vector<int> ans(n+1);
	fill(ans.begin(), ans.end(), -1);
	ans[1] = 0;
	queue<lpair> que;
	que.push({1, 0});	
	while(!que.empty()){
		lpair p = que.front(); que.pop();
		rep(i, adj[p.first].size()){
			int to = adj[p.first][i];
			if(ans[to] != -1) continue;
			ans[to] = p.first;
			que.push({to, ans[to]});
		}
	}

	rep2(i, 1, n+1){
		if(ans[1] == -1){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes" << endl;
	rep2(i, 2, n+1){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 13016
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<utility>


using namespace std;
typedef long long ll;
int main(){
ll h,w;
  cin>>h>>w;
char a[h][w];
  for(ll i=0;i<h;i++){
  for(ll j=0;j<w;j++){
  cin>>a[i][j];
  
  }
 
  }
  ll memoh=h;
  ll memow=w;
  ll nowh=0;
  ll noww=0;
char a2[h][w];
  for(ll i=0;i<h;i++){
    int flag=0;
  for(ll j=0;j<w;j++){
  if(a[i][j]=='#'){
  flag=1;
    break;
  }
  }
    if(flag==1){
    for(ll j=0;j<w;j++){
      a2[nowh][j]=a[i][j];
     
    }
       nowh++;
    }
  }
  char a3[h][w];
    for(ll i=0;i<w;i++){
    int flag=0;
  for(ll j=0;j<nowh;j++){
  if(a2[j][i]=='#'){
  flag=1;
    break;
  }
  }
    if(flag==1){
    for(ll j=0;j<nowh;j++){
      a3[j][noww]=a2[j][i];
     
    }
       noww++;
    }
  }
  
  
  
    for(ll i=0;i<nowh;i++){
  for(ll j=0;j<noww;j++){
  cout<<a3[i][j];
  }
      cout<<endl;
  }
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(void){
    char a[210],b[210],c[210];
    int H,h[110],i,j,n;
    while(1){
        scanf("%s",a);
        if(a[0]=='-')break;
        scanf("%d",&H);
        n=strlen(a);
        for(i=0;i<H;i++){
            scanf("%d",&h[i]);
        }
        for(i=0;i<H;i++){
            for(j=0;j<h[i];j++){
                b[j]=a[j];
                b[j+1]='\0';
            }
            for(j=h[i];j<=n-1;j++){
                c[j-h[i]]=a[j];
                c[j-h[i]+1]='\0';
            }
            strcat(c,b);
            strcpy(a,c);
            strcpy(b,"");
            strcpy(c,"");
        }
        printf("%s\n",a);
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll dp[2020][2020]; 

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll s; cin >> s;
    
    
    dp[0][0] = 1;
    
    rep(i, 0, 2000){
        ll x = 0;

        rep(j, 0, 2000){
            x += dp[i][j]; x %= MOD;

            dp[i + 1][j + 3] += x; dp[i + 1][j + 3] %= MOD;
        }
    }

    ll ans = 0;
    rep(i, 0, 2000){
        ans += dp[i][s]; ans %= MOD;
    }
    print(ans)
    
    return 0;
}

Measured memory_bytes: 35216
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#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 all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    map<int,int> ma;
    REP(i,n){
        int t;
        cin>>t;
        ma[t]++;
    }
    if(ma.size()>=3){
        cout<<"No"<<endl;
        return 0;
    }

    vp vec(2);
    int cnt=0;
    for(auto itr:ma){
        vec[cnt]=itr;
        cnt++;
    }
    REP(i,2){
        cerr<<vec[i].fi<<" "<<vec[i].se<<endl;
    }
    if(ma.size()==1){
        if(vec[0].fi+1==vec[0].se||vec[0].fi*2<=vec[0].se){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
        return 0;
    }
    if(vec[0].fi+1!=vec[1].fi){
        cout<<"No"<<endl;
        return 0;
    }
    if(vec[0].se<=vec[0].fi&&(vec[1].fi-vec[0].se)*2<=vec[1].se){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
struct Edge{
	int v,c,nxt;
}e[1000010];int tot=1;
int first[400010];
void build(int u,int v,int c)
{
	e[++tot]=(Edge){v,c,first[u]};
	first[u]=tot;
	return ;
}
void adde(int u,int v,int c)
{
	build(u,v,c);
	build(v,u,0);
	return ;
}
int dep[400010];
int S,T;
queue<int>q;
bool bfs()
{
	for(int i=1;i<=T;i++)
		dep[i]=0;
	q.push(S);dep[S]=1;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		for(int i=first[u];i;i=e[i].nxt)
			if(e[i].c&&!dep[e[i].v])
			{
				dep[e[i].v]=dep[u]+1;
				q.push(e[i].v);
			}
	}
	return dep[T]>0;
}
int cur[400010];
int dfs(int u,int flow)
{
	if(u==T)return flow;
	for(int &i=cur[u];i;i=e[i].nxt)
		if(e[i].c&&dep[e[i].v]==dep[u]+1)
		{
			int d=dfs(e[i].v,min(flow,e[i].c));
			if(d){
				e[i].c-=d;
				e[i^1].c+=d;
				return d;
			}
		}
	return 0;
}
int dinic()
{
	int ans=0;
	while(bfs())
	{
		for(int i=1;i<=T;i++)
			cur[i]=first[i];
		int d;
		while(d=dfs(S,1e9))
			ans+=d;
	}
	return ans;
}
vector<int>vec[100010];
int tos[100010],ton[100010];
int ansu[100010],ansv[100010];
bool book[100010];
void solve(int u)
{
	book[u]=true;
	for(int i=0;i<vec[u].size();i++)
	{
		int v=vec[u][i];
		if(v==tos[u])continue;
		if(book[ton[v]])continue;
		ansu[v]=u;
		ansv[v]=ton[v];
		solve(ton[v]);
	}
	return ;
}
int main()
{
	int n;scanf("%d",&n);
	S=n*2;T=n*2+1;
	for(int i=1;i<=n;i++)
		adde(S,i,1);
	for(int i=1;i<n;i++)
	{
		adde(i+n,T,1);
		int num;scanf("%d",&num);
		while(num--)
		{
			int u;scanf("%d",&u);
			vec[u].push_back(i);
			adde(u,i+n,1);
		}
	}
	if(dinic()<n-1){
		printf("-1\n");
		return 0;
	}
	int s=0;
	for(int u=1;u<=n;u++)
	{
		for(int i=first[u];i;i=e[i].nxt)
			if(!e[i].c&&e[i].v>n&&e[i].v<S){
				int v=e[i].v-n;
				tos[u]=v;
				ton[v]=u;
			}
		if(!tos[u])s=u;
	}
	solve(s);
	for(int i=1;i<n;i++)
		if(!ansu[i]){
			printf("-1\n");
			return 0;
		}
	for(int i=1;i<n;i++)
		printf("%d %d\n",ansu[i],ansv[i]);
	return 0;
}

Measured memory_bytes: 27264
// B - Palindromic Numbers
#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b; cin>>a>>b;
	int count = 0;
	for(int i=1; i<=9; ++i){
		for(int j=0; j<=9; ++j){
			for(int k=0; k<=9; ++k){
				int s = i*10000 + j*1000 + k*100 + j*10 + i;
				if(a<=s && s<=b) count++;
			}
		}
	}
	cout<< count <<endl;
}

Measured memory_bytes: 256
/*	[]__________[][][][]____[][][][][]__{}__[][][][]____[][][][][]__[][][][]
    []__________[]______________[]__________[]__________[]__________[]____[]
    []__________[][][][]________[]__________[][][][]____[]__________[]____[]
    []__________[]______________[]________________[]____[]__[][][]__[]____[]
    []__________[]______________[]________________[]____[]______[]__[]____[]
    [][][][]____[][][][]________[]__________[][][][]____[][][][][]__[][][][]
*/
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define endl '\n'
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define decimal(x) cout<<fixed<<setprecision(x);
bool prime[100005]; 
void Sieve(int n) {
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
} 
void solve()
{
    double d,t,s;
    cin>>d>>t>>s;
    if(d/s>t)
    cout<<"No";
    else
    {
        cout<<"Yes";
    }
    
}	
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
       //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 3736
N = int(input())
strings = {}
for i in range(N):
    s = ''.join(sorted(input()))
    if s in strings.keys():
        strings[s] += 1
    else:
        strings[s] = 1

ans = 0
for s in strings:
    x = strings[s]
    ans += x * (x-1) // 2

print(ans)


Measured memory_bytes: 22088
s = input()

a = 0
b = 1
ans_a = 0
ans_b = 0

for i in range(len(s)):
    if int(s[i]) != a:
        ans_a += 1
    else:
        ans_b += 1
    if a == 0:
        a = 1
        b = 0
    else:
        a = 0
        b = 1

print(min(ans_a, ans_b))

Measured memory_bytes: 3188