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

int main(){
    string s;
    cin >> s;
    
    int zero = 0;
    int one = 0;
    for(int i=0; i<s.length();i++){
        if(s[i]=='0') zero++;
        if(s[i]=='1') one++;
    }
    cout << 2* min(zero,one) << endl;
    
    return 0;
}


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

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

  // ここにプログラムを追記
  int sum = 0;
  int x = N;
  while(0 < x){
    sum += x % 10;
    x /= 10;
  }
  
  if(N % sum == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

struct edge {
  int to, cap, cost, rev;
  edge(int to, int cap, int cost, int rev)
      : to(to), cap(cap), cost(cost), rev(rev) {}
};
struct Graph {
  int V;
  vector<vector<edge>> G;
  vector<int> dist, prev_v, prev_e;
  Graph(int V) : V(V), dist(V), prev_v(V), prev_e(V), G(V) {}
  void add_edge(int from, int to, int cap, int cost) {
    G[from].push_back(edge(to, cap, cost, G[to].size()));
    G[to].push_back(edge(from, 0, -cost, G[from].size() - 1));
  }
  int min_cost_flow(int s, int t, int f) {
    int res = 0;
    while (f > 0) {
      fill(all(dist), INF);
      dist[s] = 0;
      bool update = true;
      while (update) {
        update = false;
        rep(v, 0, V) {
          if (dist[v] == INF)
            continue;
          rep(i, 0, G[v].size()) {
            edge &e = G[v][i];
            if (e.cap > 0 and dist[e.to] > dist[v] + e.cost) {
              dist[e.to] = dist[v] + e.cost;
              prev_v[e.to] = v;
              prev_e[e.to] = i;
              update = true;
            }
          }
        }
      }
      if (dist[t] == INF)
        return -1;
      int d = f;
      for (int v = t; v != s; v = prev_v[v]) {
        chmin(d, G[prev_v[v]][prev_e[v]].cap);
      }
      f -= d;
      res += d * dist[t];
      for (int v = t; v != s; v = prev_v[v]) {
        edge &e = G[prev_v[v]][prev_e[v]];
        e.cap -= d;
        G[v][e.rev].cap += d;
      }
    }
    return res;
  }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int V, E, F;
  cin >> V >> E >> F;
  Graph g(V);
  rep(i, 0, E) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    g.add_edge(a, b, c, d);
  }
  cout << g.min_cost_flow(0, V - 1, F) << endl;

  return 0;
}



Measured memory_bytes: 3248
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>   
using namespace std;
 
int main(){
int a,i = 0;
cin >> a;
int b[a],c[a],ans[a];
while(a > i){
    cin >> b[i] >> c[i];
    ans[i] =  b[i] % c[i];
    if(ans[i] == 0) ans[i] = c[i];
    i++;
}
i = 0;
while(a > i){
cout << ans[i] << endl;
i++;
}

}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int R,B,W,G;

	scanf("%d %d %d %d",&R,&B,&W,&G);

	printf("%d\n",R+B+W+G);

	return 0;
}



Measured memory_bytes: 3220
#include <stdlib.h>
int cp(const int *a,const int *b){return *a - *b;}
N,A[100001],i,ans=0;
main(){
scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&A[i]);
qsort(A,N,sizeof(int),cp);
for(i=0;i<N;i++){if(A[i]==A[i+1])i++;else ans++;}
printf("%d",ans);
}

Measured memory_bytes: 892
import itertools

N, K = map(int, input().split())
Ds = list(map(int, input().split()))
NDs = list(set([i for i in range(10)]) - set(Ds))
NDs = list(map(str, NDs))

min_price = 100000
for p in itertools.product(NDs, repeat=len(str(N))):
    if p[0] == '0':
        continue
    price = int(''.join(p))
    if price < N:
        continue
    min_price = min(price, min_price)

if min_price == 100000:
    for p in itertools.product(NDs, repeat=len(str(N))+1):
        if p[0] == '0':
            continue
        price = int(''.join(p))
        min_price = min(price, min_price)

print(min_price)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] ss = Console.ReadLine().Split(' ');
      int N = int.Parse(ss[0]);
      int Y = int.Parse(ss[1]);
      //int amount = 0;
      //int a = 0, b = 0, c = 0;
      int rate = Y / N;
      if(rate > 10000 || 1000 > rate)
      {
        Console.WriteLine("-1 -1 -1");
        Console.ReadLine();
        return;
      }
      //while(N > 100)
      //{
      //  rate = (Y - amount) / N;
      //  if(rate > 7000)
      //  {
      //    a++;
      //    amount += 10000;
      //  }
      //  else if(rate > 3300)
      //  {
      //    b++;
      //    amount += 5000;
      //  }
      //  else
      //  {
      //    c++;
      //    amount += 1000;
      //  }
      //  N--;
      //}
      //if(NewMethod(Y, amount, N, a, b, c))
      //  return;
      for(int a = 0; a <= N; a++)
        for(int b = 0; b <= N; b++)
        {
          int c = N - a - b;
          if(c < 0)
            continue;
          if(a * 10000 + b * 5000 + c * 1000 == Y)
          {
            Console.WriteLine(string.Format("{0} {1} {2}", a, b, c));
            Console.ReadLine();
            return;
          }
        }

      Console.WriteLine("-1 -1 -1");
      Console.ReadLine();
    }

  }
}

Measured memory_bytes: 27548
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int i=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    int ans = 0;
    REP(i, N){
        if(i%2==0&&a[i]%2) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    string s;
    cin>>s;
    if(s[s.size()-1]=='s')
        cout<<s<<"es";
    else
        cout<<s<<"s";

}


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

int main(){
  string s;
  cin >> s;
  string g = s.substr(0,5);
  string si = s.substr(6,7);
  string go = s.substr(14,5);
  cout << g << " " << si << " " << go << endl;
  return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

struct Data {
  double c;
  int city, ticket;
};

bool operator<(const Data& a, const Data& b) {
  return a.c > b.c;
}

int main(){
  cin.sync_with_stdio(false);
  int n, m, p, a, b, x, y, z;
  double ans;
  int t[8];
  double d[31][31];
  double cost[31][1 << 8];

  while(cin >> n >> m >> p >> a >> b, n) {
    rep(i, 31)rep(j, 31) d[i][j] = INF;
    rep(i, 31)rep(j, 1 << 8) cost[i][j] = INF;
    rep(i, n) cin >> t[i];
    rep(i, p) {
      cin >> x >> y >> z;
      d[x][y] = d[y][x] = z;
    }

    priority_queue<Data> q;
    q.push(Data{0, a, 0});
    ans = -1;
    while(!q.empty()) {
      Data data = q.top(); q.pop();
      if (cost[data.city][data.ticket] != INF) continue;

      cost[data.city][data.ticket] = data.c;
      if (data.city == b) {
        ans = data.c;
        break;
      }

      repl(i, 1, m + 1) {
        if (d[data.city][i] == INF) continue;
        rep(j, n) {
          if ((data.ticket & (1 << j)) == 0) {
            q.push(Data{d[data.city][i] / t[j] + data.c, i, data.ticket + (1 << j)});
          }
        }
      }
    }

    if (ans != -1) {
      printf("%.4f\n", ans);
    } else {
      printf("Impossible\n");
    }
  }

  return 0;
}

Measured memory_bytes: 18128
from collections import Counter


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N = int(input())
count = Counter([])
for i in range(1, N + 1):
    res = prime_factorize(i)
    res = Counter(res)
    count += res

result = 1
for c in count.values():
    result = result * (c+1)
    result = result % 1000000007


print(result)

Measured memory_bytes: 3316
def main():

    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        return " ".join(map(str, [A-1, B]))
    else:
        return " ".join(map(str, [A, B-1]))

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll mod = 1e9+7;


int main(){
    string s; cin >> s;
    int n=s.size();
    int ans=0;
    for(int i=0;i<n/2;i++){
    if(s[i]!=s[n-1-i]){
        ans++;
    }else{continue;
         }
    }cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
const int M = 100;
int read()
{
	int x=0,flag=1;char c;
	while((c=getchar())<'0' || c>'9') if(c=='-') flag=-1;
	while(c>='0' && c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return x*flag;
}
int n,m,q,ans,A[M],a[M],b[M],c[M],d[M];
int check()
{
    int s=0;
    for(int i=1;i<=q;i++)
        if(A[b[i]]-A[a[i]]==c[i])
            s+=d[i];
    return s;
}
void dfs(int x,int ls)
{
    if(x==n+1)
    {
        ans=max(ans,check());
        return ;
    }
    for(int i=ls;i<=m;i++)
    {
        A[x]=i;
        dfs(x+1,i);
    }
}
signed main()
{
    n=read();m=read();q=read();
    for(int i=1;i<=q;i++)
    {
        a[i]=read();b[i]=read();
        c[i]=read();d[i]=read();
    }
    dfs(1,1);
    printf("%d\n",ans);
}


Measured memory_bytes: 3264
#include <stdio.h>
// #include <math.h>
// #include <stdlib.h>

int main(void) {

    int h, w;
    scanf("%d %d", &h, &w);

    do {
        for(int i=1; i<=h; i++) {
            for (int j=1; j<=w; j++) {
                if ( (i+j)%2 == 0 ) {
                    printf("#");
                } else {
                    printf(".");
                }
            }
            printf("\n");
        }
        scanf("%d %d", &h, &w);
        printf("\n");
    } while (!(h==0 && w==0));
    return 0;
}


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

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

	int n, k;
	vector<int> a(100005), dp(100005, 1e9);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	dp[1] = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= min(k, i); j++) {
			dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ans += i * (n - i + 1);
	}
	for (ll i = 1; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		if (a > b) {
			ll t = a; a = b; b = t;
		}
		ans -= a * (n - b + 1);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, x; cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll>> a(n, vector<ll>(m));
    rep (i, n) {
        cin >> c[i];
        rep (j, m) cin >> a[i][j];
    }
    ll ans = 1e18;
    rep (i, 1 << n) {
        ll sum = 0;
        vector<ll> b(m);
        rep (j, n) {
            if (!(i & (1 << j))) continue;
            sum += c[j];
            rep (k, m) b[k] += a[j][k];
        }
        if (all_of(all(b), [&](ll y) {return y >= x;})) chmin(ans, sum);
    }
    if (ans >= (ll)1e18) cout << -1 << "\n";
    else cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
long long a[100005];
long long sum[100005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];		
	}
	for(int i=1;i<=n+1;i++){
		sum[i]=sum[i-1]+abs(a[i]-a[i-1]);
	}
	for(int i=1;i<=n;i++){
		cout<<sum[n+1]-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
	}	
	return 0;
}

Measured memory_bytes: 2816
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	string S; cin >> S;
	if (S[0] != S[1] && S[2] != S[1] && S[0] != S[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
import math
import numpy as np
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

def gnv(list, num):

    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

N = i()
a = l()
m = max(a)
if N == 2:
    print(m,min(a))
else:
    print(m,gnv(a,m/2))

Measured memory_bytes: 38420
#include <stdio.h>
int main(void){
int n,m,x,y;
int zahx[101]={};
int zahy[101]={};
int maxx=-200,miny=200;
int i,j;
int z=-200;

scanf("%d %d %d %d",&n,&m,&x,&y);

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

for(i=0;i<m;i++){
scanf("%d",&zahy[i]);
}

//printf("%d",zahy[2]);

for(i=0;i<n;i++){
if(maxx<zahx[i])
maxx=zahx[i];
//printf("%d %d\n",zahx[i],maxx);
}
//printf("%d\n",maxx);

for(i=0;i<m;i++){
if(miny>zahy[i]){
miny=zahy[i];
//printf("%d %d\n",zahy[i],miny);
}
}

//printf("%d\n",miny);

for(i=x+1;i<=y;i++){
if(maxx<i&&miny>=i)
z=i;
}

//printf("%d\n",z);

if(z!=-200)
printf("No War\n");
else
printf("War\n");


return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var count = 0;
        for (int i = 1; i < N; i++)
        {
            for (int j = 1; j < N; j++)
            {
                if (i * j < N) count++;
                else break;
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 27516
N = int(input())
members = list(map(int, input().strip().split()))
stands = []
stands.append(0)

for i, member in enumerate(members):
  if i>0:
    if members[i] > members[i-1] + stands[i-1]:
      stands.append(0)
    else:
      stands.append(members[i-1] + stands[i-1] - members[i])
      
print(sum(stands))


Measured memory_bytes: 32116
package main
 
import (
  "fmt"
  "math"
)
 
func main() {
  var n, m int
  fmt.Scan(&n, &m)
  a := make([]int, m)
  for i := range a {
    fmt.Scan(&a[i])
  }
  ans := 0
  for i := range a {
    ans += a[i]
  }
  fmt.Println(math.Max(float64(n - ans), -1))
}

Measured memory_bytes: 2428
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        1e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}

void solve()
{
 char x;
 cin >> x;

 if(x>='a' && x<='z') cout<<'a';
 else cout<<"A";   
}


int32_t main()
{
  //pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

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

using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(),x.end()
#define INF (1e9)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> P;

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

int main() {
    int A;
    cin >> A;
    if (A == 1) {
        printf("Hello World");
    }
    else {
        int a,b;
        cin >> a;
        cin >> b;
        printf("%d", a + b);
    }
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int tc=1;
		t:
		while(tc-->0){
			int n=Integer.parseInt(br.readLine());
			String s=br.readLine();
			if(n%2==1){
				System.out.println("No");
				continue t;
			}
			int p1=0;
			int p2=n>>1;
			for(;p1<(n>>1) && p2 < n;p1++,p2++){
				if(s.charAt(p1)!=s.charAt(p2)){
					System.out.println("No");
					continue t;
				}
			}
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 22484
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
int32_t main()
{
  int H,W; cin >> H >> W;
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;x1--;x2--;y1--;y2--;
  string s[H]; fr(_,H) cin >> s[_];
  deque<pair<int,int>> Q;
  int dist[H][W];memset(dist,0x3f,sizeof dist);
  Q.push_front({x1,y1});
  auto is_valid =[&](int x,int y){
  	return x>=0 and y >= 0 and x< H and y< W  and s[x][y] != '#';
  };
  int inf = dist[0][0];
  dist[x1][y1] = 0;
//   vector<int> d(n, INF);
// d[s] = 0;
// deque<int> q;
// q.push_front(s);
// while (!q.empty()) {
//     int v = q.front();
//     q.pop_front();
//     for (auto edge : adj[v]) {
//         int u = edge.first;
//         int w = edge.second;
//         if (d[v] + w < d[u]) {
//             d[u] = d[v] + w;
//             if (w == 1)
//                 q.push_back(u);
//             else
//                 q.push_front(u);
//         }
//     }
// }
  while(!Q.empty()){
  	auto fr = Q.front();
  	Q.pop_front();
  	int x = fr.first;
  	int y = fr.second;
  	for(int dx = -2; dx <= 2; dx++){
  		for(int dy = -2; dy <= 2; dy++){
  			int xx = x + dx;
  			int yy = y + dy;
  			int ww = (abs(x-xx) + abs(y-yy) > 1);
  			if(!is_valid(xx,yy)) continue;
  			if(dist[x][y] + ww  < dist[xx][yy]){
  				dist[xx][yy] = dist[x][y] + ww;
  				if(ww == 1) Q.push_back({xx,yy});
  				else Q.push_front({xx,yy});
  		 }
  		}
  	}
  }
  // fr(i,H){
  // 	fr(j,W) cout << dist[i][j] <<" " ;nl;
  // }
  if(dist[x2][y2] == inf)
  cout << "-1\n";
else cout << dist[x2][y2];
}

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

using namespace std;

#define vit vector<int>::iterator
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fr first
#define sc second
#define skip continue
#define PI 3.14159265

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

const int INF = 1e9 + 5;
const int MAXN = 3e6 + 123;

void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
bool cmp(const string& a, const string& b) {
	return (a + b) < (b + a);
}

vector<int> Reversed(const vector<int>& s){
   vector<int> d = s;
   reverse(all(d));
   return d;
}

void solve(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if(n - k >= 0)
        cout << x * (k) + y * (n - k);
    else cout << x * (n);
}

// ."ww"w"".ww"""...ww"".

int main(){
    //freopen("lepus.in","r",stdin);
    //freopen("lepus.out","w",stdout);
    //faster();
    int n=1;
    //cin>>n;
    while(n--){
    solve();
    //cout << endl;
    }
    //fclose(stdout);
}


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

ll kaijou(ll a) {
  ll ans =1;
  rep(i,1,a+1) {
    ans *= i; ans %= MOD;
  }
  return ans;
}

int main() {
  ll N,M; cin >> N >> M;
  if (abs(N-M) >=2) {
    cout << 0 << endl; return 0;
  }
  ll ans;
  if (M != N) {
    ans = kaijou(M) * kaijou(N);
  } else {
    ans = 2 * kaijou(M) * kaijou(N);
  }
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect

const int N = 3007, MOD = 998244353;

int dp[N][N];
int a[N];

int inc(int a) {
    return (a >= MOD ? a - MOD : a);
}

void calc_dp(int n, int s) {
    loop1(len, n) {
        loop(i, s + 1)
            dp[len][i] = inc(dp[len - 1][i] + (a[len] <= i ? dp[len - 1][i - a[len]] : 0));
        if (a[len] <= s)
            dp[len][a[len]] = inc(dp[len][a[len]] + len);
    }
}

void solve() {
    int n, s;
    cin >> n >> s;
    loop1(i, n)
        cin >> a[i];
    calc_dp(n, s);
    // loop(i, n + 1) {
    //     loop(j, s + 1)
    //         cout << dp[i][j] << " ";
    //     cout << "\n";
    // }
    int ans = 0;
    loop1(i, n)
        ans = inc(ans + dp[i][s]);
    cout << ans;
}
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 35456
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>g;
vector<edge>ed;
vector<Pll>pv;
map<string, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m,k, p, q, w, h, ans, cnt, dp[510000], sum[510000], zsum[510000], a[510000], b[510000];
string str;
bool f;
char c[1100][1100];
map<LL,vector<LL>>mv;
LL modpow(LL a, LL n = MOD - 2) {
	LL r = 1;
	while (n) r = r * ((n % 2) ? a : 1) % MOD, a = a * a%MOD, n >>= 1;
	return r;
}
int main(){
	cin >> n;
	rep(i, n) {
		LL x;
		cin >> x;
		a[i] = x;
		sum[i + 1] = sum[i] ^ x;
		if (sum[i + 1] == 0)zsum[i + 1]++;
		zsum[i + 1] += zsum[i];
		if (sum[i + 1] != 0) {
			mv[sum[i + 1]].push_back(i);
		}
	}
	for (auto it = mv.begin(); it != mv.end(); it++) {
		LL i = it->first;
		if (i != sum[n] && sum[n] != 0)continue;
		vector<LL>now = it->second;
		LL s1 = 0, s2 = 0;
		rep(j, now.size()) {
			dp[now[j]] = (s1*zsum[now[j] + 1] - s2 + MOD) % MOD;
			dp[now[j]]++;
			dp[now[j]] %= MOD;
			s1 += dp[now[j]];
			s1 %= MOD;
			s2 += dp[now[j]] * zsum[now[j] + 1];
			s2 %= MOD;
		}
		if (sum[n] == 0)dp[n - 1] += (s1 + MOD) % MOD;
		dp[n - 1] %= MOD;
	}
	if (sum[n] == 0)
		dp[n - 1] += modpow(2, zsum[n] - 1);
	dp[n - 1] %= MOD;
	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 48640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn=1e6+10;
int cnt,prime[maxn],a[maxn],p,ans;
bool f[maxn];
long long x;
int main()
{
	memset(f,1,sizeof f); f[0]=f[1]=0;
	for (int i=2;i<=1000000;i++)
	{
		if (f[i]) {prime[++cnt]=i;}
		for (int j=1;j<=cnt && 1ll*i*prime[j]<=1000000;j++)
		{
			f[i*prime[j]]=0;
			if (i%prime[j]==0) break;
		}
	}
	scanf("%lld",&x);
	for (int i=1;i<=cnt;i++)
	if (x%prime[i]==0)
	{
		p++;
		while (x%prime[i]==0) {a[p]++; x/=prime[i];}
	}
	if (x!=1) a[++p]=1;
	for (int i=1;i<=p;i++)
	{
		int x=a[i];
		for (int j=1;j<=60;j++) if (x>=j) ans++,x-=j;else break;
	}
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 5136
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;

long N,K;
VVI arr;
long query(long x1,long y1,long x2,long y2){
	return arr[x2][y2] - arr[x2][y1-1] - arr[x1-1][y2] + arr[x1-1][y1-1];
}

int main(void){
	cin >> N >> K;
	arr = VVI(4*K,VI(4*K,0));

	REP(i,N){
		long x,y;
		char c;
		cin >> x >> y >> c;
		if (c == 'W') x += K;
		arr[(x)%(2*K)][y%(2*K)] += 1;
		arr[(x)%(2*K)+2*K][(y)%(2*K)+2*K] += 1;
		arr[(x)%(2*K)][y%(2*K)+2*K] += 1;
		arr[x%(2*K)+2*K][(y)%(2*K)] += 1;
	}


	REP(i,4*K) REP(j,4*K-1) arr[i][j+1] += arr[i][j];
	REP(j,4*K) REP(i,4*K-1) arr[i+1][j] += arr[i][j];
	#ifdef DEBUG
		dump2d_arr(arr);
	#endif

	

	long ans = 0;
	long tmp;
	
	FOR(i,1,2*K+1){
		FOR(j,1,2*K+1){ 
			tmp = 0;
			tmp += query(i,j,i+K-1,j+K-1);
			tmp += query(i+K,j+K,i+2*K-1,j+2*K-1);
			ans = max(ans,tmp);
		}		
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 125440
#include <stdio.h>
int main(void){
    int n,A,B,C,i,j;
    scanf("%d",&n);
    for (j=0;j<n;j++) {
    	B=0;
    	C=0;
        for (i=0; i<10; i++) {
        	scanf("%d",&A);
            if ((B<A&&A<C)||(C<=B&&B<A)) {
                B=A;
            } else if ((C<A&&A<B)||(B<C&&C<A)) {
                C=A;
            } else {
                printf("NO\n");
                break;
            }
            if (i==9) printf("YES\n");
        }
    }
    return 0;
}

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

int main() {
	int N;
  	cin >> N;
    vector<double> P(N);
  	for(int i = 0; i < N; i++) cin >> P.at(i);
      
    sort(P.begin(), P.end());
    
    double total = P.at(0);
      
      for( int i = 1; i < N; i++){
        total = (total + P.at(i)) / 2;
        }
        
      cout << total << endl;
      
}

Measured memory_bytes: 256
from itertools import product
s=input()
n=len(s)
ans=0
for p in product([0,1], repeat=n-1):
  wk=s[0]
  index=0
  for i in p:
    index+=1
    if i==0:
      wk+=s[index]
    else:
      ans+=int(wk)
      wk=s[index]
  if wk!="":
    ans+=int(wk)
print(ans)

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

llong gcd(llong x, llong y) {
  if (x < y) swap(x, y);
  if (y == 0) return x;
  return gcd(y, x % y);
}
vector<llong> factorize(llong n) {
  vector<llong> res;
  for (llong i = 2; i * i <= n; i++) {
    if (n % i) continue;
    res.push_back(i);
    while (n % i == 0) {
      n /= i;
    }
  }
  if (n != 1) res.push_back(n);
  return res;
}
int main() {
  llong a, b;
  cin >> a >> b;
  llong g = gcd(a, b);
  auto f = factorize(g);
  int ans = f.size() + 1;
  cout << ans << endl;
  return 0;
}

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

 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)

 int main() {
   int N;
   cin >> N;
   vector<int> A1(N), A2(N);
   rep(i, N) cin >> A1.at(i);
   rep(i, N) cin >> A2.at(i);

   int max_can = 0;

   rep(i, N) {
     int can = 0;
     rep(j, i + 1) can += A1.at(j);
     for (int k = i; k < N; k++) can += A2.at(k);
     max_can = max(max_can, can);
   }
   cout << max_can << endl;
 }


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<int,pii> edge;

const int N = 4005;
int uf[N];

int id(int v) {
	if(uf[v] == v) return v;
	return uf[v] = id(uf[v]);
}

void merge(int u, int v) {
	uf[id(u)] = id(v);
}

vector<edge> v;

vvi T;
vvi W;
int d[4005][4005],n,m,q;

void find(int f, int s, int t, int ds) {
	d[s][t] = ds;
	for(int i = 0; i < T[t].size(); ++i) {
		int v = T[t][i];
		if(v == f) continue;
		find(t,s,v,max(W[t][i],ds));
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie();
	cin >> n >> m;
	for(int i = 0; i < n; ++i)
		uf[i] = i;
	for(int i = 0;i < m; ++i) {
		int a,b,c;
		cin >> a >> b >> c;
		v.push_back(edge(c,pii(a-1,b-1)));
	}
	sort(v.begin(),v.end());
	ll wt = 0;
	T = vvi(n,vi());
	W = vvi(n,vi());
	for(int i = 0; i < v.size(); ++i) {
		int a = v[i].second.first,b=v[i].second.second;
		if(id(a) == id(b))
			continue;
		merge(a,b);
		wt += v[i].first;
		T[a].push_back(b);
		T[b].push_back(a);
		W[a].push_back(v[i].first);
		W[b].push_back(v[i].first);
	}
	for(int i = 0; i < n; ++i)
		find(-1,i,i,0);
	cin >> q;
	while(q--) {
		int s,t;
		cin >> s >> t;
		--s; --t;
		cout << wt - d[s][t] << "\n";
	}

	return 0;
}

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

#define fr(i, n)    for(int i=0; i<(int)n; ++i)
#define rfr(i, n)   for(int i=(int)n-1; i>=0; --i)
#define foor(i,a,n) for(int i=a; i<=(int)n; ++i)
#define rfoor(i,n,a)for(int i=(int)n; i>=a; --i)
#define foru(it, v) for(auto it : v)
#define si(n)       scanf("%d", &n)
#define si2(n,m)    scanf("%d%d", &n, &m)
#define si3(n,m,l)  scanf("%d%d%d", &n, &m, &l)
#define sl(n)       scanf("%lld", &n)
#define sl2(n,m)    scanf("%lld%lld", &n, &m)
#define sl3(n,m,l)  scanf("%lld%lld%lld", &n, &m, &l)
#define sd(n)       scanf("%lf", &n)
#define sld(n)      scanf("%Lf", &n)
#define sc(n)       scanf(" %c", &n)
#define sstr(n)     scanf("%s", n)
#define pi(n)       printf("%d\n", n)
#define pis(n)      printf("%d ", n)
#define pi2(n,m)    printf("%d %d\n", n, m)
#define pi3(n,m,l)  printf("%d %d %d\n", n, m, l)
#define pl(n)       printf("%lld\n", n)
#define pls(n)      printf("%lld ", n)
#define pl2(n,m)    printf("%lld %lld\n", n, m)
#define pl3(n,m,l)  printf("%lld %lld %lld\n", n, m, l)
#define pc(n)       printf("%c", n)
#define pstr(n)     printf("%s\n", n)
#define pstr2(n, m) printf("%s %s\n", n, m)
#define ff          first
#define ss          second
#define all(v)      v.begin(), v.end()
#define rall(v)     v.rbegin(), v.rend()
#define sz(v)       (int)v.size()
#define pub         push_back
#define pob         pop_back()
#define mmst(a, n)  memset(a, n, sizeof a);
#define ppcnt(n)    __builtin_popcountll(n);
#define leadingZ(n) __builtin_clz(n)
#define trailingZ(n)__builtin_ctz(n)
#define OO          0x3f3f3f3f
#define OOLL        0x3f3f3f3f3f3f3f3f
#define MOD         1000000007
#define EPS         0.000000001
#define ndl         "\n"
#define fastin      ios::sync_with_stdio(false); cin.tie(nullptr);
#define infile      freopen("input.txt", "r", stdin);
#define outfile     freopen("output.txt", "w", stdout);
#define PNO         printf("NO\n")
#define PYES        printf("YES\n")
#define pno         printf("No\n")
#define pyes        printf("Yes\n")
#define pln         printf("\n")

//#define row         vector<long long>
//#define matrix      vector<row>
//#define ROWS(v)     (v).size()
//#define COLS(v)     (v)[0].size()

#define DBG1(x)     cerr<<#x<<":"<<(x)<<'\n';
#define DBG2(x, y)  cerr<<#x<<":"<<(x)<<"  "<<#y<<":"<<(y)<<'\n';
#define DBG3(x,y,z) cerr<<#x<<":"<<(x)<<"  "<<#y<<":"<<(y)<<"  "<<#z<<":"<<(z)<<'\n';

using namespace std;

typedef long long lld;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vii;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long , long long>> vpll;
typedef complex<double> point;

const int N = 1e5 + 9;

int t, id, n, m, x, y, k, c, xx, yy, ans;
//int a[N], f[N], cu[N], b[N];
vii v, adj[N];
bool fl, ok;
lld res, tot, sum;
char ch;
string s, z;
//char s[3][N], z[N];

int main()
{
    //infile;
    //outfile;
    //fastin;
    cin >> s >> z;
    fr(i, 3) c += s[i] == z[i];
    pi(c);
    return 0;
}


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

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

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

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

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

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;
}

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

void test_case() {
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  while (n--) {
    int x;
    cin >> x;
    cnt += (x >= k);
  }
  cout << cnt << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test_case();
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k;
    cin >> n >> k;
    if(k > (n - 1) * (n - 2) / 2) return cout << -1 << endl, 0;

    vector<pair<int, int>> e;
    for(int i = 2; i <= n; ++i) e.push_back({1, i});
    int no = (n - 1) * (n - 2) / 2 - k;
    for(int i = 2; i <= n && no; ++i) {
        for(int j = 2; j < i && no; ++j) {
            e.push_back({i, j});
            no -= 1;
        }
    }

    cout << e.size() << '\n';
    for(auto x : e) cout << x.fi << ' ' << x.se << '\n';
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B)
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    D = A[i]
    ans += C[D-1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back
#define debug(x) cerr << #x << " = " << x << " "


int main()
{
  int cnt[2] = {0, 0};
  map<string, int> ma;
  for (int i = 0; i < 2; ++i)
    {
      string s; cin >> s; ma[s] = i;
    }
  for (int i = 0; i < 2; ++i)
    {
      scanf("%d", cnt+i);
    }
  string s; cin >> s;
  if (ma.count(s) && cnt[ma[s]]) --cnt[ma[s]];
  for (int i = 0; i < 2; ++i)
    {
      printf("%d%c", cnt[i], " \n"[i+1==2]);
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

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

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <typename T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

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

    double N;
    cin >> N;

    FOR(h, 1, 3501) {
        FOR(n, 1, 3501) {
            double A = (4 * h * n - N * n - N * h);
            if (A == 0) continue;
            double w = (N * h * n) / A;
            if (w > 0 && (ll)w == w) {
                cout << h << " " << n << " " << (ll)w << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
from fractions import gcd
from functools import reduce

def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N, M = map(int,input().split(' '))
S = input()
T = input()
L = lcm([N,M])
L_N = L // N
L_M = L // M
nowN = 0
nowM = 0
countN = 0
countM = 0
while True:
#    print(nowN,nowM)    
#    print(countN,countM)
    if nowN < nowM:
        nowN += L_N
        countN +=1
    elif nowM < nowN:
        nowM += L_M
        countM +=1
    elif nowM == nowN:
#        print(S[countN])
#        print(T[countM])
        if S[countN] != T[countM]:
            print('-1') 
            exit()
        else:
            countN +=1
            nowN += L_N
    if nowN >= L and nowM >= L:
        print(str(L))
        exit() 

Measured memory_bytes: 5460
n, x = gets.chop.split.map(&:to_i)
l = gets.chop.split.map(&:to_i)

d=0
i=0

while(d<=x)
  d=d+l[i]
  i+=1
  if(i==n)
    if(d<=x)
      i+=1
      break
    else
      break
    end
  end
end

puts i


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,ans=1;
	cin >> x;
	if(x == 1 || x == 2)
	{
		cout << ans;
		return 0;
	}
	for(int i=3;i <= x;i++)
		for(int j=2;j<i;j++)
			if(i%j == 0)
			{
				int k=i/j;
				while(k%j == 0)
					k /= j;
				if(k == 1)
					ans=i;
			}	
	cout << ans;
	return 0; 		
}  

Measured memory_bytes: 256