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

int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> a(M), b(M);
    for(int i=0; i<M; i++){
        scanf(" %d %d", &a[i], &b[i]);
        a[i]--; b[i]--;
    }

    std::vector<int> deg(N);
    for(int i=0; i<M; i++){
        deg[a[i]]++; deg[b[i]]++;
    }

    bool flag = true;
    for(int& c: deg){
        if(c % 2 != 0) flag = false;
    }
    if(flag == true) printf("YES\n");
    else printf("NO\n");
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;

int primes[N], cnt;
bool st[N];

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

int main()
{
    int a, b;
    cin >> a >> b;
    cout << (LL)a * b / gcd(a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class program
{
    static void Main()
    {
        var nk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        int n = nk[0], m = nk[1];
        var h = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
        var ans = Enumerable.Repeat<bool>(true, n).ToArray();
        for (int i = 0; i < m; i++)
        {
            var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int a = ab[0]-1, b = ab[1]-1;
            if (h[a] == h[b])
            {
                ans[a] = false;
                ans[b] = false;
            }
            else if (h[a] > h[b]) ans[b] = false;
            else ans[a] = false;
        }
        int s = 0;
        for(int i = 0; i < n; i++)
        {
            if(ans[i]) s++;
        }
        Console.Write(s);
    }
}

Measured memory_bytes: 49300
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1e18;

int mid(int a, int b, int c) {
    return a+b+c-max({a,b,c})-min({a,b,c});
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    int ans = A[N/2]-A[N/2-1];
    cout << ans << endl;
    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9+10;
const ll MOD = 998244353;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,k; cin>>n>>k;
  
  vpll lr(k);
  rep(i,k) cin>>lr[i].first>>lr[i].second;
  
  vll dp(n), sdp(n+1);
  dp[0]=1;
  
  rep(i,n){
    for(auto e: lr){
      ll l,r; tie(l,r)=e;
      if(i-l+1>=0) (dp[i]+=sdp[i-l+1])%=MOD;
      if(i-r>=0) (dp[i]+=(MOD-sdp[i-r]))%=MOD;
    }
    sdp[i+1]=(sdp[i]+dp[i])%MOD;
  }
  
  // rep(i,n) cout<<dp[i]<<' ';
  // cout<<endl;
  
  cout<<dp[n-1]<<endl;
  
}

Measured memory_bytes: 6376
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 998244353;

ll dp[304][45010], dp2[304][45010];

ll powll(ll x, ll y){
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    return (x * powll(y,mod-2)) % mod;
}

int main() {
    ll n;
    cin >> n;
    VL a(n);
    ll sum = 0;
    REP(i,n){
        a[i] = in();
        sum += a[i];
    }
    ll hf = (sum + 1) / 2;
    dp[0][0] = 1;
    dp2[0][0] = 1;
    REP(i,n) REP(j,hf+1){
        (dp[i+1][j] += dp[i][j]) %= mod;
        (dp2[i+1][j] += dp2[i][j]) %= mod;
        if (j + a[i] <= hf){
            (dp[i+1][j + a[i]] += 2 * dp[i][j]) %= mod;
            (dp2[i+1][j + a[i]] += dp2[i][j]) %= mod;
        }
    }

    ll ans = 0, ans2 = 0;
    REP(j,hf+1){
        if (2 * j < sum) ans = (ans + 3 * dp[n][j]) % mod;
        if (2 * j == sum) ans2 = (ans2 + 3 * dp[n][j]) % mod;
    }
    if (2 * hf == sum){
        ll c = divll(dp2[n][hf], 2);
        ans2 = (ans2 - 6 * c + 60 * mod) % mod;
    }

    ll all = 1;
    REP(i,n) all = (3 * all) % mod;
    ans = (all - ans - ans2 + 3 * mod) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 212864
N = int(input())
X = input()

def one(X):
  L, R = 0, 0
  for x in X:
    if x == "(":
      R += 1
    else:
      if R == 0:
        L += 1
      else:
        R -= 1
  return L*"("+X+R*")"

def two(X):
  mL = 0
  for i in X:
    if i == ")":
      mL += 1
    else:
      break
  mR = 0
  for i in X[::-1]:
    if i == "(":
      mR += 1
    else:
      break
  X = mL * "(" + X + mR * ")"
  L = len([i for i in X if i == ")"])
  R = len(X) - L
  if L > R:
    X = (L - R) * "(" + X
  else:
    X += (R - L) * ")"
  return X

#import numpy as np
#for j in range(10):
#  x = np.random.randint(0, 2, 6)
#  X = "".join(["(" if i==1 else ")" for i in x])
#if one(X) == two(X):
#())(() が two でミスる例
print(one(X))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a[300000];
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    bool ans=true;
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            ans=false;
            break;
        }
    }
    if(ans) cout<<"YES";
    else cout<<"NO";
}


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

using namespace std;

int gcd(int x, int y){
  int r;

  if (x >= y){
    r = x % y;
  }
  else {
    r = y % x;
  }

  while (r){
    x = y;
    y = r;
    r = x % y;
  }

  return y;
}

int main(){
  int x, y, ans;

  cin >> x >> y;

  ans = gcd(x, y);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = 1001001001;

int a[26];
int b[26];

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

  fill(b, b+26, INF);
  rep(i, n){
    string s; cin >> s;
    fill(a, a+26, 0);
    for(char c : s){
      a[c-'a']++;
    }
    rep(j, 26){
      chmin(b[j], a[j]);
    }
  }

  rep(i, 26){
    char c = 'a' + i;
    rep(j, b[i]) cout << c;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

ll H , W;
bool HW[401][401];
bool checked[401][401];
ll black, white;

void cal(ll i, ll j){
    if(HW[i][j] == true) white ++;
    else black ++;
    
    vector<pair<ll,ll> > lop;
    lop.pb(mp(-1,0));
    lop.pb(mp(1,0));
    lop.pb(mp(0,-1));
    lop.pb(mp(0,1));
    
    rep(k, lop.size()){
        ll h = i + lop[k].first;
        ll w = j + lop[k].second;
        
        if(h<0 || h>=H) continue;
        if(w<0 || w>=W) continue;
        if(checked[h][w]) continue;
        if(HW[i][j] == HW[h][w]) continue;
        
        checked[h][w] = true;
        cal(h,w);
    }
    
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> H >> W;
    rep(i, H){
        string S;
        cin >> S;
        rep(j, S.size()){
            if(S[j] == '#') HW[i][j] = true;
            else HW[i][j] = false;
        }
    }

    ll ans = 0;
    rep(i, H)rep(j, W){
        black = 0;
        white = 0;
        checked[i][j] = true;
        cal(i,j);
        ans += (white * black);
    }
    
    cout << ans << endl;
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 28032
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=2005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int a[n], b[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<n;i++)
    cin>>b[i];
    int co1[n+1], co2[n+1], m[n+1];
    fill(co1, 0);
    fill(m, 0);
    fill(co2, 0);
    for(int i=0;i<n;i++)
    {
        co1[a[i]]++;
        co2[b[i]]++;
        if(a[i]==b[i])
        m[a[i]]++;
    }
    map <pii, int> mp;
    for(int i=1;i<=n;i++)
    {
        if((co1[i]+co2[i])>n)
        {
            cout<<"No";
            return 0;
        }
        if(co2[i])
        {
            //cout<<m[i]<<" "<<i<<"\n";
            mp[{co1[i]+co2[i], i}]++;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(co2[a[i]])
        {
            mp.erase({co2[a[i]]+co1[a[i]], a[i]});
            co1[a[i]]--;
            mp[{co2[a[i]] + co1[a[i]], a[i]}]++;
        }
        auto it=mp.end();
        it--;
        pii p=(*it).ff;
        if(p.ss!=a[i])
        {
            b[i]=p.ss;
            mp.erase(p);
            co2[p.ss]--;
            p.ff--;
            if(co2[p.ss])
            mp[p]++;
        }
        else
        {
            if(it==mp.begin())
            {
                cout<<"No";
                return 0;
            }
            it--;
            p=(*it).ff;
            b[i]=p.ss;
            mp.erase(p);
            co2[p.ss]--;
            p.ff--;
            if(co2[p.ss])
            mp[p]++;
        }
    }
    cout<<"Yes\n";
    for(int i=0;i<n;i++)
    {
        cout<<b[i]<<" ";
    }
}

Measured memory_bytes: 23740
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rsort(x) sort(x.rbegin(), x.rend())
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define fio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define znit(x) memset(x, 0, sizeof(x))
#define mnit(x) memset(x, -1, sizeof(x))
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db EPS = 1e-7;

const ll mod = 1e9 + 7;
const ll mod2 = 1e9 + 9;
ll mypow(ll x, ll y, ll p){ll ret = 1;while(y){if(y & 1) ret = (ret * x) % p;x = (x * x) % p; y /= 2;}return ret;}
ll inv(ll x, ll p){return mypow(x, p - 2, p);}
ll gcd(ll x, ll y){return y ? gcd(y, x % y) : x;}
const int MAX = 2e5 + 3;
int N, a[105];

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

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

int main() {
  int n,m,sum=0,p,x;
  cin >> n;
  vector<int> t(n+100);
  REP(i,n) { cin >> t[i]; sum += t[i]; }
  cin >> m;
  vector<int> ans(m+100);
  REP(i,m) {
    cin >> p >> x;
    cout << sum - (t[p-1] - x) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n,k; cin >>n>>k;

    int p = k;
    for (int i = 1; i < n; i++) {
        p *= (k-1);
    }

    cout << p << endl;
    
    return 0;
}





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

using namespace std;

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

	int result = 0;

	for (int i = 0; i < N; i++) {
		if (S[i] != S[i + 1]) {
			result++;
		}
	}

	cout << result << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    long long a[n],ans=0;
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    for(i=0;i<n;i++){
        while(a[i]%2==0){
            a[i]+=a[i]/2;
            ans++;
        }
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1808
#include <stdio.h>
#define N 1000005
#define SIZE 14
 
void insertionSort(int n,int g);
void shellSort(int n);
 
int A[N];
int G[SIZE] = {1,4,13,40,121,364,1093,3280,9841,29524,88573,265720,797161,2391484};
int cnt=0,m;
 
int main(){
  int i,j,n;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
     
  shellSort(n);
     
  printf("%d\n",m);
  for(i=m-1; i>=0; i--){
    printf("%d",G[i]);
    if(i) printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(i=0; i<n; i++) printf("%d\n",A[i]);
 
  return 0;
 
}
 
 
void insertionSort(int n,int g){
  int v,i,j;
  for(i=g; i<n; i++){
    v = A[i];
    j = i - g;
    while(j >= 0 && A[j] > v){
      A[j+g] = A[j];
      j -= g;
      cnt++;
    }
    A[j+g] = v;
  }
}
 
 
void shellSort(int n){
  int i,h;
  for(h=1; ; ){
    if(h > n) break;
    h = 3*h +1;
  }
  for(i=0; i<SIZE; i++){
    if(h == G[i]) m = i;
  }
  for(i=m-1; i>=0; i--){
    insertionSort(n,G[i]);
  }
}

Measured memory_bytes: 4508
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define LL long long int
using namespace std;

const int N = 1e6 + 5;

void solve() {
    int x, y;
    cin >> x >> y;
    for (int two=0;two<=x;two++) {
        int four = x - two;
        int legs = two * 2 + four * 4;
        if (legs == y) {
            cout << "Yes\n";
            return;
        }
    }
    cout << "No\n";
}
int main() {
    FASTIO;
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
#define pii pair<ll,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
pii a[100005];
ll s[100005],r[100005];
int ds[100005],dr[100005];
int main(){
	int n;
	ll c;
	scanf("%d%lld",&n,&c);
	for(int i=1;i<=n;i++){
		scanf("%lld%d",&a[i].F,&a[i].S);
		s[i]=s[i-1]+a[i].S;
	}
	for(int i=n;i>=1;i--)r[i]=r[i+1]+a[i].S;
	a[n+1]={c,0};
	int mxs=0,mxr=n+1;
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(s[mxs]-a[mxs].F<s[i]-a[i].F)mxs=i;
		ds[i]=mxs;
		ans=max(ans,s[mxs]-a[mxs].F);
	}
	for(int i=n;i>=1;i--){
		if(r[mxr]-c+a[mxr].F<r[i]-c+a[i].F)mxr=i;
		dr[i]=mxr;
		ans=max(ans,r[mxr]-c+a[mxr].F);
	}
	for(int i=1;i<=n;i++){
		ans=max(ans,s[i]-a[i].F*2+r[dr[i+1]]-c+a[dr[i+1]].F);
		ans=max(ans,r[i]-(c-a[i].F)*2+s[ds[i-1]]-a[ds[i-1]].F);
	}
	printf("%lld",ans);
}

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

int main(){
    int a, b;
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

struct Edge {
    int to;
    int capacity;
    int reverse;
};

using Edges = std::vector<std::vector<Edge>>;

std::vector<std::pair<int, int>> bfs(const Edges& edges) {
    std::vector<std::pair<int, int>> ans(edges.size(), std::make_pair(-1, -1));
    std::queue<int> que;
    que.push(0);
    ans[0].first = 0;
    while(!que.empty()) {
        int u = que.front();
        que.pop();
        for(int i = 0; i < edges[u].size(); ++i) {
            const auto& edge = edges[u][i];
            if(ans[edge.to].first < 0 && 0 < edge.capacity) {
                ans[edge.to] = std::make_pair(u, i);
                if(edge.to == edges.size() - 1) break;
                que.push(edge.to);
            }
        }
    }
    return ans;
}

int updateNetwork(Edges& edges, const std::vector<std::pair<int, int>>& memo) {
    int incr = std::numeric_limits<int>::max();
    int u = edges.size() - 1;
    if(memo[u].first < 0) return 0;
    while(u != 0) {
        int p = memo[u].first;
        incr = std::min(incr, edges[p][memo[u].second].capacity);
        u = p;
    }

    u = edges.size() - 1;
    while(u != 0) {
        int p = memo[u].first;
        int revs = edges[p][memo[u].second].reverse;
        edges[p][memo[u].second].capacity -= incr;
        edges[u][revs].capacity += incr;
        u = p;
    }
    return incr;
}

int main() {
    int V, E;
    std::cin >> V >>E;
    Edges edges(V);
    while(E--) {
        int s, t, c;
        std::cin >> s >> t >>c;
        edges[s].push_back(Edge{t, c, (int)edges[t].size()});
        edges[t].push_back(Edge{s, 0, (int)edges[s].size() - 1});
    }

    int flow = 0;
    while(1) {
        auto ans = bfs(edges);
        int incr = updateNetwork(edges, ans);
        if(incr == 0) break;
        flow += incr;
    }

    std::cout << flow << std::endl;

    return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, D;
  cin >> N >> D;
  vector<long long> A(N); 
  vector<long long> B(N);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  int ans = 0;
  for(int i = 0; i < N; i++) {
    if(sqrt(A.at(i) * A.at(i) + B.at(i) * B.at(i)) <= D) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6424
import sys
input = sys.stdin.readline
def main():  
    S = list(input())
    S.pop()
    length=len(S)
    dp = [0]*13
    dp[0]=1
    mul=1
    mod=1000000007
    for i in range(1,length+1):
        next_dp = [0]*13
        for j in range(13):
            if S[length-i] == "?":
                for k in range(10):
                    j_sub=(j+k*mul)%13
                    next_dp[j_sub]+=dp[j]
                    next_dp[j_sub]%=mod
            else:
                j_sub=(j+int(S[length-i])*mul)%13
                next_dp[j_sub]+=dp[j]
                next_dp[j_sub]%=mod
        dp=next_dp
        mul=mul*10%13
    print(dp[5]%1000000007)
if __name__ == "__main__":
    main()

Measured memory_bytes: 49264
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;
typedef long long int ll;
ll find(ll x,vector<ll>&parent)
{
    if(parent[x]==x)
        return x;
    else
    {
        parent[x] = find(parent[x],parent);
        return parent[x];
    }
}
void uni(ll x,ll y,vector<ll>&parent,vector<ll>&size)
{
    x = find(x,parent);
    //cout<<"x="<<x<<endl;
    y = find(y,parent);
    //cout<<"y="<<y<<endl;
    if(x!=y)
    {
        if(size[x]<size[y])
        {
            swap(x,y);
        }
        parent[y] = x;
        size[x]+=size[y];
    }
}
int main()
{
   ll n,m;
   cin>>n>>m;
   vector<ll>parent,size(n,1);
   for(int i=0;i<n;i++)
    parent.push_back(i);
   for(int i=0;i<m;i++)
   {
       ll x,y;
       cin>>x>>y;
       x--;y--;
       uni(x,y,parent,size);
   }
   ll cnt[n]={0},ans=0;
   for(int i=0;i<n;i++)
    {

        //cout<<i<<" "<<parent[i]<<endl;

        //cout<<cnt[parent[i]]<<endl;
        ans = max(ans,size[i]);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 7964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  ll a,b,k; cin >> a >> b >> k;
  a -= k;
  if(a<0) b += a, a = 0;
  if(b<0) b = 0;
  cout << a << " " << b << endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int frog(int pos);
int n;
int h[100005];
int memo[100005];
int main(){
  memset(memo,-1,sizeof(memo));
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  cout<<frog(0)<<"\n";
  return 0;
}
int frog(int pos){
  if(pos==n-1)return 0;
  if(pos==n-2)return abs(h[pos]-h[pos+1]);
  if(memo[pos]!=-1)return memo[pos];
  return memo[pos]=min(frog(pos+1)+abs(h[pos+1]-h[pos]),frog(pos+2)+abs(h[pos+2]-h[pos]));
}


Measured memory_bytes: 2560
import sys

N = int(input())
for line in sys.stdin:
  p = list(map(int,line.split(' ')))


cnt = 0
for n in range(1,N+1):
  _ = p[n-1]
  if n == _:
    continue
  else:
    cnt += 1
    
if cnt > 2:
  print('NO')
else:
  print('YES')

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

int main(){
int i, j, k, N; cin >> N; int M=N-1, A[M], B[M];
vector< vector<int> > edges(N);
for(i=0; i<M; i++){ 
  cin >> A[i] >> B[i]; A[i]--; B[i]--;
  edges[A[i]].push_back(i); edges[B[i]].push_back(i); 
}
vector<int> V={0}; int v, w, e, cl[N]={1}, a=1, b, c, p[N]={};
for(i=0; i<V.size(); i++){
  for(v=V[i], j=0; j<edges[v].size(); j++){
    e=edges[v][j]; w=(v==A[e])?B[e]:A[e];
    if(!cl[w]){ V.push_back(w); cl[w]=-cl[v]; if(cl[w]==1){ a++; } }
  }
}
b=N-a; c=N/3; int l, m, x=0, y=0, z=0;
if(a>c&&b>c){ 
  for(i=0; i<N; i++){
    if(cl[i]==1){
      l=3*x+1;
      if(l<=N){ p[i]=l; x++; }
      else{ p[i]=3*(z+1); z++; }
    }
    else{
      l=3*y+2;
      if(l<=N){ p[i]=l; y++; }
      else{ p[i]=3*(z+1); z++; }
    }
  }
}
else if(a<=c){ 
  for(i=0; i<N; i++){
    if(cl[i]==1){ p[i]=3*(z+1); z++; }
    else{ 
      l=3*x+1; m=3*y+2;
      if(l<=N){ p[i]=l; x++; }
      else if(m<=N){ p[i]=m; y++; }
      else{ p[i]=3*(z+1); z++; }
    }
  }
}
else{ 
  for(i=0; i<N; i++){
    if(cl[i]==-1){ p[i]=3*(z+1); z++; }
    else{ 
      l=3*x+1; m=3*y+2;
      if(l<=N){ p[i]=l; x++; }
      else if(m<=N){ p[i]=m; y++; }
      else{ p[i]=3*(z+1); z++; }
    }
  }
}
for(i=0; i<N; i++){ cout << p[i] << " "; }
cout << "\n";
}

Measured memory_bytes: 18036
#import numpy as np
S = input()
N = len(S)
mod=13
mod2=10**9+7
def pow_mod(x,n):
    if n==0:
        return 1
    
    K = 1
    while n>1:
        if n%2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2

    return (K*x)%mod

#dp = np.zeros((N+1,13),dtype="int")
dp = [[0] * 13 for i in range(N+1)]
S=S[::-1]
if S[0]=="?":
    for j in range(10):
        dp[1][j] = 1
else:
    dp[1][int(S[0])] = 1

for i in range(1,N):
    amari = pow_mod(10,i)
    if S[i]=="?":
        for j in range(13):
            for k in range(10):
                dp[i+1][j] += dp[i][(j-amari*k)%mod]
            dp[i+1][j] %= mod2
    else:
        for j in range(13):
            dp[i+1][j] += dp[i][(j-amari*int(S[i]))%mod]
            dp[i+1][j] %= mod2

print(dp[N][5])






Measured memory_bytes: 63708
#include <iostream>

int main(int argc, char const* argv[])
{
	int a = 0;
    int b = 0;
    int c = 0;
	std::cin >> a >> b >> c;

	if (a < b)
	{
		if (b < c)
			std::cout << a << " " << b << " " << c << std::endl;
		else if (a < c)
			std::cout << a << " " << c << " " << b << std::endl;
		else
			std::cout << c << " " << a << " " << b << std::endl;
	}
	else
	{
		if (a < c)
			std::cout << b << " " << a << " " << c << std::endl;
		else if ( b < c)
			std::cout << b << " " << c << " " << a << std::endl;
		else
			std::cout << c << " " << b << " " << a << std::endl;
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string S;
  cin >> S;
  deque<char> q;
  for(char s: S){
    q.push_back(s);
  }

  int num = 0;
  int Q;
  cin >> Q;

  for(int i = 0; i < Q; i++){
    int tmp;
    cin >> tmp;
    if(tmp == 1){
      num++;
    } else {
      int num1;
      char char1;
      cin >> num1 >> char1;
      if(num % 2 == 0){
        // 正しい方向
        if(num1 == 1){
          q.push_front(char1);
        } else { 
          q.push_back(char1);
        }
      } else { 
        // 反対方向
        if(num1 == 1){
          q.push_back(char1);
        } else { 
          q.push_front(char1);
        }
      }
    }
  }
  string ans = "";
  while(!q.empty()){
    ans += q.front();
    q.pop_front();
  }
  if(num % 2 == 1){
    reverse(ans.begin(), ans.end());
  }
  cout << ans << endl;

}


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

int main()
{
    string s;
    int c=0;
    cin>>s;
    int l=s.size()-1;
    int st=(s.size()/2)-1;
    for(int i=0;i<=st;i++){ 
        if(s[i]!=s[l])c++;
        l--;
    } 
   cout<<c;
    return 0;
}


Measured memory_bytes: 256
def prime_factor(N):
    lists = [N]
    for i in range(2, int(N ** 0.5) + 1):
        if N % i == 0:
            lists.append(i)
            lists.append(N // i)
    lists.sort()  
    return lists

ans = []
Nlist = []

while True:
    N = int(input())
    if N == 1:
        break
    Nlist.append(N)

    MSprime = []
    for i in prime_factor(N):
        bool_append = True
        if i % 7 in [1, 6]:
            for j in MSprime:
                if not i % j:
                    bool_append = False
                    break
            
            if bool_append:
                MSprime.append(i)
    
    ans.append(MSprime)
    
for i in range(len(ans)):
    print(str(Nlist[i]) + ':', end='')    
    for j in range(len(ans[i])):
        print(' ' + str(ans[i][j]), end='')
    print()
    


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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



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

	int inv = 0;

	rep(hoge, Q) {
		int T; cin >> T;
		if (T == 1) {
			inv = (inv + 1) % 2;
		}
		else {
			int F; char C; cin >> F >> C;
			F--;
			if ((inv+F)%2==0) {
				S.insert(S.begin(), C);
			}
			else {
				S.push_back(C);
			}
		}
	}

	if (inv == 1) {
		reverse(S.begin(), S.end());
	}

	cout << S << endl;

	return 0;
}

Measured memory_bytes: 3844
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
	int n;
    vector<unsigned int> v1, v2;
    cin >> n;
    for (size_t i = 0; i < n; i+=2) {
        int x;
        cin >> x;
		v1.push_back(x);
        cin >> x;
		v2.push_back(x);
    }

	vector<size_t> v1_cnt(100000, 0);
	vector<size_t> v2_cnt(100000, 0);

	vector<int> v1_cnt_max(2,0);
	vector<size_t> v1_cnt_num(2,0);
	for(auto& v:v1) {
		int cnt_index = v+1;
		v1_cnt[cnt_index]++;
		if(v1_cnt[cnt_index] > v1_cnt_max[0]) {
			v1_cnt_max[1] = v1_cnt_max[0];
			v1_cnt_max[0] = v1_cnt[cnt_index];
			v1_cnt_num[1] = v1_cnt_num[0];
			v1_cnt_num[0] = v;
		} else if(v1_cnt[cnt_index] > v1_cnt_max[1]) {
			v1_cnt_max[1] = v1_cnt[cnt_index];
			v1_cnt_num[1] = v;
		}
	}

	vector<int> v2_cnt_max(2,0);
	vector<size_t> v2_cnt_num(2,0);
	for(auto& v:v2) {
		int cnt_index = v+1;
		v2_cnt[cnt_index]++;
		if(v2_cnt[cnt_index] > v2_cnt_max[0]) {
			v2_cnt_max[1] = v2_cnt_max[0];
			v2_cnt_max[0] = v2_cnt[cnt_index];
			v2_cnt_num[1] = v2_cnt_num[0];
			v2_cnt_num[0] = v;
		} else if(v2_cnt[cnt_index] > v2_cnt_max[1]) {
			v2_cnt_max[1] = v2_cnt[cnt_index];
			v2_cnt_num[1] = v;
		}
	}

	int result;
	if(v1_cnt_max[0] + v2_cnt_max[0] == n) {
		if(v1_cnt_num[0] == v2_cnt_num[1]) {
			result = n / 2;
		} else {
			result = 0;
		}
	} else if(v1_cnt_num[0] != v2_cnt_num[0]) {
		result = n - v1_cnt_max[0] - v2_cnt_max[0];
	} else {
		result = n - max(v1_cnt_max[0] + v2_cnt_max[1], v1_cnt_max[1] + v2_cnt_max[0]);
	}

	cout << result << endl;

}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
vector<vector<lli>> adj;
vector<lli> vis;
lli n;
lli c = 0;
lli ans;
int dfs(int cur)
{
    for (int j = 0; j < adj[cur].size(); j++)
    {
        int k = adj[cur][j];
        if (vis[k] == 0)
        {
            c += 1;
            vis[k] = 1;
            dfs(k);
        }
    }

    return 0;
}
void call_dfs()
{
    for (int i = 1; i <= n; i++)
    {
        if (vis[i] == 0)
        {
            c = 1;
            vis[i] = 1;
            dfs(i);
            ans = max(c, ans);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli m;
    cin >> n >> m;
    ans = 1;
    vis.resize(n + 1, 0);
    adj.resize(n + 1);
    set<pll> edge;
    for1(i, 0, m)
    {
        lli a, b;
        cin >> a >> b;
        if (b < a)
        {
            swap(a, b);
        }
        edge.insert(mp(a, b));
    }
    for (auto itr = edge.begin(); itr != edge.end(); itr++)
    {
        pll p = *itr;
        adj[p.first].pb(p.second);
        adj[p.second].pb(p.first);
    }
    call_dfs();
    cout << ans << endl;
}

Measured memory_bytes: 37428
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

using bs = bitset<2000>;

signed main(){

    int N; cin >> N;
    vector<string> A(N);
    A[0] = "";
    FOR(i, 1, N) cin >> A[i];
    vector<bs> W(N);
    REP(i, N) REP(j, i){
        if(A[i][j] == '1') W[i][j] = 1;
        else W[j][i] = 1;
    }
    
    vector<bs> dpl(N), dpr(N);
    REP(i, N){
        dpl[i][i] = 1;
        dpr[i][i] = 1;
    }

    FOR(d, 1, N){
        REP(i, N - d){
            int j = i + d;
            if((dpr[i] & dpl[j - 1] & W[j]).any()) dpr[i][j] = 1;
            if((dpr[i + 1] & dpl[j] & W[i]).any()) dpl[j][i] = 1;
        }
    }
    int ans = (dpr[0] & dpl[N - 1]).count();
    Out(ans);

    return 0;
}


Measured memory_bytes: 3968
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

ans = ["0"] * n
if n>=2: ans[0] = "1"

ok = True
for s,c in sc:
    if s-1==0 and n>=2:
        if ans[s-1] == "1" or ans[s-1] == str(c): ans[s-1] = str(c)
        else: ok = False
    else:
        if ans[s-1] == "0" or ans[s-1] == str(c): ans[s-1] = str(c)
        else: ok = False

if n>=2:
    if ans[0] == "0": ok = False
print(-1 if not ok else "".join(ans))

Measured memory_bytes: 9140
n, k = (int(x) for x in input().split())

D = []
E = []
for i in range(k):
    d = int(input())
    D.append(d)
    F = list(int(x) for x in input().split())
    E.append(F)

count = []
for i in E:
    for j in i:
        count.append(j)

number = set(count)

apple = list(number)

counter = 0
for i in range(1, n + 1):
    if i in apple:
        pass
    else:
        counter += 1

print(counter)


Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){
    int n;
    cin>>n;
    map<int,string> hon;
    hon[2]="hon";
    hon[4]="hon";
    hon[5]="hon";
    hon[7]="hon";
    hon[9]="hon";
    hon[0]="pon";
    hon[1]="pon";
    hon[6]="pon";
    hon[8]="pon";
    hon[3]="bon";
    cout<<hon[n%10]<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

Int N, K, C;
string S;
Int dfsR(Int idx){ //
  static Int mem[200010], used[200010];
  if(idx >= N) return 0;
  if(used[idx]++) return mem[idx];
  if(S[idx] == 'x') return mem[idx] = dfsR(idx + 1);
  return mem[idx] = dfsR(idx + C + 1) + 1;
}

set<Int> ans;
void calc(Int idx, Int num){
  if(idx >= N) return;
  if(S[idx] == 'x'){calc(idx + 1, num); return;}
  if(num + dfsR(idx + 1) < K) ans.insert(idx + 1);
  calc(idx  + C + 1, num + 1);
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin>>N>>K>>C;
  cin>>S;

  calc(0, 0);
  for(Int a:ans) cout<<a<<endl;

  return 0;
}


Measured memory_bytes: 23572
# ?????§??¬?´???°????±???????a??¨b?????\?????????
x, y = gets.split(" ").map(&:to_i)

# x??¨y?????§?°???¢???????????§??????
if  x < y then
    r = y
    y = x
    x = r
end

# ?????§??¬?´???°????±???????
while x >= y && y != 0
    #?????????????±???????
    r = x % y
    x = y
    y = r
end
# ?????§??¬?´???°?????¨????????????
print x, "\n"

Measured memory_bytes: 8640
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long n = sc.nextLong();
		long m = sc.nextLong();
		long MOD = 1000000007L;

		// 計算
		long result = 1;
		ArrayList<NumList> list = new ArrayList<NumList>();
	    for(int k = 2; k <= sqrt(m); k++){
	        if(m == 1) break;
	        if(m%k == 0){
	            NumList numList = new NumList(k, 0);
	            while(m%k == 0){
	                m = m/k;
	                numList.num2++;
	            }
	            list.add(numList);
	        }
	    }
	    if(m != 1) list.add(new NumList((int)m, 1));

        for(NumList nl : list){
            result *= combination((int)(nl.num2 + n - 1), nl.num2, MOD);
            result %= MOD;
        }
        
		// 出力
		System.out.println(result);
		
	}
	
	public static long pow(long a, long n, long MOD) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=(res*a)%MOD;
	        }
	        a=(a*a)%MOD;
	        n>>=1;
	    }
	    return res%MOD;
	}
	
	public static long[] fact(int n, long MOD) {
	    long[] f = new long[n+1];
	    for(int i = 0; i < n+1; i++){
	        if(i == 0) f[i] = 1;
	        if(i > 0) f[i] = (f[i-1]*i)%MOD;
	    }
	    return f;
	}
	
	public static long combination(int n, int k, long MOD) {
	    if(n < k) return 0;
	    long[] f = fact(n, MOD);
	    long a = f[n];
	    long b = pow(f[k], MOD - 2, MOD);
	    long c = pow(f[n - k], MOD - 2, MOD);
	    return (((a*b)%MOD)*c)%MOD;
	}
}

class NumList {
    int num1;
    int num2;
    
    NumList(int num1, int num2){
        this.num1 = num1;
        this.num2 = num2;
    }
}



Measured memory_bytes: 30164
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];


int main()
{
	long long N, K, cnt = 0, tmp, ans = 0;
	cin >> N >> K;

	cout << N - K + 1;
	
	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;





int main(){
  int n;
  cin>>n;
  
  cout<<(n+1)/2<<endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//int→string
//string→int
//------------------------------------------
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();
}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#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 RSORT(c) sort((c).rbegin(),(c).rend())

//repetition
//------------------------------------------
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  FOR(i,0,n)
#define REPR(i, n) for(int i = n;i >= 0;i--)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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


int main() {

    bool alice[101] = {false};
    bool bob[101] = {false};

    int A; cin>>A;
    int B; cin>>B;
    int C; cin>>C;
    int D; cin>>D;

    int count = 0;

    for(int i=A;i<B;i++){
        alice[i] = true;
    }
    for(int i=C;i<D;i++){
        bob[i] = true;
    }

    for(int i=0;i<=100;i++){
        if(alice[i]&&bob[i]){
            count++;
        }
    }

    cout << count;

    return 0;
}















































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

using namespace std;

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

    int k;
    cin >> k;
    int n = 7 % k;
    for (int i = 1; i <= k; i++)
    {
        if (n == 0)
        {
            cout << i;
            return 0;
        }
        n = (n * 10 + 7) % k;
    }
    cout << -1;

    return 0;
}


Measured memory_bytes: 3648
import java.util.*;
class Pair
{
	double x;
	double y;
	Pair(double x, double y)
	{
		this.x = x;
		this.y = y;
	}
}

public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			String[] str = stdIn.next().split(",");
			Pair[] p = new Pair[3];
			for(int i = 0; i < 3; ++i)
			{
				p[i] = new Pair(Double.parseDouble(str[2 * i]), Double.parseDouble(str[2 * i + 1]));
			}
			if(p[0].y == p[1].y)
			{
				System.out.println(p[2].x + " " + (p[0].y - (p[2].y - p[0].y)));
			}
			else if(p[0].x == p[1].x)
			{
				System.out.println((p[0].x + (p[0].x - p[2].x)) + " " + p[2].y);
			}
			else
			{
				double a1 = (p[1].y - p[0].y) / (p[1].x - p[0].x);
				double b1 = p[0].y - a1 * p[0].x;
				double a2 = -1 / a1;
				double b2 = p[2].y - a2 * p[2].x;
				double x = (b1 - b2) / (a2 - a1);
				double y = a2 * x + b2;
				double dx = x - p[2].x;
				double dy = y - p[2].y;
				System.out.println((x + dx) + " " + (y + dy));
			}
		}
	}
}

Measured memory_bytes: 11000
#include <iostream>
#include <string>
#include <bitset>
#include <algorithm>

int main()
{
    int n;
    std::string s;
    std::cin >> n;
    std::cin >> s;

    if(n == 2)
    {
        std::cout << 0 << std::endl;
        return 0;
    }

    std::string substr = s.substr(1, n-1);
    int min = std::count(substr.begin(), substr.end(), 'E');
    int l = 0;
    int r = min;
    for(int i = 1; i < n; ++i)
    {
        if(s[i-1] == 'W')
        {
            l += 1;
        }
        if(s[i] == 'E')
        {
            r -= 1;
        }
        min = std::min(min, l+r);
    }
    std::cout << min << std::endl;
    return 0;
}

Measured memory_bytes: 1028
import numpy as np

n, k = map(int, input().split())
H = np.array(list(map(int, input().split())))
dp = np.zeros(n, dtype = int)

for i in range(1, n):
    s = max(i - k, 0)
    dp[i] = min(dp[s : i] + abs(H[i] - H[s : i]))
    
print(dp[-1])

Measured memory_bytes: 22904