akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
string s;
string solve(){
	int card[5]={},t=0,num[14]={};
	for(int i=0;i<(int)s.length();i++){
		if(s[i]==',')t++;
		else card[t]=card[t]*10+s[i]-'0';
	}
	//for(int i=0;i<5;i++)cout<<card[i]<<endl;
	for(int i=0;i<5;i++)num[card[i]]++;
	sort(num,num+14,greater<int>());
	if(num[0]==4)return "four card";
	else if(num[0]==3&&num[1]==2)return "full house";
	else if(num[0]==3)return "three card";
	else if(num[0]==2&&num[1]==2)return "two pair";
	else if(num[0]==2)return "one pair";
	else{
		sort(card,card+5);
		if(card[0]==1&&card[1]==10&&card[2]==11&&card[3]==12&&card[4]==13)return "straight";
		for(int i=0;i<4;i++){
			if(card[i+1]-card[i]!=1)return "null";
		}
		return "straight";
	}
}
int main()
{
	while(getline(cin,s)){
		cout<<solve()<<endl;
	}
    return 0;
}

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

using namespace std;

int main(void)
{
  int x,a,b;

  cin>>x>>a>>b;

  if(a-b>=0)
  {
    cout<<"delicious"<<endl;
  }
  else
  {
    if(abs(a-b)<=x)
    {
      cout<<"safe"<<endl;
    }
    else
    {
      cout<<"dangerous"<<endl;
    }
  }    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  ll N;cin>>N;
  ll flag[] = {0,0,0,0,0};
  REP(i,N) {
    string a;
    cin>>a;
    if(a[0] == 'M')flag[0]++;
    if(a[0] == 'A')flag[1]++;
    if(a[0] == 'R')flag[2]++;
    if(a[0] == 'C')flag[3]++;
    if(a[0] == 'H')flag[4]++;
  }
  ll ans=0;
  // ans=flag[i]*flag[j]*flag[k]
  ans = flag[0]*flag[1]*flag[2] + flag[0]*flag[1]*flag[3] + flag[0]*flag[1]*flag[4] + flag[0]*flag[2]*flag[3] + flag[0]*flag[2]*flag[4] + flag[0]*flag[3]*flag[4] + flag[1]*flag[2]*flag[3] + flag[1]*flag[2]*flag[4] + flag[1]*flag[3]*flag[4] + flag[2]*flag[3]*flag[4];
  P(ans);
  return 0;
}


Measured memory_bytes: 384
//Heaplax
#include<bits/stdc++.h>
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n;
int main()
{
	re(n);
	printf("%d\n",(n-2)*180);
}


Measured memory_bytes: 256
//#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 50 + 5;
const int M = 1e5 + 5;
const ll OO = 1e18;
const int mod = 1e9 + 7;

int n,k,v[N],ans;

int solve(int a, int b) {

    if(a+1+n-b>k) return 0;

    int rem = k - (a+1+n-b);

    vector<int> x,y;

    int sum = 0;

    for (int i = 0; i <= a; ++i) {
        x.pb(v[i]);
        sum += x.back();
    }

    for (int i = n-1; i >= b; --i) {
        y.pb(v[i]);
        sum += y.back();
    }

    int ret = sum;

    sort(x.begin(),x.end());
    sort(y.begin(),y.end());

    for (int i = 0; i <= a+1; ++i) {
        for (int j = 0; j <= n-b; ++j) {

            if(rem<i+j) continue;

            int newRet = sum;

            for (int l = 0; l < i; ++l) {
                newRet -= x[l];
            }
            for (int k = 0; k < j; ++k) {
                newRet -= y[k];
            }

            ret = max(ret, newRet);

        }
    }

    return ret;

}

void init() {

}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k;

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

    for (int i = -1; i < n; ++i) {
        for (int j = i+1; j <= n; ++j) {
            ans = max(ans, solve(i,j));
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n;
    cin >> n;
    vector<vector<pair<int, int>>> v(n);
    rep(i, n) {
        int a;
        cin >> a;
        v[i].resize(a);
        rep(ii, a) {
            int x, y;
            cin >> x >> y;
            v[i][ii].first = x - 1;
            v[i][ii].second = y;
        }
    }
    int ans = 0;
    rep(i, 1 << n) {
        bool mujun = false;
        int cnt = 0;
        rep(ii, n) {
            if ((i & (1 << ii)) != 0) cnt++;
        }
        // printf("i=%d, cnt=%d\n", i, cnt);
        rep(ii, sz(v)) {
            if ((i & (1 << ii)) == 0) continue;
            rep(iii, sz(v[ii])) {
                if ((v[ii][iii].second == 1) != ((i & (1 << v[ii][iii].first)) != 0)) {
                    mujun = true;
                    break;
                }
                if ((v[ii][iii].second == 0) != ((i & (1 << v[ii][iii].first)) == 0)) {
                    mujun = true;
                    break;
                }
            }
            if (mujun) break;
        }
        if (!mujun) {
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#encoding utf-8
s = list(str(input()))
t = list(str(input()))

def str2num(words):
    used = []
    nums = []
    for i in range(len(words)):
        if words[i] in used:
            nums.append(used.index(words[i]))
        else:
            used.append(words[i])
            nums.append(used.index(words[i]))
    return nums


if str2num(s) == str2num(t):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9776
#include <stdio.h>
int main(void){
    char buf[25];
    
    scanf("%s",buf);
   
    char temp;
    for(int i=0;i<25;i++){
        if(4==i){
            temp=buf[i];
            buf[i]=' ';
        }else if(4 < i){
            int t=buf[i];
            buf[i] = temp;
            temp=t;
        }
    }
    printf(buf);
    printf("\n");
    
}


Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;
const ll MOD = 1000000007;

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

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

ll mod_add(ll a, ll b) {
    return (a + b) % MOD;
}

ll mod_sub(ll a, ll b) {
    return (a + MOD - b) % MOD;
}

ll mod_mul(ll a, ll b){
    return (a * b) % MOD;
}

ll mod_pow(ll base, ll po) {
    if(po == 0)
        return 1;
    else if(po == 1)
        return base;
    ll new_base = mod_pow(base, po / 2);
    return mod_mul(mod_mul(new_base, new_base), po % 2 == 0 ? 1 : base);
}

ll mod_div(ll a, ll b){
    return mod_mul(a, mod_pow(b, MOD - 2));
}

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    in_arr(double, v, n);
    sort(v.begin(), v.end());
    double sum = v[0];
    for(int i = 1; i < n; ++i) {
        sum = (v[i] + sum) / 2.0;
    }
    cout << sum << endl;
    return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        bool ok = s.Where(c => c == 'x').Count() <= 7;

        string answer = ok ? "YES" : "NO";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 26372
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  int array[100005];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  sort(array,array+n);
  
  cout<<array[n/2]-array[n/2-1]<<endl;
  return(0);
}

Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  int n, m;
  cin >> n;
  VL d(n);
  map<ll, int> freq;
  REP(i, 0, n) {
    cin >> d[i];
    freq[d[i]] += 1;
  }
  cin >> m;
  VL t(m);
  REP(i, 0, m) {
    cin >> t[i];
    freq[t[i]] -= 1;
  }
  bool ok = true;
  for (auto v: freq) {
    if (v.second < 0) {
      ok = false;
      break;
    }
  }
  cout << (ok ? "YES" : "NO") << endl;
}


Measured memory_bytes: 15872
import std.stdio;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.range;
import std.typecons;
import std.c.string;

alias Tuple!(int, "x", int, "y") Point;
alias Tuple!(Point, "start", Point, "goal", int, "counter") State;

const auto directions = [[1, 0], [-1, 0], [0, 1], [0, -1]];

int[] read_nums() {return readln.chomp.split(" ").map!(to!(int)).array;}

void main() {
  while(true) {
    int[] data = read_nums;
    int width = data[0];
    int height = data[1];
    if (width == 0 && height == 0) break;
    data = read_nums;
    Point start = Point(data[0], data[1]);
    data = read_nums;
    Point goal = Point(data[0], data[1]);
    int[][] field;
    bool[][][][] visit =
      new bool[][][][](height + 2, width + 2, height + 2, width + 2);
    State[] queue;
    int ans = -1;
    field ~= repeat(-1).take(width + 2).array;
    foreach(i; 0..height) {
      int[] nums = read_nums;
      field ~= [-1] ~ nums ~ [-1];
    }
    field ~= repeat(-1).take(width + 2).array;
    visit[start.y][start.x][goal.y][goal.x] = true;
    queue ~= State(start, goal, 0);
    while(!queue.empty) {
      State state = queue.front;
      queue.popFront;
      if (state.start == state.goal || state.counter >= 100) {
        ans = state.counter;
        break;
      }
      // auto tb = state.field;
      for(uint i = 0; i < directions.length; i++) {
        Point s = Point(state.start.x + directions[i][0],
                        state.start.y + directions[i][1]);
        Point g = Point(state.goal.x  - directions[i][0],
                        state.goal.y  - directions[i][1]);
        if (field[s.y][s.x] == 1 || field[s.y][s.x] == -1) s = state.start;
        if (field[g.y][g.x] == 1 || field[g.y][g.x] == -1) g = state.goal;
        if (!visit[s.y][s.x][g.y][g.x]) {
          visit[s.y][s.x][g.y][g.x] = true;
          queue ~= State(s, g, state.counter + 1);
        }
      }
    }
    writeln((ans == -1 || ans >= 100) ? "NA" : ans.to!(string));
  }
}

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


def main():
    """Function."""
    num = list(map(int, input().split()))
    k = int(input())

    max_num = max(num)
    rest = sum(num) - max_num
    for _ in range(k):
        max_num *= 2

    print(rest + max_num)


if __name__ == "__main__":
    main()


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

int main() {
    string S;
    cin >> S;

    for(int i = 0; i < 3 ; i++)
    {
        if(S[i] == S[i + 1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;  

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second

int h, w, x, y, inf = 1e5;
int vis[25][25], dirx[] = {0, 1, 0, -1}, diry[] = {1, 0, -1, 0};
string grid[25];

int bfs(int i, int j)
{
    int a, b, c, ret = 0;
    pair<pair<int, int>, int> p;
    queue<pair<pair<int, int>, int> > q;
    q.push({{i, j}, 0});
    vis[i][j] = 1;
    while(!q.empty())
    {
        p = q.front();
        q.pop();
//        cout << p.ff.ff << " " << p.ff.ss << endl;
        for(int k = 0; k < 4; k++)
        {
            a = p.ff.ff + dirx[k];
            b = p.ff.ss + diry[k];
            c = p.ss;

            if(a >= 0 && a < h && b >= 0 && b < w && grid[a][b] == '.' && vis[a][b] == 0)
            {
                q.push({{a, b}, c+1});
                vis[a][b] = 1;
                ret = max(ret, c+1);
            }
        }
    }
    return ret;
}

int main()
{
//    freopen("in.txt", "r", stdin);
    int i, j;
    cin >> h >> w;
    for(i = 0; i < h; i++)
        cin >> grid[i];

    int ans = 0;

    for(i = 0; i < h; i++)
    {
        for(j = 0; j < w; j++)
        {
            if(grid[i][j] == '#')
                continue;
            memset(vis, 0, sizeof(vis));
//            cout << "new: " << i << " " << j << endl;
            ans = max(ans, bfs(i, j));
        }
    }

    cout << ans;
}


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

using namespace std;
using ll = long long;
static ll INF = 1000000000000000000ll;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	ll d;
	cin >> n >> d;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	vector<ll> b(n + 1);
	b[n] = 1;
	for(int i = n - 1; i >= 0; --i){
		if(a[i] >= b[i + 1] * 2){
			b[i] = b[i + 1];
		}else if(a[i] - b[i + 1] >= b[i + 1]){
			b[i] = a[i] - b[i + 1];
		}else{
			b[i] = b[i + 1] + a[i];
		}
	}
	vector<ll> c(n + 1);
	c[0] = d;
	for(int i = 0; i < n; ++i){
		c[i + 1] = min(c[i], llabs(c[i] - a[i]));
	}
	int q;
	cin >> q;
	while(q--){
		int i;
		cin >> i;
		--i;
		cout << (c[n] != 0 || c[i] >= b[i + 1] ? "YES" : "NO") << "\n";
	}
	return 0;
}



Measured memory_bytes: 13696
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-9;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll x;cin>>x;
    ll sum=0;
    rep(i,1,1000000000){
        sum+=i;
        if(sum>=x){
            cout<<i<<endl;
            return 0;
        }
    }
}










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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

// clang-format off
template<typename T>
bool chmax(T& a, const T& b) {if (a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a, const T& b) {if (a>b){a=b;return true;}return false;}
// clang-format on

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int r;
    cin >> r;
    print(3 * r * r);

    return 0;
}


Measured memory_bytes: 256
N=int(input())
d={0:0,1:0,2:0}
def cnt(i):
    i=int(i)
    d[0 if i%2 else(1 if i%4 else 2)]+=1
list(map(cnt,input().split()))
print((d[0]>d[2]and (d[0]+d[2]!=N or d[0]!=d[2]+1) if N%2 else d[0]>d[2]) and"No"or"Yes")

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

using namespace std;
using ll = long long;

const int MAXN = 200005;

int rmax[200005];
int lmax[200005];

map<int, int> m;

string s;
int n, k, c;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n>>k>>c;
    cin>>s;

    for(int i=0;i<n;i++){
        if(s[i] == 'x') {if(i>0) lmax[i] = lmax[i-1];}
        else if(i-c-1>=0){
            lmax[i] = max(lmax[i-1], lmax[i-c-1]+1);
        }else {
            lmax[i] = 1;
        }
    }

    for(int i=n-1;i>=0;i--){
        if(s[i] == 'x') rmax[i] = rmax[i+1];
        else if(i+c+1<n) rmax[i] = max(rmax[i+1], rmax[i+c+1]+1);
        else rmax[i] = 1;
    }
    for(int i=0;i<n;i++){
        int curr = 0, l_crit;
        if(s[i] == 'x') continue;
        if(i-c-1>=0){
            curr += lmax[i-c-1];
            l_crit = lmax[i-c-1];
        }else l_crit = 0;
        if(i+c+1<n) curr += rmax[i+c+1];
        curr++;
        if(curr==k){
            if(m[l_crit]==0){
                m[l_crit] = i+1;
            }else{
                m[l_crit] = -1;
            }
        }
    }
    for(auto z: m){
        if(z.second>0)
            cout<<z.second<<'\n';
    }
    return 0;
}

Measured memory_bytes: 12692
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@c = gets.split.map(&:to_i)
    @d = Array.new(c){ gets.split.map(&:to_i) }
    @a = Array.new(n){ gets.split.map(&:to_i).map{_1-1} }
  end

  def init
    @dp = Array.new(3){ Array.new(c,0) }
    c.times do |i|
      n.times do |y|
        n.times do |x|
          j = a[y][x]
          @dp[(y+x)%3][i] += d[j][i]
        end
      end
    end
  end

  def solve
    init
    ans = 10**15
    c.times do |i|
      c.times do |j|
        next if i == j
        c.times do |k|
          next if i == k
          next if j == k
          v = @dp[0][i] + @dp[1][j] + @dp[2][k]
          ans = v if ans > v
        end
      end
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
  # pp self
end

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

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll w, h, n;
  cin >> w >> h >> n;
  ll minx = 0, maxx = w, miny = 0, maxy = h;
  rep(i, n) {
    ll x, y, a;
    cin >> x >> y >> a;
    if (a == 1) chmax(minx, x);
    if (a == 2) chmin(maxx, x);
    if (a == 3) chmax(miny, y);
    if (a == 4) chmin(maxy, y);
  }

  if (minx >= maxx || miny >= maxy) cout << 0 << endl;
  else cout << (maxx - minx) * (maxy - miny) << endl;

  return 0;
}


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

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

    int n;
    cin>>n;
    int x,y;
    vector<pair<int,int>> a(n);
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        a[i] = make_pair(x,y);
    }
    int flag = 0;
    for(int i=0;i<n-2;i++)
    {
        if(a[i].first==a[i].second)
        {
            if(a[i+1].first==a[i+1].second)
            {
                if(a[i+2].first==a[i+2].second)
                {
                    flag = -1;
                    break;
                }
            }
        }
    }
    if(flag==-1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 3648
N = int(input())
d = [tuple(map(int, input().split())) for i in range(N)]

c = 0
for i in range(N):
  if d[i][0] == d[i][1]:
    c += 1
  else:
    c = 0
  if c == 3:
    print('Yes')
    exit()

print('No')

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

const int INF = 1001001001;

int main() {
    int n,x,y;
    cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n);
    rep(sv,n) {
        vector<int> dist(n, INF);
        queue<int> q;
        auto push = [&](int v, int d) {
            if (dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv, 0);
        while(!q.empty()) {
            int v = q.front(); q.pop();
            int d = dist[v];
            if (v-1 >= 0) push(v-1, d+1);
            if (v+1 < n) push(v+1, d+1);
            if (v == x) push(y, d+1);
            if (v == y) push(x, d+1);
        }
        rep(i,n) ans[dist[i]]++;
    }
    rep(i,n) ans[i] /= 2;
    for (int i = 1; i <= n-1; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int x,y;
  cin>>x>>y;
  vector<int> vec(x);
  rep(i,x){
    cin>>vec[i];
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int sum=0;
  rep(j,x){
    sum+=vec[j];
  }
  if(sum%4==0&&vec[y-1]>=sum/(4*y)){
    cout<<"Yes";
  }
  else if(vec[y-1]>sum/(4*y)){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main(){
    string s,ans;
    cin >> s;

    if(s[0] != s[1] || s[1] != s[2]){
        ans = "Yes";
    }else ans = "No";

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fore(a,b,c) for(int a = b; a < c; a++)
using namespace std;

typedef long long ll;
const int N = 405;
ll n, a[N], dp[N][N], parcial[N];

ll sum(int l, int r) {
    if (l == 0) return parcial[r];
    return parcial[r] - parcial[--l];
}

ll solve(int l, int r) {
    if (l == r) return 0;
    ll &res = dp[l][r];
    if (res != -1) return res;
    res = 1e18;
    fore(i,l, r) {
        res = min(res, solve(l, i) + solve(i+1, r) + sum(l,r));
    }

    return res;
}

int main() {
    cin >> n;
    fore(i,0,n) cin >> a[i];
    parcial[0] = a[0];
    fore(i,1,n) {
        parcial[i] = parcial[i-1] + a[i];
    }
    fore(i,0,n)fore(j,0,n)dp[i][j]=-1;

    cout << solve(0, n-1) << endl;

}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <queue>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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


using namespace std;

bool is_integer( float x ){
    return floor(x)==x;
}


int main() {
    int n,l; cin >> n >> l;
    string s[101];
    
    rep(i,n) cin >> s[i];
    sort(s,s+n);
    rep(i,n) cout << s[i];
    return 0;
}











Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  int a[n];
  int sum=0;
  int count=1;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum+=a[i];
    if(sum<=x){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);
typedef long long ll;
using namespace std;
int main(){
    IOS;
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x<<endl;
        return 0;
    }
    vector<int>v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    sort(v.begin(),v.end());
    int i,j,pos,nex;
    auto it=lower_bound(v.begin(),v.end(),x);
     i=j=it-v.begin();
     pos=nex=x;
    while(i<n){
        if(v[i]!=pos){
            break;
        }
        else{
            i++,pos++;
        }
    }
    while(j>=0){
        if(v[j]!=nex){
            break;
        }
        else{
            j--,nex--;
        }
    }
    if((x-nex)<=(pos-x)){
        cout<<nex<<endl;
    }
    else{
        cout<<pos<<endl;
    }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	cout<<(s=="ABA"||s=="BBA"||s=="ABB"||s=="AAB"||s=="BAA"||s=="BAB"?"Yes":"No")<<endl;
	return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());

  if (s < t)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


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

int main() {
    string S;
    cin >> S;
    int counter = 0;
  for(int i = 0;i < (S.length() / 2);i += 1){
    if(S[i] == S[S.length() - 1 - i]){
    }else{
     
      counter += 1;
      
    }
    
    
  }
   
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  long int K,A,B,amari=0;
  scanf("%ld %ld %ld",&K,&A,&B);
  if((K-A+1)%2 == 1)amari=1;
  if(A>=B || 1+(K-2) < A || B-A==1){
    printf("%ld\n",1+K);
    return 0;
  }
  else{
    printf("%ld\n",A-1 + ((K-A+1)/2)*(B-A) + amari+1);
  }
}


Measured memory_bytes: 128
/**
*    author:  souzai32
*    created: 14.08.2020 22:10:29
**/

#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
typedef long long ll;
using namespace std;

int main() {

    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<char>> s(h,vector<char>(w));
    vector<int> st(h,0);
    rep(i,h){
        rep(j,w){
            cin >> s.at(i).at(j);
            if(s.at(i).at(j)=='#') st.at(i)++;
        }
    }

    vector<vector<int>> ans(h,vector<int>(w));
    int num=1;
    for(int i=0; i<h; i++){
        if(st.at(i)){
            for(int j=0; j<w; j++){
                ans.at(i).at(j)=num;
                if(s.at(i).at(j)=='#'){
                    st.at(i)--;
                    if(st.at(i)) num++;
                }
            }
            num++;
        }
    }
    for(int i=1; i<h; i++){
        if(ans.at(i).at(0)==0){
            for(int j=0; j<w; j++) ans.at(i).at(j)=ans.at(i-1).at(j);
        }
    }
    for(int i=h-2; i>=0; i--){
        if(ans.at(i).at(0)==0){
            for(int j=0; j<w; j++) ans.at(i).at(j)=ans.at(i+1).at(j);
        }
    }

    rep(i,h){
        rep(j,w-1) cout << ans.at(i).at(j) << ' ';
        cout << ans.at(i).at(w-1) << endl;
    }
    return 0;
}

Measured memory_bytes: 4068
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;


int main() {

    int N;
    cin >> N;
    long Y;
    cin >> Y;

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N - i; j++) {
            if (10000 * i + 5000 * j == Y - (1000 * (N - i - j))) {
                cout << i << " " << j << " " << (N - i - j) << "\n";
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << "\n";
    return 0;

}

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

int main() {
  int a, b;
  cin >> a >> b;
  if ( a >= b ) {
    for (int i = 0; i < a; i++) {
      cout << b;
    }
  }
  else {
    for (int i = 0; i < b; i++) {
      cout << a;
    }
  }
}

  

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

int main(){

  int N;
  cin >> N;
  int p[N];
  for(int i=0; i< N; i++){
    cin >> p[i];
  }
  sort(p, p+N);
  p[N-1] = p[N-1] / 2;
  int ans;
  ans = accumulate(p, p+N, 0);
  cout << ans << endl;
}

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

using namespace std;

int main(){

    char a[10], s[10];
    cin >> a;
    int cnt = 0;

    for(int i = 0; a[i] == '0' || a[i] == '1' || a[i] == 'B'; i++){
        if(a[i] == '0') {
            s[cnt] = '0';
            cnt++;
        }
        if(a[i] == '1'){
          s[cnt] = '1'; 
          cnt++;
        } 
        if(a[i] == 'B') {
            if(cnt != 0)cnt--;
        } 
    }

    for(int i = 0; i < cnt; i++) cout << s[i];

}

Measured memory_bytes: 256
N = int(input())

cnt = 0
ans = "No"

for i in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        ans = "Yes"
        break

print(ans)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
i64 gcd(i64 a, i64 b) { if (a % b == 0) return b; else return gcd(b, a % b); }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
template <class T> bool amax(T &x, T y) { if (x < y) { x = y; return 1; } else return 0; }
template <class T> bool amin(T &x, T y) { if (x > y) { x = y; return 1; } else return 0; }
template <class T> i64 lbi(vector<T> &v, T e) { return lower_bound(all(v), e) - v.begin(); }
template <class T> i64 ubi(vector<T> &v, T e) { return upper_bound(all(v), e) - v.begin(); }

int main() {
  ioinit();
  int n, k;
  string s;
  cin >> n >> k >> s;
  vi32 c;
  {
    int t = 1, cnt = 0;
    rep(i, n) {
      if (s[i] - '0' != t) {
        c.push_back(cnt);
        cnt = 1; t = 1 - t;
      } else {
        cnt++;
      }
    }
    c.push_back(cnt);
    if (t == 0) c.push_back(0);
  }
  {
    int n = c.size();
    vi32 sums(n + 1);
    partial_sum(all(c), sums.begin() + 1);
    int rng = k * 2 + 1;
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
      int l = i, r = min(n, i + rng);
      amax(ans, sums[r] - sums[l]);
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1272
import java.io.*;
import java.util.*;
 
public class Main{
	class Query{
		int idx;
		int a;
		int b;
		public Query(int idx, int a, int b){
			this.idx = idx;
			this.a = a;
			this.b = b;
		}
	}
	
	int N;
	int[] X;
	int L;
	int Q;
	Query[] AB;
	int[][] Xn;
	public void solve(){
		N = nextInt();
		X = new int[N];
		for(int i = 0; i < N; i++){
			X[i] = nextInt();
		}
		L = nextInt();
		Q = nextInt();
		AB = new Query[Q];
		for(int i = 0; i < Q; i++){
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			
			AB[i] = new Query(i, Math.min(a, b), Math.max(a, b));
		}
		

		Xn = new int[N][20];
		int nn = 0;
		for(int i = 0; i < N; i++){
			while(nn < N && X[nn] - X[i] <= L) nn++;
			Xn[i][0] = nn - 1;
		}
		for(int d = 1; d < Xn[0].length; d++){
			for(int i = 0; i < N; i++){
				Xn[i][d] = Xn[Xn[i][d - 1]][d - 1];
			}
		}
		
		for(int i = 0; i < Q; i++){
			int ans = 0;
			out.println(count(AB[i].a, AB[i].b));
		}
	}
	
	public int count(int a, int b){
		if(a == b){
			return 0;
		}
		if(Xn[a][0] >= b){
			return 1;
		}
		int base = 1;
		for(int d = 1; d < Xn[a].length; d++){
			if(Xn[a][d] >= b){
				return base + count(Xn[a][d-1], b);
			}
			base *= 2;
		}
		throw new RuntimeException();
	}
	
	public long f(long b, long n){
		if(n < b){
			return n;
		}else{
			return f(b, n / b) + n % b;
		}
	}
	
	
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

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

using namespace std;

int main(void)
{
    int a, b;
    int ans = 0;

    cin >> a >> b;

    ans = a + b;
    if (ans < a - b) ans = a-b;
    if (ans < a * b) ans = a*b;
    
    cout << ans;

    return 0;
}


Measured memory_bytes: 888
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(_r io.Reader, _w io.Writer) {
	var s []byte
	var k int8
	Fscan(bufio.NewReader(_r), &s, &k)
	n := len(s)
	dp := make([][]int, n)
	for i := range dp {
		dp[i] = make([]int, k)
		for j := range dp[i] {
			dp[i][j] = -1
		}
	}
	var f func(p int, sum int8, isUpper bool) int
	f = func(p int, sum int8, isUpper bool) (cnt int) {
		if sum == k {
			return 1
		}
		if p >= n {
			return 0
		}
		dv := &dp[p][sum]
		if !isUpper && *dv >= 0 {
			return *dv
		}
		defer func() {
			if !isUpper {
				*dv = cnt
			}
		}()
		up := byte('9')
		if isUpper {
			up = s[p]
		}
		cnt += f(p+1, sum, isUpper && '0' == up)
		for digit := byte('1'); digit <= up; digit++ {
			cnt += f(p+1, sum+1, isUpper && digit == up)
		}
		return
	}
	Fprint(_w, f(0, 0, true))
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 640
#include <iostream>

int main(){
	int n, m;
	int participant[1001];
	while(std::cin >> n>>m, n+m){
		int begin=1;
		int dummy = 0;
		for(int i=0;i<=n;++i)participant[i]=1;
		while(1){
			int cnt=0;
			A:;
			int coun = 0;
			for(int i = 1; i <= n; ++i)coun += participant[i];
			if(coun == 1){
				break;
			}
			for(int j=(begin!=1?begin:1);j<=n;++j){
				cnt += participant[j];
				if(cnt==m){
					participant[j]=0;
					begin=j;
					//std::cout<<j<<std::endl;
					break;
				}
				begin=1;
			}
			if(cnt!=m)goto A;
		}
		for(int i=1;i<=n;++i){
			if(participant[i])std::cout<<i<<std::endl;
		}
	}
}

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

using ll = long long;
using pii = pair<int, int>;

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

constexpr double pi = acos(-1.0);


int main() {
    int N; cin >> N;
    vector<double> x(N), y(N);
    for(int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }

    const int Limit = 300000;
    vector<double> ans(N);
    for(int i_ = 0; i_ < Limit; ++i_) {
        const double rad = pi * 2 / Limit * i_;
        double best = -inf<double>;
        int j = 0;
        for(int i = 0; i < N; ++i) {
            double d = sin(rad) * x[i] + cos(rad) * y[i];
            if(best < d) {
                best = d;
                j = i;
            }
        }
        ans[j] += 1;
    }

    cout << fixed << setprecision(10);
    for(auto a : ans) {
        cout << a / Limit << endl;
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <numeric>
#include <algorithm>
#include <stack>
#include <map>
using namespace std;
string S;
int n;
int main() {
    int D, N; cin >> D >> N;
    if(D==0&&N==100){
        cout << 101 << endl;
    }else if(D==1&&N==100){
        cout << 10100 << endl;
    }else if(D==2&&N==100){
        cout << 1010000 << endl;
    }else{
    cout << (int)pow(100, D)*N << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long int 	ll;
typedef pair<int,int>   ii;
typedef vector< ii >   vii;
typedef vector<int>     vi;
typedef vector< vi >   vvi;

#define mm 100005
#define nn 1005
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define cases int t;  cin>>t;   while(t--)
#define check(a,n) forn(iiii,int(n)) cout<<int(a[iiii])<<" "; cout<<endl
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    int a,b;
    cin>>a>>b;
    if((a+b)%3==0||a%3==0||b%3==0)
        cout<<"Possible";
    else
        cout<<"Impossible";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
const double PI=3.14159265358979323846;
 
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {

	int n, y;

	cin >> n >> y;

	int a = 0;

	rep(i, n + 1) {
		rep(j, n + 1) {
			a = (y - 10000*i - 5000*j) / 1000;
			if (0 <= a && n == i + j + a) {
				cout << i << ' ' <<  j << ' ' << a << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>

using namespace std;
int main()
{
	string S;
	long long K;
	cin >> S >> K;

	int a = 0;

	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '1') a = i;
		else break;
	}

	if (S[0] != '1') cout << S[0];

	else if (S.size() == a + 1) cout << 1;
	else if (a >= K - 1) cout << 1;
	else cout << S[a + 1];

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
typedef  long long  ll;
const int maxn = 2e4 + 5;
const int inf = 0x3f3f3f3f;
int n, a[maxn];
set<int> st;
void get_front(int i, int j) {
    if (j==0) st.insert(a[i]);
    else if (i>0 && j==1) st.insert(a[i]+a[i-1]*10);
    else if (i>1 && j==2) st.insert(a[i]+a[i-1]*10+a[i-2]*100);
    else if (i>2 && j==3) st.insert(a[i]+a[i-1]*10+a[i-2]*100+a[i-3]*1000);
}
int main() {
while (~scanf("%d", &n)) {
    st.clear();
    for (int i=0; i<n; i++) {
        scanf("%d", &a[i]);
        get_front(i, 0);
    }
    int now = -1;
    for (set<int>::iterator it=st.begin(); it!=st.end(); ++it) {
        if (*it - now != 1) {
            printf("%d\n",now+1);
            goto label;
        }
        now = *it;
    }
    for (int i=0; i<n; i++) {
        get_front(i, 1);
    }
    now = -1;
    for (set<int>::iterator it=st.begin(); it!=st.end(); ++it) {
        if (*it - now != 1) {
            printf("%d\n",now+1);
            goto label;
        }
        now = *it;
    }
    for (int i=0; i<n; i++) {
        get_front(i, 2);
    }
    now = -1;
    for (set<int>::iterator it=st.begin(); it!=st.end(); ++it) {
        if (*it - now != 1) {
            printf("%d\n",now+1);
            goto label;
        }
        now = *it;
    }
    for (int i=0; i<n; i++) {
        get_front(i, 3);
    }
    now = -1;
    for (set<int>::iterator it=st.begin(); it!=st.end(); ++it) {
        if (*it - now != 1) {
            printf("%d\n",now+1);
            goto label;
        }
        now = *it;
    }
label: continue;
}
    return 0;
}

Measured memory_bytes: 3264
#include<stdio.h>

typedef struct Card{
	char suit;
	char value;
} Card;

void bubbleSort(int n, Card* C){
	int i, j;
	Card tmp;

	for(i = 0; i < n ; i++){
		for(j = n-1; j > i; j--){
			if(C[j].value < C[j-1].value){
				tmp = C[j];
				C[j] = C[j-1];
				C[j-1] = tmp;
			}
		}
	}
}
void selectionSort(int n, Card* C){
	int i, j, min;
	Card tmp;

	for(i = 0; i < n; i++){
		min = i;
		for(j = i; j < n; j++){
			if(C[j].value < C[min].value)
				min = j;
		}
		if(min != i){
			tmp = C[i];
			C[i] = C[min];
			C[min] = tmp;
		}
	}

}

void print(int n, Card* C){
	int i;
	for(i = 0; i < n; i++){
		printf("%c%c", C[i].suit, C[i].value);
		(i != n-1) ? printf(" ") : printf("\n");
	}

}
//stable check
int check(int n, Card* C1, Card* C2){
	int i;
	for(i = 0; i < n; i++)
		if(C1[i].suit != C2[i].suit)
			return 0;

	return 1;
}

void copy(int n, Card* C1, Card* C2){
	int i;

	for(i = 0; i < n; i++){
		C2[i].suit = C1[i].suit;
		C2[i].value = C1[i].value;
	}
	

}

int main(){
	Card C1[101], C2[101];
	int n, i;
	char ch;

	scanf("%d%c", &n, &ch);
	for(i = 0; i < n; i++)
		scanf("%c%c%c", &C1[i].suit, &C1[i].value, &ch);

	copy(n, C1, C2);
	bubbleSort(n, C1);
	print(n, C1);
	printf("Stable\n");
	selectionSort(n, C2);
	print(n, C2);
	(check(n, C1, C2)) ? printf("Stable\n") : printf("Not stable\n");


	return 0;
}

Measured memory_bytes: 612