akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdint>

int64_t const MOD = 1e9+7;

template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
typedef mod_int<MOD> mint;

int main() {
  int64_t N, K; std::cin >> N >> K;
  mint ans;
  for(int k = K; k <= N+1; ++k) {
    ans += mint(k)*(N-k+1) + 1;
  }
  std::cout << ans.v_ << std::endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int p;
        cin >> p;
        mp[p]++;
    }
    int t;
    cin >> t;
    bool ok = true;
    rep(i, t) {
        int p;
        cin >> p;
        if(mp[p] == 0) ok = false;
        else mp[p]--;
    }
    if(ok) YES(); else NO();
}

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

int main(){
  int y;
  cin>>y;
  queue<long long>x;
  for(int i=1;i<=9;i++){
  x.push(i);
  }
  for(int j=0;j<y;j++){
  if(j==y-1){
  cout<<x.front()<<endl;
  return 0;
  }
  if(x.front()%10!=0){
  x.push(10*x.front()+x.front()%10-1);
  }
  x.push(10*x.front()+x.front()%10);
  if(x.front()%10!=9){
  x.push(10*x.front()+x.front()%10+1);
  }
  x.pop();
  }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,b) for(int i= 0; i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define inp(a) for(auto& i : a) cin >> i;
#define out(a) for(auto i : a){cout << i << ' '};cout << endl;
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define MOD 1000000007
const int N = 2e5+7 ;
string s ;

int main(){fast ;
	char n,m ;
	cin >> n >> m ;
	if(n < m) cout << "<" << endl ;
	if(n > m) cout << ">" << endl ;
	if(n == m) cout << "=" << endl ;
}


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

ll solve(ll N) {
    if (N <= 1) {
        return 0;
    }
    ll tmp = N/3 + bool(N%3);
    return solve(tmp) + 1;
}

int main() {
    ll N;
    cin >> N;
    cout << solve(N) << endl;
    return 0;
}



Measured memory_bytes: 3100
n, d = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
p = []
cnt = 0
for j in range(n):
    for k in range(n):
        if j != k:
            wa = 0
            for t in range(d):
                wa += (l[j][t] - l[k][t]) ** 2
                #print(wa)
            if wa ** (1 / 2) % 1 == 0:
                cnt += 1
                
print(int(cnt / 2))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define int long long
using namespace std;

bool comp(pair<string,int>& a, pair<string,int>& b){
	if (a.first != b.first) return a.first < b.first;
	return a.second >= b.second;
}

signed main(){
 	int n;
	cin >> n;
	vector<pair<string,int>> v,init;
	map<pair<string,int>,int> m;
	for (int i=0; i<n; ++i){
		string s;
		int a;
		cin >> s >> a;
		v.emplace_back(s,a);
	}
	init=v;
	sort(v.begin(),v.end(),comp);
	for (int i=0; i<n; ++i){
		m[init[i]]=i+1;
	}
	for (int i=0; i<n; ++i){
		cout << m[v[i]] << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
vector<int> G[200000];
int add[200000];
void calc(int v, int p) {
	for (int to : G[v]) {
		if (to == p) continue;
		add[to] += add[v];
		calc(to, v);
	}
}
int main() {
	int N, Q;
	cin >> N >> Q;
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for (int i = 0; i < Q; i++) {
		int p, x;
		cin >> p >> x;
		p--;
		add[p] += x;
	}
	calc(0, -1);
	for (int i = 0; i < N; i++) cout << add[i] << " ";
	cout << endl;
}

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

using namespace std;

#define int long long

const int maxn=100005;

vector<int>cnt(maxn),a(maxn);

int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){cin>>a[i];++cnt[a[i]];}
    int sum=0;
    for(int i=1;i<=100000;i++){
        if(cnt[i])sum+=(i*cnt[i]);
    }
    int q;
    cin>>q;
    while(q--){
        int b,c;
        cin>>b>>c;
        sum-=(b*cnt[b]);
        sum-=(c*cnt[c]);
        sum=max(sum,0ll);
        cnt[c]+=cnt[b];
        cnt[b]=0;
        sum+=(c*cnt[c]);
        cout<<sum<<endl;
    }

}


Measured memory_bytes: 4632
#include<stdio.h>
#include<math.h>
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
    if(a > 0) printf("Positive");
    else if(a==0||(a<0&&b>0)) printf("Zero");
    else if((abs(b)-abs(a))%2!=0) printf("Positive");
    else printf("Negative");;
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>

#define MAX 100
#define INFTY 10e12//1<<31 // 2^31
#define N 100
#define N2 10000  // N * N
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(o) (o).begin(), (o).end()

/*
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/


using namespace std;

typedef long long ll;

int V, E, S[500010], T[500010], D[500010];
ll C[100010];

bool bellman_ford(int r)
{
  REP(i,V)
    C[i] = INFTY;
  C[r] = 0;
  int j;
  for(j = 0; j < V; j++)
  {
    bool update = false;
    REP(i,E)
    {
      int s = S[i], t = T[i], d = D[i];
      if(C[s] < INFTY && C[s] + d < C[t])
      {
        C[t] = C[s] + d;
        update = true;
      }
    }
    if(!update) break;
  }
  return j == V;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  cin >> V >> E; // V ???????????° E ????????°
  REP(i,E)
    cin >> S[i] >> T[i] >> D[i];
  REP(j,V)
  {
    if(bellman_ford(j))
    {
      cout << "NEGATIVE CYCLE" << endl;
      break;
    }
    REP(i,V)
    {
      if(C[i] == INFTY) printf("INF");
      else printf("%lld", C[i]);
      printf("%s",(i==V-1?"\n":" "));
    }
  }
  return 0;
}

Measured memory_bytes: 5344
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 500000;
const int MOD = 1e9 + 7;

int n, p, a[N], cnt[N], ans;
string s;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> p;
    cin >> s;
    if (p == 2 || p == 5)
    {
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            if ((s[i] - '0') % p == 0)
                ans += i + 1;
        }
        cout << ans;
        return 0;
    }
    for (int i = 0; i < n; i++) a[i] = s[i] - '0';
    long long c = 1;
    for (int i = n - 1; i >= 0; i--) a[i] = (c * a[i] + a[i + 1]) % p, c = 10 * c % p;
    for (int i = 0; i <= n; i++) cnt[a[i]]++;
    for (int i = 0; i < p; i++) ans += cnt[i] * (cnt[i] - 1) / 2;
    cout << ans;
}


Measured memory_bytes: 4756
S = input()
s = ""
for i in range(1, len(S) + 1):
    s += S[-i]


words = ["resare", "esare", "remaerd", "maerd"]

l = 0
while l < len(S):
    result = False
    for word in words:
        
        if s[l:l+len(word)] == word:
            result = True
            break
    if result:
        l += len(word)
    else:print("NO");exit()
print("YES")


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

int main(){
  string c1,c2;
  cin >>c1>>c2;
  string c3=c1,c4=c2;
  reverse(c1.begin(),c1.end());
  reverse(c2.begin(),c2.end());
  if (c1==c4 and c2==c3) cout <<"YES"<<endl;
  else cout <<"NO"<<endl;
}


Measured memory_bytes: 256
import sys


N, M = map(int, input().split())
bridge = [[] for _ in range(N)]
for x in sys.stdin.readlines():
    a, b = map(int, x.split())
    a -= 1; b -= 1
    bridge[a].append(b)

ans = 0
near = N
for i in range(N):
    if near == i:
        ans += 1
        near = N
    for e in bridge[i]:
        near = min(near, e)

print(ans)


Measured memory_bytes: 65072
#include <bits/stdc++.h>
#define MAX 1000000
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

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

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

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

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
	typedef string::iterator si;
	static void call(si it, si ed) {}
	template<typename T, typename ... aT>
	static void call(si it, si ed, T a, aT... rest) {
		string b;
		for(; *it!=','; ++it)
			if(*it!=' ')
				b+=*it;
		cout << b << "=" << a << " ";
		call(++it, ed, rest...);
	}
};

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

void solve() {
	int h, n;
	cin >> h >> n;
	int arr[n];
	int sum = 0;
	rep(i, 0, n) {
		cin >> arr[i];
		sum += arr[i];
	}

	if(sum >= h) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}

int main() {
	solve();

	// __test {
	// 	solve();
	// }
}

Measured memory_bytes: 3872
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
void solve(){
    int n;
    cin >> n;
    int ans = 0;
    int flag = 0;
    for(int i= 1, x, y; i <= n; i++){
        cin >> x >> y;
        if(x == y){
            ans++;
        }else{
            ans = 0;
        }
        flag |= (ans == 3);
    }
    cout << (flag ? "Yes\n" : "No\n");
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        solve();
    }
}

Measured memory_bytes: 27048
#include<stdio.h>
#define N 1000

int main(void){
  int i,j,num;
  int m[N]={0},d[N]={0};
  int dayCount[12][31];
  int day=1;

  for(i=0;i<12;i++){
    for(j=0;j<31;j++){
      if(i==1 && j>28)
        break;
      if(j>29)
        if(i==3 || i==5 || i==8 || i==10) break;
      dayCount[i][j]=day;
      day++;
    }
  }
  scanf("%d%d",&m[0],&d[0]);
  for(i=0;m[i]!=0;){
    i++;
    scanf("%d%d",&m[i],&d[i]);
  }
  num=i;
  for(i=0;i<num;i++){
    if(dayCount[m[i]-1][d[i]-1]%7==1) printf("Thursday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==2) printf("Friday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==3) printf("Saturday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==4) printf("Sunday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==5) printf("Monday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==6) printf("Tuesday\n");
    else if(dayCount[m[i]-1][d[i]-1]%7==0) printf("Wednesday\n");
  }
  return 0;
}

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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           P;
typedef vector<P>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;


const int INF = 1e8;



int main (){
    int n,m,r;
    cin >> n >> m >> r;
    vi R;
    REP(i,r){
        int mati;
       cin >> mati;
       R.push_back(mati-1);
    }
    vvi dist(n, vi(n,INF));
    REP(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        a--;
        b--;
        dist.at(a).at(b) = c;
        dist.at(b).at(a) = c;
    }
    REP(i,n){
        dist.at(i).at(i) = 0;
    }
    REP(k,n){
        REP(i,n){
            REP(j,n){
                dist.at(i).at(j) = min(dist.at(i).at(j), dist.at(i).at(k) + dist.at(k).at(j));
            }
        }
    }
    sort(R.begin(),R.end());

    int ans = INF;

    do{
        int total=0;
        REP(i,r-1){
            total += dist.at(R.at(i)).at(R.at(i+1));
        }
        ans = min(ans, total);


    }while(next_permutation(R.begin(), R.end()));

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 384
#include<iostream>
    #include<utility>
     
    typedef long long ll;
     
    using namespace std;
     
    ll A, B, C, D;
     
    ll gcd(ll a, ll b) {
    	ll r;
    	if (a < b) swap(a,b);
    	r = a % b;
    	while (r != 0) a = b, b = r, r = a % b;
    	return b;
    }
    ll lcm(ll a, ll b) {
    	return (a*b) / gcd(a, b);
    }
    	int main() {
    		ll a,b;
    		cin >> A >> B >> C >> D;
    		A--;
    		a = (A - (A / C) -( A / D) + (A / lcm(C, D)));
    		b = (B - (B / C) - (B / D) + (B / lcm(C, D)));
    		cout << b-a << endl;
    		return 0;
    	}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1163&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll V;
vector<vector<ll>> G;
vector<ll> match;
vector<int> used;

void add_edge(ll u, ll v) {
    G[u].push_back(v);
    G[v].push_back(u);
}

bool dfs(ll v) {
    used[v] = 1;
    for (int i = 0; i < G[v].size(); i++) {
        ll u = G[v][i], w = match[u];
        if (w < 0 || ((used[w] == 0) && dfs(w))) {
            match[v] = u;
            match[u] = v;
            return true;
        }
    }
    return false;
}

ll bipartite_matching() {
    ll res = 0;
    for (int i = 0; i < (int)match.size();i++)match[i] = -1;
    for (int v = 0;v < V;v++) {
        if (match[v] < 0) {
            for (int i = 0; i < (int)used.size();i++)used[i] = 0;
            if (dfs(v))res++;
        }
    }
    return res;
}
/*
 gcd : 最大公約数
 lcm : 最小公倍数
 */
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

int m,n;
ll solve(){
    ll res = 0;
    V = m+n;
    G.clear(); match.clear(); used.clear();
    G.resize(V); match.resize(V); used.resize(V);
    vector<int> b(m),r(n);
    for(auto& in:b) cin >> in;
    for(auto& in:r) cin >> in;
    for(int i = 0; i < m;i++){
        for(int j = 0; j < n;j++){
            if(gcd(b[i],r[j]) == 1) continue;
            add_edge(i,m+j);
        }
    }
    res = bipartite_matching();
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> m >> n,m|n){
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 5900
N = int(input())
W = [input() for i in range(N)]

result = True

for i in range(1, N):
    if W[i-1][-1] != W[i][0]:
        result = False
        break
    if W[i] in W[:i]:
        result = False
        break

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


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

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


int main() {
  ios:: sync_with_stdio(false);
  cin.tie();
  int d, t, s;
  cin >> d >> t >> s;
  cout << ((t * s) >= d ? "Yes" : "No") << '\n';
  return 0;
}




Measured memory_bytes: 3616
#include <stdio.h>
#define mod 1000000007

int main(void){
  int N;
  scanf("%d",&N);

  int insu[N+1];
  for(int i = 0;i <= N;i++){
    insu[i] = 0;
  }

  for(int i = 2;i <= N;i++){
    int sample = i;
    for(int j = 2;sample != 1;j++){
      if(sample%j == 0){
        while(sample%j == 0){
          sample /= j;
          insu[j]++;
        }
      }
    }
  }

  long long ans = 1;
  for(int i = 1;i <= N;i++){
    if(insu[i] != 0){
      ans *= insu[i]+1;
      ans %= mod;
    }
  }

  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 128
N = int(input())
S = []
for _ in range(N):
    S.append(input())
M = int(input())
T = []
for _ in range(M):
    T.append(input())

res = 0
s = set(S)
for x in s:
    v = S.count(x)-T.count(x)
    if v >= res:
        res = v
print(res) 

Measured memory_bytes: 38384
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    int A[N];
    int total = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        total += A[i];
    }

    if (total % (N * (N + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }

    int k = total / (N * (N + 1) / 2);
    int fall_sum = 0;

    for (int i = 0; i < N; i++) {
        int now_idx = i;
        int next_idx = i + 1;

        if (i == N - 1) {
            next_idx = 0;
        }

        if (A[next_idx] - A[now_idx] == k) continue;
        if (A[next_idx] - A[now_idx] > k) {
            cout << "NO" << endl;
            return 0;
        }

        int fall = (A[now_idx] + k) - A[next_idx];

        if (fall % N != 0) {
            cout << "NO" << endl;
            return 0;
        }

        fall_sum += fall / N;
    }

    if (fall_sum == k) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();		
		int c=sc.nextInt();
		int d=sc.nextInt();
		
		System.out.println(Math.abs(a-c)<=d||(Math.abs(a-b)<=d&&Math.abs(b-c)<=d)?"Yes":"No");
	}
}


Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int x, y, z;
	int f[10004];
	int i;
	for (i = 0; i <= n; i++)
		f[i] = 0;
	for (x = 1; x * x <= n; x++)
		for (y = 1; x * x + y * y <= n; y++)
			for (z = 1; x * x + y * y + z * z <= n; z++)
				if (x * x + y * y + z * z + x * y + x * z + z * y <= n)
					f[x * x + y * y + z * z + x * y + x * z + z * y]++;
	for (i = 0; i < n; i++)
		printf("%d\n", f[i + 1]);
	return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int n, ans = 0; cin>>n;
    string s; cin>>s;
    int cr=0,cg=0,cb=0;
    int a[n][3]; clr(a);
    if(s[0]=='R') a[0][0]=1, cr++;
    else if(s[0]=='G') a[0][1]=1, cg++;
    else a[0][2]=1, cb++;
    for(int i = 1; i < n; ++i){
    	if(s[i]=='R'){
    		cr++;
    		a[i][0]+=a[i-1][0]+1;
    		a[i][1]=a[i-1][1];
    		a[i][2]=a[i-1][2];
    	}
    	else if(s[i]=='G'){
    		cg++;
    		a[i][0]=a[i-1][0];
    		a[i][1]+=a[i-1][1]+1;
    		a[i][2]=a[i-1][2];
    	}
    	else{
    		cb++;
    		a[i][0]=a[i-1][0];
    		a[i][1]=a[i-1][1];
    		a[i][2]+=a[i-1][2]+1;
    	}
    }
    int pr,pg,pb,sr,sg,sb;
    for(int i = 1; i < n-1; ++i){
    	if(s[i]=='R'){
    		pg = a[i][1];
    		pb = a[i][2];
    		sg = cg-a[i][1];
    		sb = cb-a[i][2];
    		ans+=(pg*sb)+(pb*sg);
    	}
    	else if(s[i]=='G'){
    		pr = a[i][0];
    		pb = a[i][2];
    		sr = cr-a[i][0];
    		sb = cb-a[i][2];
    		ans+=(pr*sb)+(pb*sr);
    	}
    	else{
    		pg = a[i][1];
    		pr = a[i][0];
    		sg = cg-a[i][1];
    		sr = cr-a[i][0];
    		ans+=(pg*sr)+(pr*sg);
    	}
    }
    for(int i = 0; i < n; ++i){
    	for(int j = 1; j <= min(i,n-i-1); ++j){
    		if(s[i]!=s[i-j] && s[i]!=s[i+j] && s[i-j]!=s[i+j]) ans--;
    	}
    }
    cout<<ans<<'\n';
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 3652
#include <cstdio>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <set>
#include <map>
#include <iostream>
#pragma warning(disable:4996)
using namespace std;


int main()
{
	int N, R;
	cin >> N >> R;
	if (N < 10)R += 100 * (10 - N);
	cout << R;
}

Measured memory_bytes: 256
//@author :  |< U $ |-|
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<algorithm>
#include<list>
#include<cstring>
#include<unordered_map> 
#define ll long long
#define vi vector<long long>
#define pb push_back
#define pop pop_back
#define pi pair<long long ,long long>
#define vp vector<pair<long long,long long> >
#define mkp make_pair
#define in(i,n) for(i=0;i<n;i++)
#define fon(i,n,m) for(i=n;i<m;i++)
#define rfon(i,n,m) for(i=n;i>=m;i--)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);
#define map map<long long,long long>
#define inm1(b)  memset(b,-1,sizeof(b))
#define in0(b) memset(b,0,sizeof(b))
#define ininf(b) memset(b,1000000001,sizeof(b))
#define MOD         1000000007
#define I 10000000001
#define TakeInput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;
ll gcd(ll a, ll b) {  if (a == 0)  return b; return gcd(b % a, a); }
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    jaldi
    #ifndef ONLINE_JUDGE 
    //TakeInput
    #endif
    
    ll n,i,j,k;
    cin>>n;
    ll dp[10][10];
    in0(dp);

    fon(i,1,n+1){
        ll r;
        ll t=i;
        ll fi=1;
        ll f=0,l=0;
        while(t>0){
            r=t%10;
            if(fi){
                l=r;
                fi=0;
            }
            t=t/10;
        }
        //cout<<f<<" "<<l;
        f=r;
        dp[f][l]++;
    }
    ll count=0;
    in(i,10){
        in(j,10){
            count+=dp[i][j]*dp[j][i];
        }
    }
    cout<<count;

 
 
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2e5+100;
vector <pii> vec;
vector <int> mol[N];
ll par[N];
ll xx[N],yy[N];
ll mx[N];
ll a[N];
void mrg(ll u,ll v){
    u=par[u],v=par[v];
    if (mol[u].size()<mol[v].size()) swap(u,v);
    for (auto k : mol[v]){
        par[k]=u;
        mol[u].pb(k);
        mx[u]=max(mx[u],a[k]);
    }
    mol[v].clear();
    mx[v]=0;
}
ll ans[N];
int32_t main(){
    sync;
    ll n;
    cin >> n;
    vector <pair <pii,int> > b;
    for (int i=1;i<=n;i++){
        cin >> xx[i] >> yy[i] ;
    }
    for (int i=1;i<=n;i++){
        b.pb({{xx[i],yy[i]},i});
    }
    sort(b.begin(),b.end());
    for (int i=1;i<=n;i++){
        a[i]=b[i-1].F.S;
    //    cout << a[i] << " ";
    }
   // cout << endl;
    //reverse(a.begin(),a.end());
    for (int i=1;i<=n;i++){
        par[i]=i;
        mx[i]=a[i];
        mol[i].pb(i);
    }
    for (int i=n;i;i--){
        ll z=a[i];
        while(vec.size()>0 && vec.back().S>=z){
            ll u=vec.back().F;
            vec.pop_back();
            mrg(u,i);
        }
      //  cout << i << " " << par[i] << " " << mx[par[i]] << endl;
        vec.pb({par[i],mx[par[i]]});
    }
    for (int i=1;i<=n;i++){
        ans[b[i-1].S]=mol[par[i]].size();
    }
    for (int i=1;i<=n;i++) cout << ans[i] << endl;
}


Measured memory_bytes: 31728
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int a;cin >> a;
    cout << 3 * a * a << endl;
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  int cnt = 0;
  while(a >= b) {
    b *= 2;
    cnt++;
  }
  while(b >= c) {
    c *= 2;
    cnt++;
  }
  YesorNo(cnt <= k);
}

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

const int INF = (int)1e9;

struct Edge {
  int to, cap, rev;
  Edge(int to_, int cap_, int rev_) :
    to(to_), cap(cap_), rev(rev_) { }
};

struct FordFulkerson {
  const int V;
  vector<vector<Edge> > G;
  vector<bool> used;
  FordFulkerson(int v) : V(v), G(v), used(v) { }
  void add_edge(int from, int to, int cap) {
    G[from].emplace_back(to, cap, G[to].size());
    G[to].emplace_back(from, 0, G[from].size() - 1);
  }
  int find_flow(int v, int t, int f) {
    if(v == t) return f;
    used[v] = true;
    for(Edge &e : G[v]) {
      if(used[e.to] == false && e.cap > 0) {
        int d = find_flow(e.to, t, min(f, e.cap));
        if(d > 0) {
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int max_flow(int s, int t) {
    int flow = 0;
    while(true) {
      used.assign(V, false);
      int f = find_flow(s, t, INF);
      if(f == 0) return flow;
      flow += f;
    }
  }
};

int main() {
  int X, Y, E; cin >> X >> Y >> E;
  FordFulkerson flow(X + Y + 2);
  int src = X + Y;
  int dst = X + Y + 1;
  for(int i = 0; i < X; i++) {
    flow.add_edge(src, i, 1);
  }
  for(int i = 0; i < Y; i++) {
    flow.add_edge(X + i, dst, 1);
  }
  while(E--) {
    int x, y; cin >> x >> y;
    flow.add_edge(x, X + y, 1);
  }
  cout << flow.max_flow(src, dst) << endl;
}

Measured memory_bytes: 1512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
			
		
			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long A = inputArray[0];
			long B = retreiveLongArray()[0];

			var big = Math.Max(A, B);
			var small = Math.Min(A, B);


			//答えの出力
			if (big==2 && small==1) {
				Console.WriteLine(3);
				return;
			}

			if (big == 3 && small == 2) {
				Console.WriteLine(1);
				return;
			}
			var ans = 2;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 28144
-- Your code here!
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
 
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [k,x]<-getIntList
    putStrLn $ unwords $ map show [x-k+1..x+k-1]
    

Measured memory_bytes: 508
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define ext(x) { x; return 0; }
#define brk(x) { x; break; }
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; rep(i, 0, l) cout<<' '<<i<<':'<<*(x+i)<<endl;
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
inline int max(int cnt, ...);
inline int min(int cnt, ...);
vector<int> early, late;
signed main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, c;
	cin>>n>>k>>c;
	int now = 0;
	string str = next<string>();
	rep(i, 0, n)
	{
		if (str[i] == 'o' && now <= 0) early.pb(i), now = c+1;
		now--;
	}
	if (early.size() > k) return 0;
	now = 0;
	rev(i, n-1, 0)
	{
		if (str[i] == 'o' && now <= 0) late.pb(i), now = c+1;
		now--;
	}
	sort(late.begin(), late.end());
	rep(i, 0, early.size()) if (early[i] == late[i]) cout<<early[i]+1<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}
inline int max(int cnt, ...)
{
	int mx = -1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mx = max(mx, va_arg(l, int));
	va_end(l);
	return mx;
}
inline int min(int cnt, ...)
{
	int mn = 1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mn = min(mn, va_arg(l, int));
	va_end(l);
	return mn;
}


Measured memory_bytes: 5128
package main

import "fmt"

func main() {
	var h, w, n int
	fmt.Scan(&h, &w, &n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	grid := make([][]int, h)
	for i := range grid {
		grid[i] = make([]int, w)
	}

	idx := 0
	for y := 0; y < h; y++ {
		for x := 0; x < w; x++ {
			for as[idx] == 0 {
				idx++
			}
			if y%2 == 0 {
				grid[y][x] = idx + 1
			} else {
				grid[y][w-1-x] = idx + 1
			}
			as[idx]--
		}
	}

	for y := range grid {
		for x := range grid[y] {
			if x == w-1 {
				fmt.Printf("%d\n", grid[y][x])
			} else {
				fmt.Printf("%d ", grid[y][x])
			}
		}
	}
}


Measured memory_bytes: 1280
S = input()
N = len(S)
su = 0
L = [0]*13
L[0] = 1
M = [1, 10, 9, 12, 3, 4]
mod = 10**9+7
for i, c in enumerate(S[::-1]):
    m = M[i % 6]
    if c=="?":
        Lc = L[:]
        for j in range(m, m*10, m):
            for k in range(13):
                idx = (k+j)%13
                L[idx] = (L[idx] + Lc[k]) % mod
    else:
        su += int(c) * m
print(L[(-su+5)%13])


Measured memory_bytes: 45240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

#define INF 1e+9
#define MAX_V 10

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;

        for(int i = 0; i < G[v].size(); ++i) {
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int N;
    cin >> N;
    map<string, int> m;
    for(int i = 0; i < N; i++) {
        string s;
        cin >> s;
        if(m.count(s))
            m[s]++;
        else
            m[s] = 1;
    }
    int M;
    cin >> M;
    for(int i = 0; i < M; i++) {
        string t;
        cin >> t;
        if(m.count(t)) m[t]--;
    }
    int ans = 0;
    for(auto i = m.begin(); i != m.end(); ++i) ans = max(ans, i->second);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define MODNUM (INT(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
void chmax(T& m, T x) {
	m = max(m, x);
}

template <typename T>
void chmin(T& m, T x) {
	m = min(m, x);
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	char str[10];
	if(a > b) {
		swap(a, b);
	}
	int i = 0;
	while(i < b) {
		str[i] = a + '0';
		i++;
	}
	str[i] = '\0';
	puts(str);
	return 0;
}

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

vector<int> ad[100000];
vector<int> v,d;

int main()
{
	int i,j,n,m,a,b,q,l,k;
	queue<int> Q;
	
	cin >> n;
	cin >> m;
	for(i=0;i<=m-1;i++)
	{
		cin >> a;
		cin >> b;
		ad[a].push_back(b);
		ad[b].push_back(a);
	}
	for(i=0;i<=n-1;i++) 
	{
		ad[i].push_back(-1);
		v.push_back(0);
		d.push_back(-1);
	}
	j=0;
	for(i=0;i<=n-1;i++)
	{
		if(v[i]==0)
		{
			Q.push(i);
			v[i]=1;
			d[i]=j;
			while(Q.empty()!=1)
			{
				l=Q.front();
				for(k=0;ad[l][k]!=-1;k++)
				{
					if(v[ad[l][k]]==0)
					{
						Q.push(ad[l][k]);
						v[ad[l][k]]=1;
						d[ad[l][k]]=j;
					}
				}
				Q.pop();
			}
			j++;
		}
	}
	cin >> q;
	for(i=0;i<=q-1;i++)
	{
		cin >> a;
		cin >> b;
		if(d[a]==d[b]) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

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

using namespace std;

#define ll           long long int
#define endl         '\n'

ll dp[15][12][12];
bool memoize[15][12][12];
int a[15];

ll solve(int pos, int last = 10, int rem = 0, bool flag = 1, bool take = 0)
{
      if (pos < 0) return rem <= 1;
      ll &ret = dp[pos][last][rem];
      bool &mem = memoize[pos][last][rem];
      if (!flag and take and mem) return ret;
      int loop = 9;
      if (flag) loop = a[pos];
      ll sum = 0;
      for (int i = 0; i <= loop; i++)
      {
            if (!take and i == 0) sum += solve(pos - 1, 10, 0, 0, 0);
            else sum += solve(pos - 1, i, max(rem, last == 10 ? 0 : abs(i - last)), flag & i == a[pos], 1);
      }
      if (!flag and take) mem = 1, ret = sum;
      return sum;
}

ll digit_dp(ll num)
{
      int len = 0;
      while (num) a[len++] = num % 10, num /= 10;
      return solve(len - 1);
}

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr);
      cout.tie(nullptr);

      int k;
      cin >> k;
      ++k;
      ll lo = 1;
      ll hi = 3234566667;
      ll ans = -1;
      while (lo <= hi)
      {
            ll mid = lo + hi >> 1;
            ll cnt = digit_dp(mid);
            if (cnt >= k) ans = mid, hi = mid - 1;
            else lo = mid + 1;
      }
      assert(ans != -1);
      cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
using ll = long long;
const int MAX = 1e9+7;

int main(){
    ll H, n; cin >> H >> n;
    vector<ll> a(n), b(n); rep(i, 0, n) cin >> a[i] >> b[i];

    vector<ll> dp(H+1, MAX); dp[0] = 0;

    rep(h, 0, H){
        rep(i, 0, n){
            if(h+a[i] < H) dp[h+a[i]] = min(dp[h+a[i]], dp[h]+b[i]);
            else dp[H] = min(dp[H], dp[h]+b[i]);
        }
    }

    cout << dp[H] << endl;

    return 0;
}

Measured memory_bytes: 384