akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)

int main(){
    int N;
    cin >> N;
    long long d[N];
    rep(i, N){
        cin >> d[i];
    }
    long long sum = 0;
    rep(i, N){
        rep2(j, i+1, N){
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf(), fgets()
#include <stdbool.h>
#include <string.h>         // strlen(), strstr()

int
main(int argc, char **argv)
{
	char line[1002];
	const char *key = "Hoshino";
	int n;

	scanf("%d\n", &n);
	while (n--)
	{
		fgets(line, sizeof(line), stdin);
		char *s = line;
		while (true)
		{
			s = strstr(s, key);
			if (s == NULL)
				break;

			s[6] = 'a';
			s += 7;
		}

		printf("%s", line);
	}

	return 0;
}

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

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;

  if (s[0] != s[1] && s[1] != s[2] && s[2] != s[0])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i = 1 , j = 1 ;
	int a;	

	 while (1){
		scanf("%d",&a);
		if(a == 0) break;
		printf("Case %0d: %0d\n",j,a);
		j++;
	  }

	return 0;
}


Measured memory_bytes: 1988
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
const int inf = 1e9;
const int maxn = 1e5 + 10;
 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (a && c)
	{
		c -= b;
		if (c <= 0) { cout << "Yes"; break; }
		a -= d;
		if (a <= 0) { cout << "No"; break; }
	}
	return 0;
}

Measured memory_bytes: 3652
def print_ans(N):
  """
  Parameters
  --------------
  >>> print_ans("99")
  Yes
  >>> print_ans("19") 
  Yes
  >>> print_ans("17")
  No
  """
  if N[0] == "9" or N[1] == "9":
    print("Yes")
  else:
    print("No")
  

def main():
  N = input()
  print_ans(N)


if __name__ == '__main__':
  main()



Measured memory_bytes: 38384
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean[] matches = new boolean[n];
		for (int i = 0; i < n; i++) {
		    matches[i] = (sc.nextInt() == (i + 1));
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
		    if (matches[i]) {
		        count++;
		        i++;
		    }
		}
		System.out.println(count);
   }
}



Measured memory_bytes: 49840
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#define SIZE 20

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[SIZE];

int main()
{
	scanf("%s",&str);
	int n=strlen(str);
	int ret=15-n;
	for(int i=0;i<n;i++) if(str[i]=='o') ret++;
	puts(ret>=8?"YES":"NO");
	return 0;
}


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

int main() {
  int A , B ; 
  cin >> A >> B ; 
  
  
  for( int i = 1 ; i <= 1010 ; i++){
    if(floor(0.08*i) == A && floor(0.1*i) == B){
      cout << i << endl ; 
      return 0 ; 
    }
  }
  
  cout << "-1" << endl ; 
  
  
}



Measured memory_bytes: 3616
#include <stdio.h>

#define N 2000
#define Q 200

int n,a[N];

int solve(int,int);

int main () {

  int q,m;
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if (solve(0,m) == 1){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }

return 0;
}

int solve (int i,int m) {
  int res;
  if(m == 0)
    return 1;
  if(i >= n)
    return 0;
  res = solve(i+1,m) || solve(i+1,m-a[i]);
    return res;
}

Measured memory_bytes: 580
#include <stdio.h>

int main(void)
{
    int i, j;

    int in[5];
    for (i = 0; i < 5; i++) {
        scanf(" %d", &in[i]);
    }

    int tmp;
    for (i = 0; i < 4; i++) {
        for (j = i + 1; j < 5; j++) {
            if (in[i] < in[j]) {
                tmp = in[i];
                in[i] = in[j];
                in[j] = tmp;
            }
        }
    }

    for (i = 0; i < 5; i++) {
        if (i != 0) {
            printf(" ");
        }
        printf("%d", in[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <string.h>

void trans(char *x, char *y, int v){while (v++ < 81) *x = '0', x++; strcat(x, y);}

int main(void)
{
    int n;
    char a[128], b[128];
    char x[128], y[128];
    char *output;

    scanf("%d", &n);
    while (n--){
        output = "overflow";
        scanf("%81s %81s", a, b);
        if (fmax(strlen(a), strlen(b)) < 81){
            int carry, i;
            memset(x, 0, 256);
            
            trans(x, a, strlen(a));
            trans(y, b, strlen(b));

            for (carry = i = 0; i < 81; i++){
                int v = x[80 - i] - '0' + y[80 - i] - '0' + carry;
                carry = v > 9;
                x[80 - i] = v % 10 + '0';
            }
            for (i = 0; i < 80 && x[i] == '0'; i++);
            if  (i) output = x + i;
        }
        puts(output);
    }
    return (0);
}

Measured memory_bytes: 596
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, X, *M = map(int, read().split())

    ans = (X - sum(M)) // min(M) + N
    print(ans)

    return


if __name__ == '__main__':
    main()


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

constexpr int lim = 3e5;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  vector<bool> prime(lim + 1, true);
  for (int p = 2; p * p <= lim; ++p) {
    if ((p % 7 == 1 or p % 7 == 6) and prime[p]) {
      for (int i = 2 * p; i <= lim; i += p) {
        prime[i] = false;
      }
    }
  }
  int n;
  while (cin >> n, n > 1) {
    vector<int> d;
    for (int i = 1; i * i <= n; ++i) {
      if (n % i == 0) {
        d.push_back(i);
        d.push_back(n / i);
      }
    }
    sort(begin(d), end(d));
    d.erase(unique(begin(d), end(d)), end(d));
    d.erase(begin(d));
    cout << n << ':';
    for (int e : d) {
      if ((e % 7 == 1 or e % 7 == 6) and prime[e]) {
        cout << ' ' << e;
      }
    }
    cout << '\n';
  }
}



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

int main(){
	int N,M,C;
	cin >> N >> M >> C;
	int B[M];

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

	int A[N][M];

	for(int i = 0; i < N; i++ ){
		for (int j = 0; j < M; j++){
			cin >> A[i][j];
		}
	}

	int val;
	int ac=0;

	for (int i = 0; i < N; i++){
		val = 0;
		for (int j = 0; j < M; j++){
			val += A[i][j] * B[j] ;	
		} 
		if (val >-C){
			ac += 1;
		}
	}
	cout << ac << endl;
	return 0;

}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  for(int i = 0; i < N; i++) {
    cout << S[i] << T[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int d[10010];
int main()
{
	int n, x;
	
	d[0] = 1;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		for (int j = 10000; j >= x; j--) {
			if (d[j - x]) {
				d[j] = 1;
			}
		}
	} 
	for (int j = 10000; j >= 0; j--) {
		if (d[j] && j % 10 != 0) {
			printf("%d\n", j);
			return 0;
		}
	}
	puts("0");
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, k = LI()
    ps = LI()
    sum_ = [0]
    for i in range(1, 1000+2):
        sum_.append(sum_[i-1] + i)
    kitai = [ke / (i + 1) for i, ke in enumerate(sum_[1:])]
    kitai2 = [kitai[i-1] for i in ps]
    ans = []
    for i in range(n-k+1):
        if i == 0:
            ans.append(sum(kitai2[0:k]))
        else:
            ans.append(ans[i-1] - kitai2[i-1] + kitai2[i+k-1])
    print(max(ans))




if __name__ == '__main__':
    main()

Measured memory_bytes: 73480
#include<iostream>

using namespace std;

struct poker{
    char suit;
    int data;
    bool operator !=(const poker& b){
        return this->suit != b.suit || this->data != b.data; 
    }
};

void swap(poker& a, poker& b){
    poker t;
    t = a; a = b; b = t;
}

int bubbleSort(poker a[], int n){
    int cnt = 0;
    for(int i = 1; i < n; ++i){
        bool f = true;
        for(int j = n; j > i; --j){
            if(a[j].data < a[j - 1].data) { swap(a[j], a[j - 1]); ++cnt; f = false; }
        }
        if(f) break;
    }
    return cnt;
}

int selectSort(poker a[], int n){
    int cnt = 0;
    for(int i = 1; i <n; ++i){
        a[0].data = i;
        for(int j = i + 1; j <= n; ++j){
            if(a[j].data < a[a[0].data].data) a[0].data = j;
        }
        if(a[0].data != i) { swap(a[a[0].data], a[i]); ++cnt; }
    }
    return cnt;
}

bool isStable(poker a[], poker b[], int n){
    bool f = true;
    for(int i = 1; i <= n; ++i){
        if(a[i] != b[i]) return false;
    }
    return f;
}

int main(){
    int n,x;
    char suit;
    cin >> n;
    poker a[n + 1], b[n + 1];
    for(int i = 1; i <= n; ++i) { cin >> suit >> x; a[i].suit = b[i].suit = suit; a[i].data = b[i].data = x; }
    bubbleSort(a, n); selectSort(b, n);
    for(int i = 1; i < n; ++i) cout << a[i].suit << a[i].data << " ";
    cout << a[n].suit << a[n].data << endl << "Stable" << endl;
    for(int i = 1; i < n; ++i) cout << b[i].suit << b[i].data << " ";
    cout << b[n].suit << b[n].data << endl << (isStable(a, b, n) ? "Stable" : "Not stable") << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll int n,a,b,c,x;

ll int getrand(int x){
	return (x*a+b)%c;
}
int main(){
	int rdata[10001];
	while(1){
		cin >> n >> a >> b >> c >> x;
		if(n==0&&a==0&&b==0&&c==0&&x==0) break;
		REP(i,n) cin >> rdata[i];
		ll int cnt = 0;
		bool update = false;
		REP(i,n){
			while(1){
				if (update) {x = getrand(x); update = false;cnt++;};
				if(x==rdata[i]) {
					update = true;
					break;
				}else{
					x = getrand(x);
				}

				cnt++;
				if(cnt>10000) {
					i = n;
					break;
				}
			}
		}
		if(cnt>10000) cout << -1 << endl;
		else cout << cnt << endl;
	}
}

Measured memory_bytes: 1172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		int n = Integer.parseInt(tmpArray[0]);
		int k = Integer.parseInt(tmpArray[1]);
		int q = Integer.parseInt(tmpArray[2]);

		int points[] = new int[n];

//		int a[] = new int[q];

		for(int i = 0; i < q; i++){
			int tmp = Integer.parseInt(br.readLine()) - 1;

			points[tmp]++;
		}

		for(int i = 0; i < n; i++){
			int result = k - (q - points[i]);

			if(result > 0){
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

}


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

using namespace std;
using ll = long long;

int main() {
    ll N, M;
    cin >> N >> M;

    ll output = (N * 2 + M) / 4;
    if (M < output * 2) {
        output = M / 2;
    }

    cout << output << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  double l;
  cin >> l;
  double ans=l/3.0;
  ans=ans*ans*ans;
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin>>N;
  VEC(d,N);
  rep(i,N){
    cin>>d[i];
  }
  sort(d.begin(),d.end());
  if(d[N/2]!=d[N/2-1]){
    cout<<d[N/2]-d[N/2-1]<<endl;
  }
  else{
    cout<<0<<endl;
  }
}
    
  
  



Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc103/tasks/abc103_d

int main() {
    int N, M; cin >> N >> M;
    P ab[M];
    REP(i, M) {
        int a, b; cin >> a >> b;
        ab[i] = {b, a};
    }

    sort(ab, ab+M);

    int now = 0;
    int cnt = 0;
    REP(i, M) {
        P p = ab[i];
        int l = p.second;
        int r = p.first;

        if (l >= now) {
            cnt++;
            now = r;
        }
    }

    cout << cnt << "\n";

    return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define pb push_back
using ll = long long;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(void){
    int N;
    cin >> N;
    string NN = to_string(N);
    if(NN[0] == '7' || NN[1] == '7' ||NN[2] == '7' ){
     cout << "Yes" << endl;
     return 0;
    }
    cout << "No" << endl;
    return 0;
}

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

using namespace std;

#define MODULO 998244353
#define ll long long
#define INF 99999999

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

    int h, w;
    cin >> h >> w;
    char s[h+1][w+1];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
        }
        s[i][w] = '.';
    } 
    for (int j = 0; j <= w; j++) {
        s[h][j] = '.';
    }
    // for (int i = 0; i < h; i++) {
    //     for (int j = 0; j < w; j++) {
    //         cout << s[i][j];
    //     }
    //     cout << '\n';
    // } 
    int dp[h+1][w+1];
    for (int i = 0; i <= h-2; i++) {
        dp[i][w] = INF;
    }
    dp[h-1][w] = 0;
    for (int j = 0; j <= w-2; j++) {
        dp[h][j] = INF;
    }
    dp[h][w-1] = 0;
    // for (int i = 0; i < h; i++) {
    //     for (int j = 0; j < w; j++) {
    //         dp[i][j] = INF;
    //     }
    // } 
    // dp[h-1][w-1]=s[h-1][w-1] == '#' ? 1 : 0;
    // printf("dp[%d,%d]=%d\n", h-1,w-1,dp[h-1][w-1]);
    // for (int j = w - 2; j >= 0; j--) {
    //     if (s[h-1][j]==s[h-1][j+1]) {
    //         dp[h-1][j]=dp[h-1][j+1];
    //     } else {
    //         if (s[h-1][j]=='.') {
    //             dp[h-1][j]=dp[h-1][j+1];
    //         } else {
    //             dp[h-1][j]=dp[h-1][j+1]+1;
    //         }
    //     }
    //     printf("dp[%d,%d]=%d\n", h-1,j,dp[h-1][j]);
    // }
    for (int i = h -1;i>=0;i--) {
        for (int j = w-1;j>=0;j--) {
            int a;
            if (s[i][j] == s[i][j+1]) {
                a = dp[i][j+1];
            } else {
                a = dp[i][j+1] + (s[i][j]=='#' ? 1 : 0);
            }            
            int b;
            if (s[i][j] == s[i+1][j]) {
                b = dp[i+1][j];
            } else {
                b = dp[i+1][j] + (s[i][j]=='#' ? 1 : 0);
            }            
            dp[i][j] = min(a,b);
            // printf("dp[%d,%d]=%d\n", i,j,dp[i][j]);
        }
    }
    cout << dp[0][0];
}

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

string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k, c;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  vector<int> b(n, -1);
  {
    int i = 0;
    for (int t = 0; t < k; ++t) {
      while (s[i] == 'x') {
        ++i;
      }
      b[i] = t;
      i += c + 1;
    }
  }
  DEBUG(b);
  vector<int> dp(3 * n);
  for (int i = n; i--; ) {
    dp[i] = dp[i + 1];
    if (s[i] == 'o') {
      dp[i] = max(dp[i], 1 + dp[i + c + 1]);
    }
  }
  DEBUG(dp);
  for (int i = 0; i < n; ++i) {
    if (b[i] != -1 and b[i] + dp[i + 1] < k) {
      cout << i + 1 << '\n';
    }
  }
}


Measured memory_bytes: 5012
f=lambda:map(int,input().split())
h,w,n=f()
c=[(h-2)*(w-2)]+[0]*9
d={}
while n:
 n-=1;x,y=f()
 for i in range(9):a=x+i%3,y+i//3;g=h>=a[0]>2<a[1]<=w;t=d[a]=d.get(a,0)+g;c[t-g]-=1;c[t]+=1
print(*c)

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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  int a[26];
  rep(i, 26){
    a[i] = 0;
  }
  rep(i, N){
    a[S[i] - 'a']++;
  }
  rep(i, 26){
    if(a[i] == 0){
      char ans = i + 'a';
      cout << ans << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define REP(i, n) for(int i=0; i<n; i++)
#define RER(i, n) for(int i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n;

signed main(){
    string s; cin >> s; cin >> s;
    cout << "A" << s[0] << "C" << endl;
    return 0;
}

Measured memory_bytes: 256
S=input()
Q=int(input())
query=[input().split() for _ in range(Q)]

reverse=False
lst=["" for _ in range(500000+10)]
sp=200000+5
fp=200000+5

for i in range(len(S)):
    lst[sp+i]=S[i]
    fp+=1

for q in query:
    if q[0]=="1":
        reverse = not reverse
    else:
        if q[1]=="1":
            if reverse:
                #S=S+q[2]
                lst[fp]=q[2]
                fp+=1
            else:
                #S=q[2]+S
                sp-=1
                lst[sp]=q[2]
        else:
            if reverse:
                #S=q[2]+S
                sp-=1
                lst[sp]=q[2]
            else:
                #S=S+q[2]
                lst[fp]=q[2]
                fp+=1

if reverse:
    #print(S[::-1])
    print("".join(lst[::-1]))
else:
    #print(S)
    print("".join(lst))

Measured memory_bytes: 119384
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,a[100010];
    cin>>n;
    map<ll,ll> mp1,mp2;
    rep(i,n){
        cin>>a[i];
        if(i%2==0) mp1[a[i]]++;
        else mp2[a[i]]++;
    }
    vector<pll> v,s;
    for(auto i:mp1){
        v.pb(pll(i.sc,i.fi));
    }
    for(auto i:mp2){
        s.pb(pll(i.sc,i.fi));
    }
    sort(all(v));reverse(all(v));
    sort(all(s));reverse(all(s));
    pll x=v[0],y=s[0],x1,y1;
    rep(i,s.size()){
        if(s[i].sc!=x.sc){
            x1=s[i];
            break;
        }
    }
    rep(i,v.size()){
        if(v[i].sc!=x.sc){
            y1=v[i];
            break;
        }
    }
    cout<<n-max(x.fi+x1.fi,y.fi+y1.fi)<<endl;
    return 0;
}


Measured memory_bytes: 9592
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, x = MAP()
a = LIST()

ans = max(0, a[0]-x)
a[0] = min(a[0], x)

for i in range(1, N):
	tmp = a[i-1]+a[i]
	ans += max(0, tmp-x)
	a[i] = min(a[i], x-a[i-1])
print(ans)


Measured memory_bytes: 16264
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  int c=0;
  for(int64_t i=1;i*i*i*i<=x;i++)
    c=i;
  int a=0;
  int b=0;
  for(int64_t i=0;i<=c;i++){
    for(int64_t j=-c;j<=c;j++){
      if(i*i*i*i*i-j*j*j*j*j==x){
        a=i;
        b=j;
      }
    }
  }
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 3636
n, m, l = map(int, input().split())

a = []
for i in range(n):
    ai = list(map(int, input().split()))
    a.append(ai)
b = []
for i in range(m):
    bi = list(map(int, input().split()))
    b.append(bi)

c = []
for i in range(n):
    for j in range(l):
        ci = 0
        for k in range(m):
            ci += a[i][k] * b[k][j]
        c.append(ci)
s = ''
for i in range(1, len(c)+ 1):
    s += str(c[i-1]) + ' '
    if i % l == 0:
        s = s[:-1]
        print(s)
        s = ''
   


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll A, B, Q; cin >> A >> B >> Q;
	vll S(A), T(B); cin >> S >> T;
	while (Q--) {
		ll x; cin >> x;
		ll minv = LLINF;
		auto pos1 = lower_bound(begin(S), end(S), x);
		auto pos2 = lower_bound(begin(T), end(T), x);
		
		//左左
		if (pos1 != begin(S) && pos2 != begin(T)) {
			chmin(minv, x - min(*(pos1-1), *(pos2-1)));
		}
		//右右
		if (pos1 != end(S) && pos2 != end(T)) {
			chmin(minv, max(*pos1, *pos2) - x);
		}
		//左右
		if (pos1 != begin(S) && pos2 != end(T)) {
			chmin(minv, 2*(x-*(pos1-1)) + (*pos2 - x));
			chmin(minv, (x-*(pos1-1)) + 2*(*pos2 - x));
		}
		//右左
		if (pos1 != end(S) && pos2 != begin(T)) {
			chmin(minv, 2*(x-*(pos2-1)) + (*pos1 - x));
			chmin(minv, (x-*(pos2-1)) + 2*(*pos1 - x));
		}
		cout << minv << endl;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 4744
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int mod = 1000000000+7;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    ll ans = 0;
    for(int i=0; i<60; i++){
        ll x = 0;
        for(int j=0; j<n; j++) if(a[j] >> i&1) ++x;
        ll now = x*(n-x) % mod;
        for(int j=0; j<i; j++) now = now*2%mod;
        ans += now;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5572
class UnionFind:
    def __init__(self,n):
        self.ps = [-1]*n
    def find(self,x):
        if self.ps[x]<0:
            return x
        else:
            self.ps[x]=self.find(self.ps[x])
            return self.ps[x]
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
            return False
        if self.ps[x]>self.ps[y]:
            x,y = y,x
        self.ps[x] += self.ps[y]
        self.ps[y] = x
        return True
    def same(self,x,y):
        return self.find(x)==self.find(y)
    def size(self,x):
        x = self.find(x)
        return -self.ps[x]

def main():
  n,m = map(int, input().split())
  a = list(map(int, input().split()))
  uf = UnionFind(n)
  for _ in range(m):
    x,y = map(int, input().split())
    uf.unite(x,y)
  d = dict()
  res = list()
  for i in range(n):
    v = uf.find(i)
    if v not in d:
      d[v] = a[i]
    elif d[v] > a[i]:
      res.append(d[v])
      d[v] = a[i]
    else:
      res.append(a[i])
  t = len(d)
  e = (t-1)*2
  if t == 1:
    return 0
  elif len(res) < e-t:
    return 'Impossible'
  else:
    res.sort()
    return sum(x for x in d.values()) + sum(res[:e-t])
  
print(main())

Measured memory_bytes: 21628
import std.stdio, std.conv, std.algorithm, std.string;
alias L = long;
L M = 998244353;
L[] X;
L[L] C;
L h(L m, L[] U){
	L f;
	foreach(u; U[0 .. m]) f = f * 2 % M + u;
	foreach(i, u; U) if(i / m & 1 ^ U[i % m] ^ u) return f + u;
	return f + 1;
}
void main(){
	L n = readln.chomp.to!L, b = n * 2;
	foreach(c; readln.chomp) X ~= c - '0';
	
	for(L d = n | 1; d > 2; d -= 2) if(n % d < 1){
		L c = h(n / d, X);
		foreach(e, q; C) e % d || (c += M - q);
		C[d] = c % M;
	}
	
	n = h(n, X) * b;
	foreach(d, c; C) n += M - c * (b - b / d) % M;
	writeln(n % M);
}


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

#define int long long

#define inf 1000000007LL
#define mod 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

int ans[11919];

signed main() {
  int a, b;
  cin >> a >> b;
  if(a <= b) {
    cout << "Impossible" << endl;
    return 0;
  }
  stack<int> st;
  rep(i, a + b) {
    if(st.empty()) {
      st.push(i);
    }
    else {
      cout << "? " << st.top() << " " << i << endl;
      string res;
      cin >> res;
      if(res == "Y") {
        st.push(i);
      }
      else {
        st.pop();
      }
    }
  }
  rep(i, a + b) {
    if(i == st.top()) {
      ans[i] = 1;
    }
    else {
      cout << "? " << st.top() << " " << i << endl;
      string res;
      cin >> res;
      if(res == "Y") {
        ans[i] = 1;
      }
      else {
        ans[i] = 0;
      }
    }
  }
  cout << "! ";
  rep(i, a + b) {
    cout << ans[i];
  }
  cout << endl;
}


Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	i64 X, Y;
	cin >> X >> Y;
	if(X%Y == 0) Cout(-1);
	else Cout(X*Y - X);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string str;
  int q;
  cin >> str;
  cin >> q;
  while(q--){
    string s;
    cin >> s;
    if(s == "print"){
      int a, b;
      cin >> a >> b;
      cout << str.substr( a, b - a + 1) << endl;
    } else if(s == "reverse"){
      int a, b;
      cin >> a >> b;
      reverse( str.begin() + a, str.begin() + b + 1);
    } else {
      int a, b;
      string p;
      cin >> a >> b >> p;
      str.replace( a, b - a + 1, p);
    }
  }
}


Measured memory_bytes: 3192
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long x,y;
    scanf("%ld %ld", &x, &y);
    if(abs(x-y) < 2){
        printf("Brown");
    } else {
        printf("Alice");
    }
    
    return 0;
}


Measured memory_bytes: 3228
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

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

    int start = 0 ;
    int cnt = 0 ;
    for(int i=0;i<(int)s.size();i++){
        if ( start != s[i]-'0' ) cnt++ ;
        debug() << imie(start) ;
        start = !start ;
    }
    int nax = cnt ;
    cnt = 0 ;
    start = 1 ;
    for(int i=0;i<(int)s.size();i++){
        if ( start != s[i]-'0' ) cnt++ ;
        start = !start ;
    }
    cout << min(nax,cnt) << endl;

    return 0 ;
}


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

void rotate(string &s) {
  for (int i = 1; i < s.size(); i++)
    swap(s[i-1], s[i]);
}

int main() {
  string s, t;
  cin >> s >> t;
  bool f = false;
  for (int i = 0; i < s.size(); i++) {
    if (s == t) {
      f = true;
      break;
    }
    rotate(s);
  }
  if (f) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

// MOD確認

int main(){
   string S,T;
   cin >> S >> T;
   ll s = S.size(),t = T.size();
   ll ans = INF;
   rep(i,s-t+1){
      ll cnt = 0;
      rep(j,t) if(T[j] != S[i+j]) cnt++;
      ans = min(ans,cnt);
   }
   cout << ans << endl;
}

Measured memory_bytes: 3600
n = int(input())
a = list(map(int, input().split()))
dict = {}
tcnt = 0
for i in range(n):
    j = i + 1
    if (j - a[i]) in dict:
        tcnt += dict[j - a[i]]
    if (a[i] + j) in dict:
        dict[a[i] + j] += 1
    else:
        dict[a[i] + j] = 1
print(tcnt)


Measured memory_bytes: 40664
// おこりうる遷移を全部見る
fn dfs(s: &Vec<char>, a: &Vec<usize>, n: usize, x: usize, res: &mut Vec<(usize, String)>) {
    if s.len() == n {
        println!("{}: {:?}", n, res);
        return;
    }
    if s[n] == '0' {
        res[n] = (0, format!("{:b}", x));
        dfs(s, a, n + 1, x, res);
        res[n] = (0, format!("{:b}", x ^ a[n]));
        dfs(s, a, n + 1, x ^ a[n], res);
    } else {
        res[n] = (1, format!("{:b}", x));
        dfs(s, a, n + 1, x, res);
        res[n] = (1, format!("{:b}", x ^ a[n]));
        dfs(s, a, n + 1, x ^ a[n], res);
    }
}

fn main() {
    let t: usize = read();
    'outer: for _ in 0..t {
        let n = read();
        let a: Vec<usize> = (0..n).map(|_| read::<usize>()).collect();
        let s: Vec<char> = read::<String>().chars().collect();
        let mut bases = vec![];
        for i in (0..n).rev() {
            let mut cur = a[i];
            for &b in &bases {
                if cur ^ b < cur {
                    cur ^= b;
                }
            }
            if cur != 0 {
                if s[i] == '1' {
                    println!("{}", 1);
                    continue 'outer;
                } else {
                    bases.push(cur);
                }
            }
        }
        println!("{}", 0);
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2132
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int,int>a, pair<int,int>b) {
	if (a.first == b.first) {
		return a.second > b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {
	int n, k;
	cin >> n >> k;
	cout << n % k << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
string s;
int num;
int _n=1;
int tree[200000<<2];
void update(int ind,int val){
    ind+=_n-1;
    tree[ind]=val;
    while(ind>1){
        ind/=2;
        tree[ind]=tree[ind*2]+tree[ind*2+1];
    }
}
int query(int l,int r,int nl,int nr,int ind){
    if(l<=nl && nr<=r) return tree[ind];
    if(l>nr || r<nl) return 0;
    int mid=(nl+nr)>>1;
    return query(l,r,nl,mid,ind*2)+query(l,r,mid+1,nr,ind*2+1);
}
int main(){
    int n;
    cin>>n>>s;
    while(_n<(int)s.size()) _n*=2;
    for(int i=0;i<(int)s.size();i++)
        if(s[i]=='W'){
            update(i+1,1);
        }
        else num++;
    int ans=num;
    for(int i=1;i<=num;i++){
        int now=query(1,i,1,_n,1);
        ans=min(ans,now+num-i);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 5472
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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





int main(){
    long long A; long double B;
    std::cin >> A >> B;
    long long b(100*B + 0.5);
    std::cout << (A * b) / 100 << std::endl;
    return 0;
}


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

using namespace std;

//inline int read() {
//	int x = 0, f = 1; char c = getchar();
//	while (!isdigit(c)) {
//		if (c == '-') f = -1;
//		c = getchar();
//	}
//	while (isdigit(c)) {
//		x = x * 10 + c - '0';
//		c = getchar();
//	}
//	return x * f;
//}

//vector<pair<long long, int> > a;
long long ans;

signed main() {
//	freopen("input.txt", "r", stdin);
long long n, s; cin >> n; s = n;
long long top = sqrt(n);
for (int i = 2; i <= top; i++) {
//	cout << i << endl;
	if (s % i != 0) continue;
	int num = 0;
	while (s % i == 0) {
		num++;
		s /= i;
	}
//	cout << n << endl;
//	cout << i << " " << num << endl;
	if (num == 0) ans += 0;
	else if (num >= 1 && num < 3) ans += 1;
	else if (num >= 3 && num < 6) ans += 2;
	else if (num >= 6 && num < 10) ans += 3;
	else if (num >= 10 && num < 15) ans += 4;
	else if (num >= 15 && num < 21) ans += 5;
	else if (num >= 21 && num < 28) ans += 6;
	else if (num >= 28 && num < 36) ans += 7;
	else if (num >= 36 && num < 45) ans += 8;
}
if(s != 1) {
	ans++;
}
cout << ans << endl;
	return 0;
}


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

const ll INF = 1LL << 60;

ll a, b, c;
int main() {
    cin >> a >> b >> c;

    ll tmp = c - a - b;
    if (tmp <= 0) {
        cout << "No" << endl;
        return 0;
    }

    if (4 * a * b < tmp * tmp) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
           string alpha = Console.ReadLine();
            double beta = double.Parse(alpha);
            double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582;
            double S = beta * beta * pi;
            double L = 2 * pi * beta;
           
                string z = S.ToString() + " " + L.ToString();

            Console.WriteLine("{0} {1}", S.ToString("f5"), L.ToString("f5"));
        }

    }
}



Measured memory_bytes: 17940
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 110000; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
    	for (int j = 1; j <= K; ++j) {
    		chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    	}
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1920
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 105
#define oo 2000000007
#define EPS 1e-9

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

ll n, x;

ll Solve(ll a, ll b) {
    if (a < b) swap(a, b);
    if (a%b == 0) return 2*a - b;
    return 2*a + Solve(a%b, b-a%b);
}

int main () {
    cin >> n >> x;
    cout << n + Solve(n-x, x);

    return 0;
}


Measured memory_bytes: 256