akhauriyash/Code-Regression huggingface dataset:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;

int main() {
	int i, j,k;
	int A[3][3] = {};
	int N;
	int b[100] = {};
	bool ans = false;
	int binary[3][3] = {};

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


	for (k = 0; k < N; ++k) {
		for (i = 0; i < 3; ++i) {
			for (j = 0; j < 3; ++j) {
				if (b[k] == A[i][j]) {
					binary[i][j] = 1;
				}
			}
		}
	}

/*	for (i = 0; i < 3; ++i) {
	for (j = 0; j < 3; ++j) {
		cout<< binary[i][j]<<" ";
	}
	cout << endl;
}*/

	for (i = 0; i < 3; ++i) {
		if ((binary[i][0] == 1)&&  (binary[i][1] ==1)&& (binary[i][2]==1)) {
			ans = true;
		}
	}

	for (i = 0; i < 3; ++i) {
		if ((binary[0][i] == 1) && (binary[1][i] == 1) && (binary[2][i] == 1)) {
			ans = true;
		}
	}

	if ((binary[0][0] == 1) && (binary[1][1] == 1) && (binary[2][2] == 1)) {
		ans = true;
	}

	if ((binary[0][2] == 1) && (binary[1][1] == 1) && (binary[2][0] == 1)) {
		ans = true;
	}


	if (ans == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using ll =  long long;

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

using namespace std;

int main(){

    int A, B, C, D;

    cin >> A >> B >> C >> D;
    string ans;
    rep(i,100){
        C-=B;
        if(C<=0){
            ans="Yes";
            break;
        }
        A-=D;
        if(A<=0){
            ans="No";
            break;
        }
    }    

    cout << ans << endl;

    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T & ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T & ref, const T value) {
    if (ref < value) ref = value;
}

const ll mod = 1000000007;


int main() {
	while (true) {
		ll n, w, d;
		cin >> n >> w >> d;
		if (!n && !w && !d) return 0;

		vector<P> vs(n);
		rep(i, n) {
			cin >> vs[i].first >> vs[i].second;
			vs[i].first--;
		}
		vector<t4> cakes;
		cakes.emplace_back(0, w*d, w, d);
		for (int i = 0; i < n; i++) {
			auto id = vs[i].first;
			ll j, j1, wi, di;
			tie(j, j1, wi, di) = cakes[id];
			cakes.erase(cakes.begin() + id);
			auto cut = vs[i].second % (2*(wi+di));
			if (cut < wi) {
				cakes.emplace_back(i, (wi - cut)*di, wi - cut, di);
				cakes.emplace_back(i, cut*di, cut, di);
			}
			else if (cut < wi + di) {
				cakes.emplace_back(i, wi*(di - (cut - wi)), wi, di - (cut - wi));
				cakes.emplace_back(i, wi* (cut - wi), wi, (cut - wi));
			}
			else if (cut < wi + di + wi) {
				cakes.emplace_back(i, (cut - wi - di) * di, cut - wi - di, di);
				cakes.emplace_back(i, (wi - (cut - wi - di))*di, wi - (cut - wi - di), di);
			}
			else {
				cakes.emplace_back(i, wi* (2 * (wi + di) - cut), wi, (2*(wi + di) - cut));
				cakes.emplace_back(i, wi*(di - (2 * (wi + di) - cut)), wi, di - (2 * (wi + di)- cut));
			}
			sort(cakes.begin(), cakes.end());
		}
		vector<ll> area;
		for (auto p : cakes) {
			ll a, b, c, d;
			tie(a, b, c, d) = p;
			area.push_back(b);
		}
		sort(area.begin(), area.end());
		int s = area.size();
		for (int i = 0; i < s; i++) {
			cout << area[i];
			if (i != s - 1) cout << " ";
		}
		cout << endl;
	}
	return 0;
}




Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;

ll mod=1000000007;
int main(){
    ll n,k;
    cin>>n>>k;
    ll result=0;
    for(ll i=k;i<=n+1;i++){
        ll sum=n*(n+1)/2;
        ll bigl=(n-i+1)*(n-i)/2;
        ll sma=i*(i-1)/2;
        result+=(sum-bigl-sma+1LL) % mod;
    }

    cout<<result%mod<<endl;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VMAX 100000
int main(){
  int n, W;
  cin >> n >> W;
  ll w[n], v[n];
  ll sum = 0;
  for(int i = 0; i < n; i++){
    cin >> w[i] >> v[i];
    sum += w[i];
  }
  ll dp[VMAX+10] = {};
  for(int i = 0; i <= VMAX; i++)
    dp[i] = sum+1000;
  dp[0] = 0;
  for(int i = 0; i < n; i++){
    for(int j = VMAX; j >= 0; j--){
      if(j-v[i]<=0) // 価値が今見てるのだけで達成出来る時
        dp[j] = min(w[i], dp[j]);
      else{
        if(dp[j-v[i]] == sum+1000) continue;
        dp[j] = min(dp[j-v[i]] + w[i], dp[j]);
      }
    }
  }
  ll ans = 0;
  for(int i = 0; i <= VMAX; i++){
    if(dp[i] <= W && dp[i] != sum + 1000)
      ans = i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

typedef struct{
  char sub;
  int figure;
  int order;
}card;

int partition(card*,int,int);
void quicksort(card*,int,int);
void swap(card*,int,int);
bool stablenor(card*,int);
int main(){
  int n,i,temp,r,l,flag=0;
  int *stablejudge;
  card *list;
  scanf("%d",&n);
  list=(card*)malloc(n*sizeof(card));
for(i=0;i<n;i++){
  scanf("%*c%c%d",&((list+i)->sub),&((list+i)->figure));
  ((list+i)->order)=i;
}
  r=n-1;
  l=0;
quicksort(list,l,r);
printf("%s\n",(stablenor(list,n)!=true)?"Not stable":"Stable");
  for(i=0;i<n;i++)printf("%c %d\n",((list+i)->sub),((list+i)->figure));
  return 0;
}
int partition(card *l,int left,int right){
int i;
  for(i=left;i<right;i++){
    if((l+right)->figure>=(l+i)->figure){
      swap(l,i,left);
      left++;
    }
  }
  swap(l,left,right);
  return left;
}
void quicksort(card *l,int left,int right){
int q;
  if(left<right){
    q=partition(l,left,right);
    quicksort(l,left,q-1);
    quicksort(l,q+1,right);
  }
}
void swap(card *x,int a,int b){
  card c;
  c=*(x+a);
  *(x+a)=*(x+b);
  *(x+b)=c;
}
bool stablenor(card *l,int n){
  while(n-1){
    if(((l+(n-2))->figure)==((l+(n-1))->figure)&&((l+(n-2))->order)>((l+(n-1))->order))return false;
    n--;
  }
  return true;
}



Measured memory_bytes: 2828
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;

 int main()
 {
   int arr[10];
   string s;
   while(cin>>s)
   {
     for(int i=0;i<10;i++) arr[i]=(s[i]-'0');
     int N=9;
     while(N)
     {
       for(int i=0;i<N;i++)
       {
         arr[i]=(arr[i]+arr[i+1])%10;
       }    
       N--;    
     }             
     cout<<arr[0]<<endl;
   }
   //while(1);
   return 0;
 }

 
  

Measured memory_bytes: 3112
n = int(input())
ans = 0
for i in range(1,12):
    num = (26**i)
    ans += num
    if ans == n:
        print("z"*i)
        exit()
res1,res2 = divmod(n,26)
res = ""
if res1 < 1:
    res = chr(res2+96)
elif res1>26:
    while n>0:
        div,mod = divmod(n,26)
        if mod==0:
            res += 'z'
            n = (n//26)-1
        else:
            res += chr(mod+96)
            n //= 26 
    res = res[::-1]
else:
    res += chr(res1+96)+chr(res2+96) if res2>0 else chr(res1+95)+"z"
print(res)

Measured memory_bytes: 9192
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N,K;
    vector<int> A; 
    cin >> N >> K;
    int cur;
    REP(i,0,N){
        cin >> cur;
        A.push_back(cur);
    }
    int ans=0;
    while(1){
        ans++;
        if(N-K<=0) break;
        N=N-K+1;
    }
    P(ans);
    
}

Measured memory_bytes: 892
//  ©   ___MRX___

#include <bits/stdc++.h>
    using namespace std;

#define ll long long int

int main()
{
    int n, m, c, flag = 0, total = 0, i, j;
    cin >> n >> m >> c;

    vector<int> b(n);
    vector<vector<int>> a(n, vector<int> (m));

    for(i = 0; i < m; i++) {
        cin >> b[i];
    }

    for(i = 0; i < n; i++) {
        for(j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    for(i = 0; i < n; i++) {
        for(j = 0; j < m; j++) {
            total += (b[j] * a[i][j]);
        }
        total += c;
        if(total > 0) flag++;
        total = 0;
    }

    cout << flag << '\n';

    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
  ll n; cin >> n;
  ll ans = 0;
  repr(i,1,n+1){
    ans += (ll)i*(n-i+1);
  }
  rep(i,n-1){
    int u,v; cin >> u >> v;
    if(u > v) swap(u,v);
    ans -= (ll)u*(n-v+1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#include <iomanip>
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; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}


ll modpow(ll a,ll p){
    if(p==0) return 1;
    if(p%2==0){
        ll halfp = p/2;
        ll half = modpow(a,halfp);
        return half * half % MOD;
    }else{
        return a * modpow(a,p-1) % MOD;
    }
}

ll calcComb(ll a,ll b){
    if (b > a-b){
        return calcComb(a,a-b);
    }
    ll ansMul = 1;
    ll ansDiv = 1;
    REP(i,b){
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    ll ans = ansMul * modpow(ansDiv,MOD-2) ;
    ans %= MOD;
    return ans;
}

//素因数分解
//ある数の指数乗で表す
vector<pair<long long,long long>> prime_factorize(long long n){
    vector<pair<long long, long long>> res;
    for(long long p = 2; p * p <= n ; ++p){
        if ( n % p != 0) continue;//因数じゃない
        int num = 0;
        while (n % p == 0) {++num ; n/= p;}
        res.push_back(make_pair(p,num));
    }
    if(n!=1) res.push_back(make_pair(n,1));//nが素数だった場合
    return res;
}


int main ()
{
    int a, b, c, d;cin>>a>>b>>c>>d;
    if(abs(a-c)<=d){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(abs(a-b)<=d and abs(b-c)<=d){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    int n,k;
    cin>>n>>k;
    int sum = 0;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    sort(all(v),greater<int>());
    
    rep(i,k)sum+=v[i];
    
    cout<<sum<<endl;
}


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

typedef long long LL ;
const int N = 1000010 , mod = 1000000007 ;
int a[N];
int main()
{
	int n , k ;
	scanf("%d%d",&n,&k);
	for(int i = 0 ; i < n ; i ++) scanf("%d",&a[i]);

	sort(a,a + n);

	LL res = 1 ; //乘积初始化
	int l = 0 , r = n - 1 ;//双指针初始化
	int sign = 1 ; // 符号初始化

	//由于4种情况除了 k 是奇数且 k < n 的时候需要特判一下处理一下符号 ,其他的时候都可以转化为双指针做法
	//k 是奇数是先选出最大的数, k-- 就是偶数,两边再同时取对,转化成相同的双指针做法
	if(k % 2 )
	{
		res =  (a[r])%mod; // 取出最大的一个数
		r -- ; //右指针移动
		k -- ; //个数减1

		if(res < 0) sign = -1;  // 如果最大值都是负数,就证明全是负数,那么符号要发生改变
	}
	while(k) // 双指针做法
	{
		LL x = (LL)a[l] * a[l + 1] , y = (LL)a[r] * a[r - 1];//两边同时取对
		//选择更大的一对,和归并排序思路相近
		if(x * sign > y * sign)
		{
			res = (x % mod * res % mod)%mod; // 需要注意的是 :不可以写成(x * res) % mod ,也不可以写成是 res % mod * x % mod
			// 因为x最大是 10^10，如果不先取模的话，和res相乘的结果最大是 10^19,会暴long long。
			l += 2; // 指针移动
		}
		else
		{
			res = (y % mod * res % mod)%mod;
			r -= 2;
		}
		k -= 2;
	}
	cout<<(res+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
#define  sf  scanf
#define  pf  printf
int main()
{
    int i,j,n,s,c=0;
    char a[100];
    sf("%s",a);
    for(i=0; a[i]!='\0';i++)
    {
        if(a[i]=='+')
        {
            c++;
        }
        else if(a[i]=='-')
        {
            c--;
        }
    }
    pf("%d\n",c);
    return 0;
}


Measured memory_bytes: 256
/*https://atcoder.jp/contests/abc084/tasks/abc084_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#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
	int a, b;
	string s;
	cin >> a >> b >> s;
	if (s.size() != a + b + 1 || s[a] != '-')
	{
		cout << "No";
		return 0;
	}
	for (int i = 0; i < s.size(); i++)
	{
		if (i != a)
		{
			if (s[i] < 48 || s[i] > 57)
			{

				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 3608
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Program {
    static Scanner cin = new Scanner();

    internal static void Main(string[] args) {
        var N = cin.nextInt();
        string ans = "";
        while(N!=0) {
            if (N % 2 != 0) {
                N--;
                ans = "1" + ans;
            } else {
                ans = "0" + ans;
            }
            N /= -2;
        }

        if (ans == "") { ans = "0"; }
        WriteLine(ans);
    }
}




class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<int> l(Q), r(Q);
  for (int i = 0; i < Q; ++i)
    cin >> l[i] >> r[i];

  vector<int> sum(N);
  for (int i = 0; i < N - 1; ++i)
    if (S[i] == 'A' && S[i + 1] == 'C')
      ++sum[i + 1];
  for (int i = 2; i < N; ++i)
    sum[i] += sum[i - 1];

  for (int i = 0; i < Q; ++i)
    cout << sum[r[i] - 1] - sum[l[i] - 1] << endl;
}

Measured memory_bytes: 2176
#ifdef _DEBUG
#include ".vscode/debug_print.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1050000000;
constexpr long long INF64 = 4000000000000000000;
constexpr int MOD7        = 1000000007;
constexpr int MOD53       = 998244353;
constexpr long double PI  = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void vprint() { std::cout << '\n'; }
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}

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

    string s;
    scan(s);
    deque<string> ans;
    ans.push_front(s);
    int Q;
    scan(Q);
    int t = 0;
    for (size_t i = 0; i < Q; i++) {
        int a;
        scan(a);
        if (a == 1) {
            t++;
        } else {
            int f;
            string c;
            scan(f, c);
            if ((f == 1) ^ (t % 2)) {
                ans.push_front(c);
            } else {
                ans.push_back(c);
            }
        }
    }
    size_t size = ans.size();
    if (t % 2 == 1) {
        for (int i = size - 1; i >= 0; i--) {
            string out = ans.back();
            if (1 < out.size()) {
                reverse(out.begin(), out.end());
            }
            std::cout << out;
            ans.pop_back();
        }
        std::cout << std::endl;

    } else {
        for (size_t i = 0; i < size; i++) {
            std::cout << ans.front();
            ans.pop_front();
        }
        std::cout << std::endl;
    }

    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

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

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int field[110][110];
PII p[110][110];

int dfs(int x, int y, int num) {
  while(field[x][y] == 0) {
    field[x][y] = num;
    int nx = p[x][y].first, ny = p[x][y].second;
    x = nx, y = ny;
  }

  if(field[x][y] == num) return 1;
  else return 0;
}

int main() {
  int n;  

  while(cin >> n, n) {

   REP(i, n) {
      REP(j, n) {
	int x, y;
	cin >> x >> y;
	p[i][j] = MP(y, x);
	field[i][j] = 0;
      }
    }

   int ans = 0;
   int cnt = 1;
   REP(i, n) {
     REP(j,n) {
       if(field[i][j] == 0) {
	 ans += dfs(i, j, cnt);
	 cnt++;
       }
     }
   }
   cout << ans << endl;
  }	
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
void swap(int& x, int& y){
    int tmp;
    tmp = x;
    x = y;
    y = tmp;
}

int main(void){
    int x, y, z;
    std::cin >> x >> y >> z;
    swap(x, y);
    //std::cout << x << " " << y << " " << z << std::endl;

    swap(x, z);
    std::cout << x << " " << y << " " << z << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  ll n = SZ(s);
  string t(n, 'x');
  cout << t << endl;
}

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

int main() {
    int a[5], k;
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    cin >> k;
    
    bool b = true;
    if(a[4] - a[0] > k) b = false;
    
    if (b) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class Main {

  public static void main(String[] args) {
    final FastScanner sc = new FastScanner();
    final PrintWriter writer = new PrintWriter(System.out);
    char[] c = sc.next().toCharArray();
    int i = 0;
    int j = c.length - 1;
    int count = 0;
    while (i < j) {
      if (c[i] != c[j]) {
        count++;
      }
      i++;
      j--;
    }
    writer.println(count);
    writer.flush();
    writer.close();
  }

  // FastScanner --
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte())
        return buffer[ptr++];
      else
        return -1;
    }

    private boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr]))
        ptr++;
      return hasNextByte();
    }

    public String next() {
      if (!hasNext())
        throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext())
        throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
        throw new NumberFormatException();
      return (int) nl;
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}

Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;


int main(){

  long long int x;
  cin >> x;

  long long int tmp = x/11;
  long long int tmp2 = x%11;
  if( tmp2 == 0 ) cout << tmp*2 << endl;
  else cout << ( tmp2 > 6 ? tmp * 2 + 2 : tmp*2 + 1 ) << endl;

  return 0;
}








// EOF


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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    d = [int(e) for e in lines[0].split(' ')][0]
    cc = [int(e) for e in lines[1].split(' ')]
    ss = []
    for i in range(d):
        ss.append([int(e) for e in lines[i+2].split(' ')])


    return (d, cc, ss)


def solve(d, cc, ss):

    def minus(d, last_d):
        total = 0
        for i in range(26):
            ld = last_d.get(i, 0)
            total = total + cc[i] * (d - ld)
        return total


    t = []
    last_d = dict()
    for i in range(1, d + 1):

        s = ss[i-1]
        max_satis = None
        max_satis_index = None
        for j in range(26):
            last_d_tmp = last_d.copy()
            last_d_tmp[j] = i

            satis = s[j] - minus(i, last_d_tmp)
            if max_satis is None or satis > max_satis:
                max_satis = satis
                max_satis_index = j
        
        last_d[max_satis_index] = i
        t.append(max_satis_index + 1)
        


    return t
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 68816
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
if a <= 0 <= b:
    print('Zero')
elif a > 0:
    print('Positive')
elif b < 0:
    if (b - a) % 2 == 0:
        print('Negative')
    else:
        print('Positive') 

Measured memory_bytes: 38384
#include <iostream>

using namespace std;


int mp[2048][2048];
int main(){
    int sh,sm,ss,eh,em,es;
    for(int i=0;i<3;++i){
        cin>>sh>>sm>>ss>>eh>>em>>es;
        int wt = (eh-sh)*3600+(em-sm)*60+(es-ss);
        cout<<wt/3600<<" "<<wt/60%60<<" "<<wt%60<<endl;
    }
    return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<int> a,b;
    vector<int> p(N);
    REP(i,N) cin >> p[i];
    REP(i,N) a.push_back((i+1)*N);
    REP(i,N) b.push_back((N-i)*N);
    REP(i,N) b[p[i]-1] += i;
    REP(i,N){
        if(i) cout << ' ';
        cout << a[i];
    } 
    cout << endl;
    REP(i,N){
        if(i) cout << ' ';
        cout << b[i];
    } 
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main() {
    int a,b;
    cin >> a >> b;
    if(a>b) {
        if(b==1){
            cout << "Bob" << "\n";
        }else cout << "Alice" << "\n";
    } else if(a<b) {
        if(a==1){
            cout << "Alice" << "\n";
        }else cout << "Bob" << "\n";
    }else cout << "Draw" <<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
char in[1100];
int at=0;
pair<int,int>expr(int a,int b);
pair<int,int>term(int a,int b){
	if('0'<=in[at]&&in[at]<='9'){
		if(in[at]=='0'){
			at++;
			return make_pair(0,at-1);
		}
		pair<int,int>ret=make_pair(-2,0);
		if(in[at]-'0'>b){
			ret=make_pair(b+1,at);
		}
		if((a>(in[at]-'0')*10+9)){
			ret=make_pair(a-1,at);
		}
		int v=0;
		while('0'<=in[at]&&in[at]<='9'){
			v*=10;v+=in[at]-'0';
			at++;
		}
		if(ret.first==-2){
			if(v>=10)ret=make_pair(v,at-1);
			else ret=make_pair(v,at);
		}
		return ret;
	}else{
		return expr(a,b);
	}
}
pair<int,int>expr(int a,int b){
	//printf("%d %d %d\n",at,a,b);
	if(in[at]!='^'&&in[at]!='_'){
		return term(0,99);
	}
	int z=0;
	if(in[at]=='^'){
		z=1;
	}
	at+=2;
	pair<int,int> tmp=term(a,b);
	pair<int,int>ret=make_pair(-2,-2);
	if(z==0&&tmp.first==0)ret=tmp;
	if(z==1&&tmp.first==99)ret=tmp;
	if(tmp.first!=-1&&z==0&&a>tmp.first)ret=tmp;
	if(tmp.first!=-1&&z==1&&b<tmp.first)ret=tmp;
	at++;
	int L=a;int R=b;
	if(z==0){if(tmp.first!=-1)R=min(R,tmp.first-1);}
	else {if(tmp.first!=-1)L=max(L,tmp.first+1);}
	pair<int,int> tmp2=term(L,R);

	if(tmp.first==-1&&z==0)tmp.first=110;
	if(tmp2.first==-1&&z==0)tmp2.first=110;
	if(ret.first==-2){
		if(z==0)ret.first=min(tmp.first,tmp2.first);
		else ret.first=max(tmp.first,tmp2.first);
		ret.second=tmp2.second;
	}
	at++;
	return ret;
}
int main(){
	int a;scanf("%d",&a);
	while(a--){
		scanf("%s",in);
		at=0;
		pair<int,int> ret=expr(0,99);
		printf("%d %d\n",ret.first,ret.second+1);
	}
}

Measured memory_bytes: 128
using System;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        if (s.Contains("RRR"))
        {
            Console.WriteLine(3);
        }
        else if (s.Contains("RR"))
        {
            Console.WriteLine(2);
        }
        else if (s.Contains("R"))
        {
            Console.WriteLine(1);
        }
        else
        {
            Console.WriteLine(0);
        }
    }
}

Measured memory_bytes: 25820
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
#define allchar(c) for(char c='a';c<='z';c++)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef queue<int> qi;

const int mod=1e9+7;

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

string tostring(int n){
    string str;
    while(n){
        char x='0'+n%10;
        str.pb(x);
        n/=10;
    }
    return str;
}
#define pi pair<int,int>
#define ppi pair<int,pi>
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<ppi> p(m);
    rp(i,m){
        int a,b;
        cin >> a >> b;
        p[i]=make_pair(b,make_pair(a,i));
    }
    sort(p);
    vs ans(m);
    int pref[n];
    rp(i,n){
        pref[i]=0;
    }
    rp(i,m){
        pref[p[i].second.first-1]++;
        ans[p[i].second.second]="";
        S s="";
        S t=tostring(p[i].second.first);
        rp(j,6-t.size()){
            s+="0";
        }
        rp(j,t.size()){
            s+=t.at(t.size()-1-j);
        }
        ans[p[i].second.second]+=s;

        s="";
        t=tostring(pref[p[i].second.first-1]);
        rp(j,6-t.size()){
            s+="0";
        }
        rp(j,t.size()){
            s+=t.at(t.size()-1-j);
        }
        ans[p[i].second.second]+=s;
    }
    vcout(ans);
    return 0;
}


Measured memory_bytes: 8576
n, k = map(int, input().split())
a = list(map(int, input().split()))

ruiseki = [0] * (n+1)
for i in range(n):
    ruiseki[i+1] = ruiseki[i] + a[i]

for i in range(n + 1):
    ruiseki[i] -= i
    ruiseki [i] %= k

memo = {}
cnt = 0
ans = 0
for i in range(n+1):
    if ruiseki[i] in memo:
        ans += memo[ruiseki[i]]

    if ruiseki[i] in memo:
        memo[ruiseki[i]] += 1
    else:
        memo[ruiseki[i]] = 1

    if cnt < k - 1:
        cnt += 1
    else:
        memo[ruiseki[i-cnt]] -= 1 

print(ans)        
        

Measured memory_bytes: 111308
n = int(input())
s = ["" for i in range(n)]
t = [0 for i in range(n)]
for i in range(n):
    a, b = input().split()
    s[i], t[i] = a, int(b)
x = input()
ans = 0
flag = False
for i in range(n):
    if s[i] == x:
        flag = True
    elif flag:
        ans += t[i]
print(ans)

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

int main(){
  int n;
  int num[5];
  int l[5],s[5];
  int ans;

  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    for(int i=3;i>=0;i--){
      num[i]=n%10;
      n/=10;
    }
    ans=0;
    while(1){
      if(num[0]==6 && num[1]==1 && num[2]==7 && num[3]==4){
	cout << ans << '\n';
	break;
      }
      if(num[0]==num[1] && num[1]==num[2] && num[2]==num[3]){
	cout << "NA\n";
	break;
      } 
      sort(num,num+4,greater<int>());
      for(int i=0;i<4;i++){
	l[i]=num[i];
      }
      int j=3;
      for(int i=0;i<4;i++){
	s[i]=num[j];
	j--;
      }
      
      for(int i=3;i>=0;i--){
	if(l[i]<s[i]){
	  l[i]+=10;
	  l[i-1]--;
	  num[i]=l[i]-s[i];
	}else{
	  num[i]=l[i]-s[i];
	}
      }
      ans++;
    }
  }
  
  return 0;
}



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

ll f(ll n) {
    if (n < 2) return 0;
    return n * (n-1) / 2;
}

int main() {
    ll n;
    cin >> n;
    vector<int> a(n);
    vector<ll> c(n+1);
    rep(i, n) {
        cin >> a[i];
        c[a[i]]++;
    }
    ll sum = 0;
    rep(i, n+1) {
        sum += f(c[i]);
    }
    rep(i, n) {
        ll ans = sum - (c[a[i]] - 1);
        cout << ans << endl;
    }
}

Measured memory_bytes: 5640
#include<stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m<=50 && f<=50 && r<=100 && m>=-1 && f>=-1 && r>=-1){
            if(m==-1 && f==-1 && r==-1){
            break;
             
            }else if(m==-1 || f==-1){
            printf("F\n");
                 
            }else if(80<=m+f){
            printf("A\n");
             
            }else if(65<=m+f && 80>m+f){
            printf("B\n");
             
            }else if(50<=m+f && 65>m+f){
            printf("C\n");
             
            }else if(30<=m+f && 50>m+f){
             
                if(50<=r){
                printf("C\n");
             
                }else{
                printf("D\n");
                }
             
            }else{
                printf("F\n");
            }
             
        }
         
    }return 0;
     
}


Measured memory_bytes: 2072
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int t = 0;
		int h = 0;
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String taro = scan.next();
			String hana = scan.next();
			if(taro.compareTo(hana) > 0){
				t += 3;
			} else if(taro.compareTo(hana) < 0){
				h += 3;
			} else {
				t++;
				h++;
			}
		}
		System.out.printf("%d %d\n", t, h);
	}
}

Measured memory_bytes: 30220
import itertools

N=int(input())
L=list(map(int,input().split()))
L.sort()
l=list(itertools.combinations(L,3))

ans=0
for i in l:
    if len(i)==len(set(i)) and i[2]<i[1]+i[0]:
        ans+=1

print(ans)





        




    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














Measured memory_bytes: 20480
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A, B;
    cin >> A >> B;
    int v = 10 * B;
    while(true){
        if(v == 10 * (B + 1)) {
            cout << -1;
            return 0;
        }
        if(100 * A <= v * 8 && 100 * (A + 1) > v * 8) {
            cout << v;
            return 0;
        }
        v++;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    
    int n = scan.nextInt();
    int a = scan.nextInt();
    int b = scan.nextInt();
    
    int x = a * n;
    
    if (x > b) {
    	System.out.print(b);
    } else {
    	System.out.print(x);
    }
  }
}


Measured memory_bytes: 23252
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll dp[301][301];

ll gcd(ll a, ll b){
  if(dp[a][b]>0)return dp[a][b];
  ll r = a%b;
  if(r==0) return b;
  else{
    ll tmp =  gcd(b, a%b);
    dp[a][b]= tmp;
    return dp[a][b];
  }
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll K;
  cin >> K;
  ll ans = 0;
  for(int i = 1;i<=K;i++){
    for(int j=1;j<=K;j++){
      for(int k = 1; k<=K; k++){
        ll a = gcd(i, j);
        a = gcd(a, k);
        ans += a;
      }
    }
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 3676
def main():
    n = int(input())
    nums = [int(input()) for i in range(n)]

    maxv = nums[1]-nums[0]
    minv = nums[0]

    for i in range(1, n):
        if maxv < nums[i]-minv:
            maxv = nums[i]-minv
        if minv > nums[i]:
            minv = nums[i] 
   
    print(maxv)

if __name__ == "__main__":
    main()


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

int main(){
    string str;
    cin>>str;
    
    
	for(int i=0; i<str.length(); i++){
		if(str[i] == '?'){
			str[i] = 'D'; 
		}
	} cout<<str<<endl; 	
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n, k, c;
  std::cin >> n >> k >> c;
  std::string s;
  std::cin >> s;

  std::vector<int64_t> fast(k), slow(k);

  {
    int64_t index = 0;
    for (int64_t i = 0; i < k; i++) {
      while (s[index] == 'x') {
        index++;
      }
      fast[i] = index;
      index += c + 1;
    }
  }

  {
    int64_t index = n - 1;
    for (int64_t i = k - 1; 0 <= i; i--) {
      while (s[index] == 'x') {
        index--;
      }
      slow[i] = index;
      index -= c + 1;
    }
  }

  for (int64_t i = 0; i < k; i++) {
    if (fast[i] == slow[i]) {
      std::cout << fast[i] + 1 << std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 4996
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int n;cin>>n ;
    int val = (int)ceil((double)n/1.08) ;
    //cout<<"val :"<<val<<endl ;
    if(floor(val*1.08)==n) cout<<val<<"\n" ;
    else cout<<":(\n" ;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

int N;
int A[200000];
int B[200000];

int main(void) {
	int i;
	uint64_t count = 0;
	int saisyokaraonazi = 1;
	int min_b = 1000000001;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d%d", &A[i], &B[i]) != 2) return 1;
		if (A[i] != B[i]) saisyokaraonazi = 0;
	}
	/* 最初から同じなら、操作回数は0 */
	if (saisyokaraonazi) {
		puts("0");
		return 0;
	}
	/* A[i] <= B[i] の所を減らしていく */
	for (i = 0; i < N; i++) {
		if (A[i] <= B[i]) {
			count += A[i];
			B[i] -= A[i];
			A[i] = 0;
		}
	}
	/* にゃーん */
	for (i = 0; i < N; i++) {
		/* 0にする分の操作は必要、最後に残す所以外のA[i] > B[i]は壊れる */
		count += B[i];
		/* どこを残すかを決める */
		if (A[i] > 0 && B[i] < min_b) min_b = B[i];
	}
	/* 残す分を引く */
	count -= min_b;

	printf("%"PRIu64"\n", count);
	return 0;
}

/*
とざん君
・Aの要素を減らす
・操作回数を最大にしたい → 同じ数にされたくない
げざん君
・Bの要素を減らす
・操作回数を最小にしたい → 同じ数にしたい

A[i] > B[i] → 減らしちゃうと損 → 避ける
A[i] = B[i] (> 0) → とざん君が減らすことで同じじゃなくできる → 減らす
A[i] < B[i] → とざん君が減らすことで逃げられる → 減らす

A[i] <= B[i] の所が全てA[i] == 0になった時点で、
(A[i] > B[i]の所のA[i] - B[i]の合計) == (A[i] == 0の所のB[i]の合計)

とざん君はA[i]を減らさない限りA[i] > B[i]を守れる
とざん君がA[i] == B[i]を新たに作ったとき、げざん君はわざわざそれをぶっ壊さない
→ とざん君が次の手でそれをぶっ壊す → げざん君が追いかける

とざん君はB[i]が一番小さいところのA[i] > B[i]を最後まで守れば良い
*/


Measured memory_bytes: 256
s = str(input())

if len(s)==2 and s[0]==s[1]:
    print(1,2)
    exit()

for i in range(0,len(s)-2):
    buff = s[i:i+3]
    if buff[0]==buff[2]:
        print(i+1,i+3)
        exit()
    elif buff[0]==buff[1]:
        print(i+1,i+2)
        exit()
    elif buff[1]==buff[2]:
        print(i+2,i+3)
        exit()
print(-1,-1)




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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define REP(i,n) for(int i = 1; i < (n); i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n")

using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;

const int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int dy[8] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1; 


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

  double a, b, c;
  cin >> a >> b >> c;
  c = c/180.0 * 3.1415926535;
  double s = a*b*sin(c)/2.0;
  printf("%.10lf\n", s);
  double l = a+b+ sqrt(pow(a,2.0) + pow(b,2.0) - 2.0*a*b*cos(c));
  printf("%.10lf\n", l);
  double h = s*2 / a;
  printf("%.10lf\n",h);

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))
template<typename T> inline bool __max__(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool __min__(T &x, const T &y) { return x > y ? x = y, 1 : 0; }

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

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

    long x, y, z;

    cin >> x >> y >> z;

    bool isSpace = true;
    long ans = 0L;

    long i = 0;

    while (i <= x) {
        if (isSpace) {
            i += z;
            isSpace = false;
        } else {
            if (i + y + z <= x) {
                i += y;
                ans++;
                isSpace = true;
            } else {
                break;
            }
        }
    }

    cout << ans << '\n';

    return 0;
}


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

using namespace std;

int Bsearch(int);

vector<int>num2;

int main(void){
int n,m,t;
vector<int>num;

while(cin >> n >> m,n|m){
num.clear();
num2.clear();

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

num.push_back(0);

for(int i=0;i<num.size();i++){
for(int j=0;j<num.size();j++){
num2.push_back(num[i]+num[j]);
}
}
sort(num2.begin(),num2.end());
vector<int>::iterator it = unique(num2.begin(),num2.end());
num2.erase(it, num2.end() );

int ans=0,c=num2.size(),tmp;
for(int i=0;i<c;i++){
tmp=Bsearch(m-num2[i]);
if(tmp+num2[i]>ans && tmp+num2[i]<=m)ans=tmp+num2[i];
}
cout << ans << endl;
}

return 0;
}

int Bsearch(int x){
int l=0,r=num2.size(),mid;

while(r-l>1){
mid=(l+r)/2;
if(num2[mid]>x)r=mid;
else if(num2[mid]==x)return num2[mid];
else if(num2[mid]<x)l=mid;
}
if(num2[mid]>x)return num2[mid-1];
return num2[mid];
}

Measured memory_bytes: 7312
#define MOD 1000000007;
#define input ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define  ll long long

#include <bits/stdc++.h>

using namespace std;
const int N = 2e5 + 5;

int main() {
    ll a,b;
    cin>>a>>b;
    cout<<a*b;
}

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

int main() {
	long h,w,ans,i;
	cin >> h >> w;
	vector<long> a(3);
	if((h*w)%3==0){
		ans=0;
	}else{
		ans=min(h,w);
		for(i=1; i<w; i++){
			a[0]=h*i;
			a[1]=(h/2)*(w-i);
			a[2]=(h-(h/2))*(w-i);
			sort(a.begin(),a.end());
			ans=min(a[2]-a[0],ans);
		}
		for(i=1; i<h; i++){
			a[0]=w*i;
			a[1]=(w/2)*(h-i);
			a[2]=(w-(w/2))*(h-i);
			sort(a.begin(),a.end());
			ans=min(a[2]-a[0],ans);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
#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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    int flag=0;
    if(w==(x*2) && h==(y*2)) flag=1;
    cout << fixed << setprecision(15) << (w*h)/2 << " " << flag << "\n";
    return 0;
}   

Measured memory_bytes: 3728