akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int A, B;

int K;

int sol(){
	if(A == B) return 1;
	if((A+B) % 2) return 0;
	else{
		K = (A + B)/2;
		if( abs(A - K) == abs(B - K) ) return 1;
	}
	return 0;
}

int main(){
	cin >> A >> B;
	if(sol()) cout << K;
	else cout << "IMPOSSIBLE";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int z1;
string z;
int main()
{
    cin>>z;
    for(int i=0; i<z.size(); i++)
    {
        if(z[i]=='C') z1=1;
        if(z1==1 && z[i]=='F')
        {
            cout<<"Yes"<<endl;
            return 0; 
        }
    }
    cout<<"No"<<endl;             
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>

using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

void precalc() {}

//#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 5e5 + 10;

vector<int> vals;

int n;

bool check_bit(int bt) {
    vector<int> crr;
    int mod = 1 << (bt + 1);

    for (int i = 0; i < n; ++i) {
        crr.push_back(vals[i] % mod);
    }

    ll cnt = 0;

    sort(crr.begin(), crr.end());

    for (int i = 0; i < n; ++ i){

        int min = 0;
        int max = 0;

        int left = -1;
        int right = n;

        while (right - left > 1){
            int mid = (left + right) >> 1;

            if (crr[i] + crr[mid])

        }


        cnt += max - min + 1;

    }

    return cnt % 2 == 1;
}

void solve() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int curr;
        cin >> curr;
        vals.push_back(curr);
    }

    int answr = 0;

    for (int k = 0; k < 25; ++k) {
        if (check_bit(k)) {
            answr |= 1 << k;
        }
    }

    cout << answr << "\n";
}

#else

void solve() {

    ll a, b, m;
    cin >> a >> b >> m;

    ll answr = 1e18;

    vector<ll> ai;

    for (int i = 0; i < a; ++i) {
        ll curr;
        cin >> curr;

        ai.push_back(curr);
    }

    vector<ll> bi;

    for (int i = 0; i < b; ++i) {
        ll curr;
        cin >> curr;

        bi.push_back(curr);
    }

    vector<pair<pair<ll, ll>, ll>> mi;

    for (int i = 0; i < m; ++i) {
        ll x, y, c;
        cin >> x >> y >> c;
        --x;
        --y;

        answr = min(answr, ai[x] + bi[y] - c);
    }

    sort(ai.begin(), ai.end());
    sort(bi.begin(), bi.end());
    answr = min(ai[0] + bi[0], answr);

    cout << answr;
}

#endif

void multisolve() {
    int t;
    cin >> t;

    while (t--)
        solve();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

    precalc();

#ifdef multi
    multisolve();
#else
    solve();
#endif

#ifdef LOCAL
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 2548
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c; cin >> a >> b >> c;
  int st = 0;
  st += c / (a + b) * (a + b);
  c -= st;
  int up = 0;
  FOR(i,0,1000) {
    if(up + a >= c) {
      cout << st + c << endl;
      return 0;
    }
    if(up + a < c && up + a + b > c) c += 60;
    up += a + b;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){	
	int n,k;
	cin>>n>>k;
	vi a(n+2,0);
	rep(i,n){
		int z;cin>>z;
		a[z]++;
	}
	sort(allr(a));

	int cnt=0;
	FOR(i,0,n){
		cnt+=a[i]>0;
	}

	int ans=0;
	FOR(i,k,cnt-1){
		ans+=a[i];
	}

	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 4824
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

vector<ll> dp;
vector<vector<ll> > dp2(2);

ll rec(int d, int roc, int s) {
	if(dp2[d][roc] != -1) return dp2[d][roc];
	if(roc < s) {
		if(d == 0) return dp2[0][roc] = 0;
		else return dp2[1][roc] = dp[roc];
	} else {
		if(d == 0) return dp2[0][roc] = rec(1, roc - s, s);
		else return dp2[1][roc] = dp[roc] - rec(1, roc - s, s);
	}
}

int main(void) {
	int n, k;
	cin>>n>>k;
	vector<ll> a(n);
	REP(i, n) cin>>a[i];
	dp.resize(k);
	dp[0] = 1;
	REP(i, n) {
		REP(j, k) {
			if((k - 1 - j) - a[i] >= 0) dp[(k - 1 - j)] += dp[(k - 1 - j) - a[i]];
		}
	}
	ll cnt = 0;
	REP(i, n) {
		if(a[i] >= k) {
			++cnt;
			continue;
		}
		dp2[0].resize(0);
		dp2[0].resize(k);
		dp2[1].resize(0);
		dp2[1].resize(k);
		REP(j, k) dp2[0][j] = dp2[1][j] = -1;
		FOR(j, k - a[i], k) {
			if(rec(1, (int)j, (int)a[i]) != 0) {
				++cnt;
				break;
			}
		}
	}
	cout<<n - cnt<<endl;
}


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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int main() {
	ios :: sync_with_stdio(0);

	char ans = 'A';
	for(char a, b; cin >> a >> b >> b; ) {
		if(a == ans)
			ans = b;
		else if(b == ans)
			ans = a;
	}
	cout << ans << '\n';

	return 0;
}

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

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			Dice d = new Dice(1, 2, 4);
			for (int i = 0; i < N; ++i) {
				char command = sc.next().charAt(0);
				if (command == 'n') {
					d.rollN();
				} else if (command == 'w') {
					d.rollW();
				} else if (command == 's') {
					d.rollS();
				} else {
					d.rollE();
				}
			}
			System.out.println(d.top());
		}
	}

	static class Dice {
		int[] val = new int[6]; // top, north, east, south, west, bottom

		Dice(int top, int north, int east) {
			val[0] = top;
			val[1] = north;
			val[2] = east;
			val[3] = 7 - north;
			val[4] = 7 - east;
			val[5] = 7 - top;
		}

		Dice(int[] val) {
			if (val[0] + val[5] != 7 || val[1] + val[3] != 7 || val[2] + val[4] != 7) throw new RuntimeException();
			for (int i = 0; i < 6; ++i) {
				this.val[i] = val[i];
			}
		}

		void rollN() {
			int tmp = north();
			this.val[1] = this.val[0];
			this.val[0] = this.val[3];
			this.val[3] = this.val[5];
			this.val[5] = tmp;
		}

		void rollS() {
			int tmp = south();
			this.val[3] = this.val[0];
			this.val[0] = this.val[1];
			this.val[1] = this.val[5];
			this.val[5] = tmp;
		}

		void rollE() {
			int tmp = east();
			this.val[2] = this.val[0];
			this.val[0] = this.val[4];
			this.val[4] = this.val[5];
			this.val[5] = tmp;
		}

		void rollW() {
			int tmp = west();
			this.val[4] = this.val[0];
			this.val[0] = this.val[2];
			this.val[2] = this.val[5];
			this.val[5] = tmp;
		}

		public boolean equals(Object o) {
			if (!(o instanceof Dice)) return false;
			return Arrays.equals(this.val, ((Dice) o).val);
		}

		public int hashCode() {
			return Arrays.hashCode(this.val);
		}

		public Dice clone() {
			return new Dice(this.val);
		}

		int top() {
			return this.val[0];
		}

		int bottom() {
			return this.val[5];
		}

		int north() {
			return this.val[1];
		}

		int south() {
			return this.val[3];
		}

		int east() {
			return this.val[2];
		}

		int west() {
			return this.val[4];
		}

	}

}

Measured memory_bytes: 12000
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        int h,w,i,j;
        Scanner s = new Scanner(System.in);
        while(true){
            h = s.nextInt();
            w = s.nextInt();
            if(h==0&&w==0)break;
            for(i=0;i<h;i++){
                for(j=0;j<w;j++){
                    System.out.print("#");
                }
                System.out.println();
            }
System.out.println();
        }
    }
}


Measured memory_bytes: 35576
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = (int)s.size();

	ll ans = 0;
	rep(bit, 0, 1 << n - 1) {
		vector<int> ids;
		ids.push_back(-1);
		rep(j, 0, n - 1) 
			if (bit >> j & 1) ids.push_back(j);
		ids.push_back(n - 1);

		rep(i, 0, ids.size() - 1) 
			ans += atoll(s.substr(ids[i] + 1, ids[i + 1] - ids[i]).c_str());
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<iomanip>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int N;
    ll x;
    cin >> N >> x;
    ll a[N];
    rep(i,N) cin >> a[i];
    ll ans=0;
    if(a[0]>x){
        ans = a[0]-x;
        a[0] = x;
    }
    for(int i=1; i<N; i++){
        if((a[i-1]+a[i])>x){
            ll sub = (a[i-1]+a[i])-x;
            ans += sub;
            a[i] -= sub;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.

int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	string s,t;
	cin>>s;
	cin>>t;
	LL n = s.length();
	LL cnt = 0;
	rep(i,0,n){
		if(s[i] != t[i])
			cnt++;
	}

	cout<<cnt;
  	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    string t="keyence";
    ll n=s.length();
    for(ll l=0;l<n;l++){
        for(ll r=l;r<n;r++){
            string ans=s.substr(0,l)+s.substr(r,n-r);
            if(ans==t){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3640
l, r = map(int, input().split())
if r // 3 > (l - 1) // 3 and r // 673 > (l - 1) // 673:
    print(0)
else:
    print(min(i * j % 2019 for i in range(l, r + 1) for j in range(l, i)))


Measured memory_bytes: 2940
def main():
    n, m = map(int, input().split())
    ans = [-1] * n

    for i in range(m):
        s, c = map(int, input().split())

        if ans[s - 1] != -1:
            if ans[s - 1] != c:
                print(-1)
                exit()

        if n != 1 and s == 1 and c == 0:
            print(-1)
            exit()

        ans[s - 1] = c

    for i in range(n):
        if ans[i] == -1:
            if n == 1:
                ans[i] = 0
            else:
                if i == 0:
                    ans[i] = 1
                else:
                    ans[i] = 0

    print(*ans, sep="")


if __name__ == "__main__":
    main()


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll H, W, N, sr, sc;
  string S, T;
  cin >> H >> W >> N >> sr >> sc >> S >> T;
  ll sumx = sr;
  ll sumy = sc;
  bool takawin = false;
  for(ll i = 0; i < N; i++) {
    if(S[i] == 'R') { sumy++; }
    if(S[i] == 'D') { sumx++; }
    // cout << sumx << ' ' << sumy << endl;
    if(sumx > H || sumy > W) {
      // cout << "win" << endl;
      takawin = true;
      break;
    }
    if(T[i] == 'L') { sumy--; }
    if(T[i] == 'U') { sumx--; }
    if(sumx < 1) sumx = 1;
    if(sumy < 1) sumy = 1;
    // cout << sumx << ' ' << sumy << endl;
  }
  // cout << endl;
  sumx = sr;
  sumy = sc;
  for(ll i = 0; i < N; i++) {
    if(S[i] == 'L') { sumy--; }
    if(S[i] == 'U') { sumx--; }
    // cout << sumx << ' ' << sumy << endl;
    if(sumx < 1 || sumy < 1) {
      // cout << "win" << endl;
      takawin = true;
      break;
    }
    if(T[i] == 'R') { sumy++; }
    if(T[i] == 'D') { sumx++; }
    if(sumx > H) sumx = H;
    if(sumy > W) sumy = W;
    // cout << sumx << ' ' << sumy << endl;
  }

  if(takawin)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}

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

int main() {
    int A, B;
    string S;
    cin >> A >> B >> S;
    for (int i=0; i<A; i++) {
        if (S.at(i)=='-') {
            cout << "No\n";
            return 0;
        }
    }
    if (S.at(A)!='-') {
        cout << "No\n";
        return 0;
    }
    for (int i=A+1; i<A+B+1; i++) {
        if (S.at(i)=='-') {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;




int main(int argc, char *args[]) {
	int n;
	int origin;
	int d = 1000000000;
	int sum = 0;
	cin >> n;
	origin = n;
	for (int i = 0; i < 9; i++) {
		sum += n / d;
		n = n % d;
		d = d / 10;
	}
	sum += n / d;
	if (origin%sum == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define N 100005
#define f first
#define s second
using namespace std;
int main() {
    ll n,i,m=LLONG_MAX;
    cin>>n;
    for(i=1; i*i<=n; ++i)
        if(n%i==0)
            m=min(m,i+n/i-2);
    cout<<m;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll X, Y;
	cin >> X >> Y;

	ll ans = 0;

	while (X <= Y) {
		X *= 2;
		ans++;
	}

	cout << ans;


	system("PAUSE");

	

}


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

int main(){
	long long N, X, a, b, ans = 0;
	cin >> N >> X;
	a = X, b = N - X;
	if(a < b) swap(a, b);
	while(b){
		ans += (a/b) * b * 2;
		a %= b; swap(a, b);
	}
	cout << ans - a + N << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int h,w;
char board[110][110];
int dp[110][110];
int main()
{
	scanf("%d%d",&h,&w);
	for(int i=0;i<=h;i++)for(int j=0;j<=w;j++)board[i][j]='.';
	for(int i=1;i<=h;i++)scanf("%s",board[i]+1);
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			dp[i][j]=inf;
			if(i-1>=1||(i==1&&j==1))dp[i][j]=min(dp[i][j],dp[i-1][j]+(board[i-1][j]!='#'&&board[i][j]=='#'));
			if(j-1>=1||(i==1&&j==1))dp[i][j]=min(dp[i][j],dp[i][j-1]+(board[i][j-1]!='#'&&board[i][j]=='#'));
		//	cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	printf("%d\n",dp[h][w]);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;
 
int main(void) {
	// your code goes here
	ll v;
	scanf("%lld",&v);
	ll a = v / 11;
	ll b = v % 11;
	ll c = a * 2;
	if(b>0) c++;
	if(b>6) c++;
	printf("%lld",c);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int hit, blow;

void chk(int p, int q)
{
	if (p == q) {
		hit++;
	} else {
		blow++;
	}
}

int main()
{
	for (;;) {
		int a[4], b[4], x, y;
		if (scanf("%d", &a[0]) == EOF) {
			return 0;
		}
		for (x = 1; x < 4; x++) {
			scanf("%d", &a[x]);
		}
		for (y = 0; y < 4; y++) {
			scanf("%d", &b[y]);
		}
		hit = 0;
		blow = 0;
		for (x = 0; x < 4; x++) {
			for (y = 0; y < 4; y++) {
				if (a[x] == b[y]) {
					chk(x, y);
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; // [9,223,372,036,854,775,807 to -9.....808] 19 digits
typedef long double ld;
#define inc(i, a, b) for (long long int i = a; i <= b; i++)
#define dec(i, a, b) for (long long int i = a; i >= b; i--)
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define lv vector<ll>
#define cv vector<char>
#define dv vector<ld>
#define rall(c) (c).rbegin(), (c).rend()
#define lpr pair<ll, ll>
#define mp make_pair
#define cin(c) \
    ll c;      \
    cin >> c;
#define lmap unordered_map<ll, ll>
#define vinp(a, n) \
    inc(i, 1, n)   \
    {              \
        cin(k);    \
        a.pb(k);   \
    }
#define LIM 1000000007
#define F first
#define S second
#define fr(i, n) inc(i, 0, n - 1)
#define fri(n, a) \
    inc(i, 0, n - 1) { cin >> a[i]; }
#define debug(p) cout << p;
#define umap unordered_map
#define uset unordered_set
#define fill(a, val, n) \
    inc(i, 0, n - 1) { a[i] = val; }
void i_love_Accepted()
{
    ll n;
    cin>>n;
    lv a(n);
    fri(n,a);
    sort(rall(a));
    ll ans=0;
    ll w=n-1;
    inc(i,0,n-1)
    {
        if(w==0)
            break;
        ll c;
        if(i==0)
            c=1;
        else
            c=min(2ll,w);
        w-=c;
        ans+=c*a[i];
    }
    cout<<ans;
}   
int main()
{
    
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        i_love_Accepted();
        cout<<"\n";
    } 
}


Measured memory_bytes: 4776
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, A, B = list(map(int, sys.stdin.buffer.readline().split()))


# 解説
# 違うbitの数が奇数なら戻ってこれる


def bitcount(n):
    ret = 0
    while n > 0:
        ret += n & 1
        n >>= 1
    return ret


# vs = []
# for i in range(1 << N):
#     for j in range(i, 1 << N):
#         if bitcount(i ^ j) == 1:
#             vs.append((i, j))
# plot_graph(vs)


# @lru_cache(maxsize=None)
# @debug
def solve(n, a, b):
    if n <= 0:
        return []
    if bitcount(a ^ b) % 2 == 0:
        return []
    if n == 1:
        return [a, b]
    # 奇数
    # 違うbitを1つ取り除く
    mask = 1
    while (a ^ b) & mask == 0:
        mask <<= 1
    na = a // (mask << 1) * mask + a % mask
    nb = b // (mask << 1) * mask + b % mask
    mid = na ^ 1
    ret = []
    for r in solve(n - 1, na, mid):
        ret.append((r // mask * mask << 1) + (a & mask) + r % mask)
    for r in solve(n - 1, mid, nb):
        ret.append((r // mask * mask << 1) + (b & mask) + r % mask)
    return ret


ans = solve(N, A, B)
if ans:
    print('YES')
    print(*ans)
else:
    print('NO')

# for A in range(1 << N):
#     for B in range(1 << N):
#         ans = solve(N, A, B)
#         if ans:
#             assert ans[0] == A
#             assert ans[-1] == B
#             for a, b in zip(ans, ans[1:]):
#                 assert bitcount(a ^ b) == 1
#                 assert a < (1 << N)


Measured memory_bytes: 13380
#include<bits/stdc++.h>
using namespace std;
char s[100];
const int maxn =105;
int a[maxn];
int main(){
    int n,k;
    while(~scanf("%d%d",&n,&k)){
        memset(a,0,sizeof(a));
        int x,d;
        for(int i=0;i<k;i++){
            scanf("%d",&d);
            for(int j=0;j<d;j++){
                scanf("%d",&x);
            a[x]++;
            }

        }
        int ans=0;
        for(int i=1;i<=n;i++){
            if(a[i]==0){
                ans+=1;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


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

using namespace std;

int A[5];

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < 5; i++) {
		A[i] = -1;
	}
	bool c = false;
	while (M--) {
		int pos, aux;
		scanf("%d %d", &pos, &aux);
		if (A[pos - 1] == -1) {
			A[pos - 1] = aux;
		} else {
			if (A[pos - 1] != aux) {
				c = true;
			}
		}
	}
	if (A[0] == 0 && N != 1)  {
		c = true;
	}
	if (A[0] == -1) {
		if (N == 1) {
			A[0] = 0;
		} else {
			A[0] = 1;
		}
	}
	if (c) {
		printf("-1\n");
	} else {
		for (int i = 0; i < N; i++) {
			if (A[i] == -1) {
				printf("0");
			} else {
				printf("%d", A[i]);
			}
		}
		printf("\n");
	}
}

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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;

  if(s == u) a--;
  if(t == u) b--;
  cout << a << " " << b << endl;
}




Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<unordered_map>
#define int long long
const int inf=1145141919;
const int mod=1000000007;
using namespace std;
template<class T>void debug(T *a,int l,int r,const char *name){
	for(int i=l;i<r;i++)
		cout<<name<<"["<<i<<"]="<<a[i]<<endl;
}
int N;
int p[200001];
unordered_map<int,int> ma;
signed main(){
	int i,j;
	string s;
	cin>>s;
	N=s.size();
	for(i=0;i<N;i++)
		p[i+1]=p[i]^(1ll<<(s[i]-'a'));
	if(p[N]==0){
		cout<<1<<endl;
		return 0;
	}
	ma[p[N]]=0;
	for(i=N;i>0;i--)
		for(j=0;j<26;j++){
			auto it=ma.find(p[i]^(1ll<<j));
			if(it!=end(ma))
				it->second=min(it->second,ma[p[i]]+1);
			else
				ma[p[i]^(1ll<<j)]=ma[p[i]]+1;
		}
	cout<<ma[0]<<endl;
}

Measured memory_bytes: 171868
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}

void solve()
{   
    ll n;
    cin>>n;
    ll years=0;
    ll x=100;
    while(1)
    {
        if(x>=n)
            break;
        ll profit=x/100;
        x+=profit;
        years++;
    }
    cout<<years;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
using namespace std;

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

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

	string S[100];
	int P[100];
	rep(i,N){
		cin >> S[i] >> P[i];
	}

	typedef pair<string, int> PP;
	priority_queue< PP, vector<PP>, greater<PP> > qq;

	typedef pair<pair<string, int>, int> PPP;
	priority_queue< PPP, vector<PPP>, greater<PPP> > q;

	rep(i,N){
		qq.push(make_pair(S[i],-P[i]));
		q.push(make_pair(make_pair(S[i],-P[i]), i+1));
	}


	rep(i,N){
		pair<pair<string, int>, int> p=q.top();
		q.pop();
		cout << p.second << endl;

	}
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(long[]);

    auto r = new long[](n + 1);
    foreach (i ; 1 .. n + 1) {
        r[i] = pow(i, mod - 2, mod);
    }

    foreach (i ; 1 .. n + 1) {
        r[i] += r[i-1];
        r[i] %= mod;
    }

    debug {
        writeln(r);
    }

    long ans;

    long nf = 1;
    foreach (i ; 2 .. n + 1) {
        nf *= i;
        nf %= mod;
    }

    foreach (i ; 0 .. n) {
        long p = r[i+1] + r[n - i];
        p %= mod;
        p += mod - 1;
        p %= mod;
        ans += (nf * p) % mod * a[i] % mod;
        ans %= mod;
    }

    writeln(ans);
}


long pow(long x, long y, long mod) {
    return y > 0 ? pow(x, y>>1, mod)^^2 % mod * x^^(y&1) % mod : 1L;
}





















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 7092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }

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

    vector<pair<int,ll>> G[N];
    for (int i=0; i<N-1; ++i)  {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        G[a].push_back({b,c});
        G[b].push_back({a,c});
    }
    vector<int> dist(N,-1);
    queue<int> que;

    dist[0]=1;
    que.push(0);

    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(auto nv : G[v]) {
            if(dist[nv.first]!=-1) continue;
            if(nv.second%2==0) dist[nv.first]=dist[v];
            else dist[nv.first]=!dist[v];
            que.push(nv.first);
        }
    }
    for(int v=0; v<N; ++v) cout << dist[v] << "\n";
    return 0;
}

Measured memory_bytes: 11112
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		int sum = 0;
		for(int i=1; i<=N; i++){
			int n = i;
			int digSum = 0;
			while(n > 0){
				digSum += n % 10;
				n /= 10;
			}
			if(digSum >= A && digSum <= B)
				sum += i;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl s(n + 1, 0), xs(n + 1, 0);
  rep(i, n) {
    ll a;
    cin >> a;
    s[i + 1] = s[i] + a;
    xs[i + 1] ^= xs[i] ^ a;
  }
  ll ans = 0, r = 1;
  rep2(l, 1, n + 1) {
    while(r < n && s[r + 1] - s[l - 1] == (xs[r + 1] ^ xs[l - 1])) r++;
    ans += r - l + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3456
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
string s;

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

int main()
{
	cin >> s;
	int i,cnt=0;
	for (i=0;i<s.size();i++) cnt+=(s[i]=='2');
	cout << cnt;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	a, b:= oneInt(), oneInt()

	if a < b{
		fmt.Println(2*b -1)
	}else if a > b{
		fmt.Println(2*a -1)
	}else{
		fmt.Println(2*a)
	}
}

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


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

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

    if(D == 25){
        cout << "Christmas" << endl;
    }
    else if(D == 24){
        cout << "Christmas Eve" << endl;
    }
    else if(D == 23){
        cout << "Christmas Eve Eve" << endl;
    }
    else if(D == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

Measured memory_bytes: 256
import sys
d = int(sys.stdin.readline().rstrip())
list_c = list(map(int, sys.stdin.readline().rstrip().split()))
list_s = []
list_t = []
need = 0
for i in range(d):
  list_s.append(list(map(int, sys.stdin.readline().rstrip().split())))
for i in range(1, d+1):
  t = int(sys.stdin.readline().rstrip())
  list_t.append(t)
  need += list_s[i-1][t-1]
  MINUS = 0
  list_t1 = list_t[::-1]
  for j in range(1, 27):
    if not j in list_t1:
      MINUS += list_c[j-1] * len(list_t)
    else:
      MINUS += list_c[j-1] * list_t1.index(j)
  need -= MINUS
  print(need)

Measured memory_bytes: 68808
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;

const long long inf = 1000000007;

long long mod_pow (long long base, long long exponent)
{
	long long ans = 1LL;
	while (exponent)
	{
		ans *= ((exponent & 1LL) ? base : 1LL);
		ans %= inf;

		exponent >>= 1;
		base *= base;
		base %= inf;
	}

	return ans;
}

int main ()
{
	long long n;
	cin >> n;
	vector<long long> fact(n + 1);
	vector<long long> ifact(n + 1);

	fact[0] = 1LL;
	ifact[0] = 1LL;
	for (long long i=1; i<=n; ++i)
	{
		fact[i] = (i * fact[i-1]) % inf;
		ifact[i] = mod_pow(fact[i], inf-2);
	}

	auto f = [n, fact, ifact](long long k)
	{
		long long ans = fact[k-1];
		ans *= ifact[n-1-k];
		ans %= inf;
		ans *= ifact[2*k-n];
		ans %= inf;
		ans *= fact[k];
		ans %= inf;
		ans *= fact[n-1-k];
		ans %= inf;
		return ans;
	};

	
	long long m = (n + 1) >> 1;
	long long ans = m * f(m);
	ans %= inf;
	for (long long i=m+1; i<n; ++i)
	{
		long long g = f(i) - f(i-1);
		if (0 > g) g += inf;
		g %= inf;
		g *= i;
		g %= inf;
		ans += g;
		ans %= inf;
	}

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

Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    map<string, ll> mp;
    rep(i, 0, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    ll ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ll cnt = itr->second;
        if(cnt >= 2) ans += cnt*(cnt-1)/2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 11136
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353


def solve(chars, char):
    idx = []
    for i, c in enumerate(chars):
        if not c:
            idx.append(i)
    if not idx:
        if chars == ['a', 'a', 'b']:
            pass
        return [''.join(chars)]
    ret = []
    d = chr(ord(char) + 1)
    chars[idx[0]] = char
    ret += solve(chars, d)
    for cnt in range(1, len(idx)):
        for choices in itertools.combinations(idx[1:], r=cnt):
            for i in choices:
                chars[i] = char
            ret += solve(chars, d)
            for i in choices:
                chars[i] = ''
    chars[idx[0]] = ''
    return ret


N = int(sys.stdin.buffer.readline())
ans = solve([''] * N, 'a')
ans.sort()
print(*ans, sep='\n')


Measured memory_bytes: 73692
H,W=gets.split.map(&:to_i)
N=gets.to_i
as=gets.split.map(&:to_i)
idx=0
g=Array.new(H){Array.new(W,0)}
(H*W).times do |i| 
    if (i/W).even?
        g[i/W][i%W]=idx+1
    else
        g[i/W][W-i%W-1]=idx+1
    end
    as[idx]-=1
    idx+=1 if as[idx]==0
end
H.times do |i|
    puts g[i].join(" ")
end

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

import math

def readInts():
  return [int(s) for s in input().split(" ")]

def readInt():
  return readInts()[0]

def solve(N, A, B, C, D, E):
  v = min(A, B, C, D, E)
  return math.ceil(N / v) + 4

def main():
  N = readInt()
  A = readInt()
  B = readInt()
  C = readInt()
  D = readInt()
  E = readInt()

  print(solve(N, A, B, C, D, E))

if __name__ == "__main__":
  main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k,c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> l,r;
    int last = -inf;
    rep(i,n) {
        if(s[i] == 'x') continue;
        if(i <= last+c) continue;
        l.pb(i);
        last = i;
    }
    last = inf;
    rrep(i,n) {
        if(s[i] == 'x') continue;
        if(i >= last-c) continue;
        r.pb(i);
        last = i;
    }
    if(l.size() > k) return 0;
    reverse(all(r));
    rep(i,l.size()) {
        if(l[i] == r[i]) cout << l[i]+1 << endl;
    }
}


Measured memory_bytes: 3468
import java.util.Scanner;

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

		for (int i = 1; i <= 6; i++) {
			dice.setFace(i,sc.nextInt());
		}
        
        String x = sc.nextLine();
		char[] arr = sc.nextLine().toCharArray();
		for (int i = 0; i < arr.length; i++) {
			dice.roll(arr[i]);
		}

		System.out.println(dice.getFace());

	}
}

	class Dice {
		// [1]-[6]がダイスの各面で[0]は入れ替え時の退避用
		public int[] faces = new int[7];

		public void setFace(int face, int value) {
			this.faces[face] = value;
		}

		public void roll(char direction) {
			faces[0] = faces[1];
			switch (direction) {
			case 'S':
				this.faces[1] = this.faces[5];
				this.faces[5] = this.faces[6];
				this.faces[6] = this.faces[2];
				this.faces[2] = this.faces[0];
				break;
			case 'W':
				this.faces[1] = this.faces[3];
				this.faces[3] = this.faces[6];
				this.faces[6] = this.faces[4];
				this.faces[4] = this.faces[0];
				break;
			case 'N':
				this.faces[1] = this.faces[2];
				this.faces[2] = this.faces[6];
				this.faces[6] = this.faces[5];
				this.faces[5] = this.faces[0];
				break;
			case 'E':
				this.faces[1] = this.faces[4];
				this.faces[4] = this.faces[6];
				this.faces[6] = this.faces[3];
				this.faces[3] = faces[0];
				break;
			}

		}

		public int getFace() {
			return this.faces[1];
		}

	}



Measured memory_bytes: 26320
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 1000000007

#define T 18
ll n,k;
ll el[99],er[99],ec[99],ecnt;
int main(){
	scanf("%lld",&k);
	ll crr=1;
	for(ll i=1;i<=19;i++){
		if(crr+(1LL<<(i-1))<=k){
			el[ecnt]=i;er[ecnt]=i+1;ec[ecnt]=0;ecnt++;
			el[ecnt]=i;er[ecnt]=i+1;ec[ecnt]=crr;ecnt++;
			crr+=1LL<<(i-1);
			n=i+1;
		}
	}
	for(ll i=19;i>=1;i--){
		while(crr+(1LL<<(i-1))<=k){
			el[ecnt]=i;er[ecnt]=n;ec[ecnt]=crr;ecnt++;
			crr+=1LL<<(i-1);
		}
	}

	printf("%lld %lld\n",n,ecnt);
	rep(i,0,ecnt)printf("%lld %lld %lld\n",n+1-er[i],n+1-el[i],ec[i]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h,w;
    std::cin >> h >>w;
    for (int i = 0; i < w+2; i++) {
        std::cout << "#";
    }
    std::cout << std::endl;
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if(j==0){
                std::cout << "#";
            }
            char p;
            std::cin >> p;
            std::cout << p;
            if(j==w-1){
                std::cout << "#" <<endl;
            }
        }
    }

    
    
    for (int i = 0; i < w+2; i++) {
        std::cout << "#";
    }
    std::cout << std::endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    double sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int count = 0;
    for(int i = 0; i < N; i++){
        if(a[i] >= sum / (4* M)) count++;
    }
    if(count >= M) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#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>;

int main() {
  ll x;
  cin >> x;
  ll ans = 0;
  ll now =100;
  while (now < x){
    now = ll ( 1.01 * now );
    ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
 /* #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  int i=0;
  string s;
  getline(cin,s);
  //cin>>s;
  for( i=0;i<s.length();i++)
  {
    if(s[i]==' ')
    {
      break;
    }
  }
  i++;
///cout<<"ss "<<s[9]<<endl;
  //cout<<"i "<<i<<endl;
  //cout<<s[i]<<endl;
  cout<<"A"<<s[i]<<"C"<<endl;
  

}
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

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


long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}

class Point{
public:
	long long x;
	long long y;
};
long long N,M;
vector<long long>X(100006,0);
bool isOK(long long time){
	long right=0;
	for(int i=0;i<M;i++){
		if(right>=X[i]-1){
			//go right
			right=X[i]+time;
		}else{
			if(right < X[i]-time-2)return false;
			right=max(X[i],X[i]+(time-(2*(X[i]-right)-1)));
		}
		//cout<<right<<endl;
	}
	if(right<N-1)return false;
	return true;
	
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin>>N;
	int ans=0;
	int num=0;
	for(int i=1;i<=N;i++){
		num=0;
		//cout<<num<<endl;
		if(i%2==0)continue;
		for(int j=1;j<=i;j++){
			if(i%j==0)num++;
		}
		if(num==8)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		String T;
		int count = 0;
		ArrayList<String> lowerT = new ArrayList<String>();
		;
		while (true) {
			T = sc.next();
			if (T.equals("END_OF_TEXT")) {
				break;
			}
			lowerT.add(T.toLowerCase());
		}
		for (int i = 0; i < lowerT.size(); i++) {
			if (W.equals(lowerT.get(i))) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
}


Measured memory_bytes: 26096
#include <iostream>

using namespace std;

int main(void) {
    int D;
    cin >> D;
    if(D == 25) cout << "Christmas";
    if(D == 24) cout << "Christmas Eve";
    if(D == 23) cout << "Christmas Eve Eve";
    if(D == 22) cout << "Christmas Eve Eve Eve";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256