akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

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

int main(){
    int n;cin>>n;
    vin num(100000);
    rep(i,n){
        int a;cin>>a;
        num[a]++;
    }
    if(n%2){
        if(num[0]!=1){
            cout<<0<<endl;
            return 0;
        }
        rep2(i,1,n){
            if(i%2==0&&num[i]!=2){
                cout<<0<<endl;
                return 0;
            }
            else if(i%2&&num[i]!=0){
                cout<<0<<endl;
                return 0;
            }    
        }
    }
    else{
        rep(i,n){
            if(i%2&&num[i]!=2){
                cout<<0<<endl;
                return 0;
            }
            else if(i%2==0&&num[i]!=0){
                cout<<0<<endl;
                return 0;
            }    
        }
    }
    cout<<modpow((ll)2,(ll)(n/2),(ll)inf)<<endl;
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = ReadLine();
            var cnt0 = S.Count(c => c == '0');
            var cnt1 = S.Count(c => c == '1');
            WriteLine(Min(cnt0, cnt1) * 2);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13268
/* AtCoder Beginner Contest abc139
 * Problem C
 * Au: SJoshua
 */
#include <bits/stdc++.h>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector <int> arr(n);
	int last = -1, cnt = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		if (arr[i] <= last) {
			cnt++;
		} else {
			cnt = 0;
		}
		ans = max(ans, cnt);
		last = arr[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)               cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
	
int main() 
{
	ll ans; 
ll n,k,m; 
cin>>n>>m; 
vector<ll> v(m);
vector<string> s(m); 
map<ll,ll> mp; 
map<ll,ll> wa;
ll sum=0; 
ll a=0,p=0;
for (int i = 0; i < m; ++i)
{
	cin>>v[i]>>s[i];
	if(s[i]=="AC") 
		{
			if(mp[v[i]]==1) 
				continue;
			mp[v[i]]=1;
			a++;
		}
	else
	{
		if(mp[v[i]]==1) 
				continue;
			wa[v[i]]++;
     //       p++;
	}

}
for(auto i:wa) 
	if(mp[i.first]==1) 
		p+=i.second;
	cout<<a<<" "<<p;
    return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>

int main()
{
 int n,m,a,mxh,mih,yoko[1001][3];
 int i,t,e;
 for(scanf("%d%d%d",&n,&m,&a); n || m || a;scanf("%d%d%d",&n,&m,&a))
 {
   mxh=0,mih=1000;
  for(i=1;i<=m;i++)
   {
    scanf("%d%d%d",&yoko[i][0],&yoko[i][1],&yoko[i][2]);
    if(yoko[i][0]>mxh)mxh=yoko[i][0];
    if(yoko[i][0]<mih)mih=yoko[i][0];
   }

  for(t=mxh;t>=mih;t--)
   for(i=1;i<=m;i++)
     {if(t==yoko[i][0] && (a==yoko[i][1] || a==yoko[i][2]))
       a=a==yoko[i][1]?yoko[i][2]:yoko[i][1];}
printf("%d\n",a);
}
  

 return 0;
}


Measured memory_bytes: 2056
#include<iostream>
using namespace std;
int main(void)
{
	int a,x;
	cin>>a;
	x=0;
	if(a>=105) x++;
	if(a>=135) x++;
	if(a>=165) x++;
	if(a>=189) x++;
	if(a>=195) x++;
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define PI acos(-1)
#define MM int m=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) (x+mo_num)%mo_num
#define vc vector
#define vct vector<int>
#define fa(i,V) for(auto i:V)
#define out(i) cout<<(i)<<endl;
#define fi first
#define sc second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
//#define P pair<int,int>
using namespace std;
const int INF=LLONG_MAX;
const int maxn=2e3+5;
const int mo_num=1e9+7;
int n,m,a[maxn],b[maxn],ans;
int f[maxn][maxn];
int32_t main()
{
    IOS
    cin>>n>>m;
    fun(i)cin>>a[i];
    fum(i)cin>>b[i];
    fun(i)f[i][0]=1;
    fum(i)f[0][i]=1;
    f[0][0]=1;
    fu(i,1,n)
    {
        fu(j,1,m)
        {
            f[i][j]=mod(f[i-1][j]+f[i][j-1]-f[i-1][j-1]);
            if(a[i]==b[j])f[i][j]=mod(f[i-1][j-1]+f[i][j]);
        }
    }
    cout<<f[n][m];
    return 0;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  map<char, int> alp;
  //for (char ch = 'a'; ch <= 'z'; ch++) alp[ch] = -1;
  rep (i, n) {
    string s;
    cin >> s;
    if (i == 0) {
      for (auto v : s) alp[v]++;
    } else {
      map<char, int> counter;
      for (auto v : s) counter[v]++;
      for (auto v : alp) {
	if (counter[v.first] == v.second || v.second == -1) continue;
	if (counter[v.first] == 0) {
	  alp[v.first] = -1;
	} else {
	  alp[v.first] = min(alp[v.first], counter[v.first]);
	}
      }
    }
  }

  for (auto v : alp) {
    if (v.second == -1) continue;
    for (int i = 0; i < v.second; i++) cout << v.first;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
const int N = 5e5+999;
int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
int arr[N];
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
       int n;
       cin>>n;
       int x = n;
       int ct  =0;
       while(x>=2)
       {
           ct++;
           x/=2;
       }
       ct++;
       cout<<((1LL<<ct)-1);
    }
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string a,b;
	cin>>a>>b;
	int ans = INT_MAX;
	for(int i=0;i<a.size();++i)
	{
		int tmp = 0,cnt = 0;
		for(int j=i;j<a.size()&&j-i<b.size();++j)
		{
			if(a[j]!=b[j-i])
				tmp++;
			cnt++;
		}
		if(cnt==(int)b.size())
			ans = min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    vector<char> c;
    rep(i, s.size()){
        if(s[i]=='0'){
            c.emplace_back('0');
        }else if(s[i]=='1'){
            c.emplace_back('1');
        }else{
            if(c.size()>0){
                c.erase(c.end()-1);
            }
        }

    }
    rep(i, c.size()){
        cout << c[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
s="L"+s+"R"
N=len(s)
a=[1]*N
for i in range(1,N-1):
    if s[i]=="R" and s[i+1]=="R":
        a[i+2]+=a[i]
        a[i]=0
for i in range(N-1,1,-1):
    if s[i]=="L" and s[i-1]=="L":
        a[i-2]+=a[i]
        a[i]=0
print(*a[1:-1])

Measured memory_bytes: 6376
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T> int former(const vector<T> &v, T x) {
    return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x) {
    return lower_bound(v.begin(), v.end(), x) - v.begin();
}


int main(int argc, char const *argv[]) {
  int A,B,Q;
  std::cin >> A >> B >> Q;
  std::vector<ll> s(A),t(B);
  rep(i,A) std::cin >> s[i];
  rep(i,B) std::cin >> t[i];
  s.pb(INF); s.pb(-INF); sort(s.begin(), s.end());
  t.pb(INF); t.pb(-INF); sort(t.begin(), t.end());

  for(int p=0; p<Q; p++){//右左,左右,左左,右右の4通りをs,tの順序2通りで計8通り
    ll x; std::cin >> x;
    ll ans=INF;
    for(int i=0; i<2; i++){
      ll first;
      if(i) first=s[former(s,x)];
      else first=s[latter(s,x)];

      for(int j=0; j<2; j++){
        ll second;
        if(j) second=t[former(t,first)];
        else second=t[latter(t,first)];
        chmin(ans,abs(x-first)+abs(first-second));
      }
    }

    for(int i=0; i<2; i++){
      ll first;
      if(i) first=t[former(t,x)];
      else first=t[latter(t,x)];

      for(int j=0; j<2; j++){
        ll second;
        if(j) second=s[former(s,first)];
        else second=s[latter(s,first)];
        chmin(ans,abs(x-first)+abs(first-second));
      }
    }
    std::cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 2912
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N;
	cin >> N;
	if (N == 1){
		cout << "Hello World" <<endl;
	}
	else{
		int A,B;
		cin >> A >> B;
		cout <<A + B <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
S=[input() for _ in range(n)]

a,b,c,d=0,0,0,0
for i in S:
    if i=="AC":a +=1
    elif i=="WA":b +=1
    elif i=="TLE":c +=1
    else:d +=1
print("AC x {}".format(a))
print("WA x {}".format(b))
print("TLE x {}".format(c))
print("RE x {}".format(d))

Measured memory_bytes: 79072
#include <cassert>
#include <cstddef>
#include <utility>

template <template <class> class Container> class union_find {
protected:
	class node_type;

public:
	using container_type = Container<node_type>;
	using size_type = typename container_type::size_type;

protected:
	class node_type {
	public:
		typename union_find::size_type parent, size;
	};
	container_type c;

public:
	union_find() : c() {}
	explicit union_find(const size_type size) : c(size, { 0, 1 }) {
		for (size_type i = 0; i < size; ++i)
			c[i].parent = i;
	}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(size_type x) {
		assert(x < size());
		while (c[x].parent != x)
			x = c[x].parent = c[c[x].parent].parent;
		return x;
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return c[find(x)].size;
	}

	::std::pair<size_type, size_type> unite(size_type x, size_type y) {
		assert(x < size());
		assert(y < size());
		x = find(x);
		y = find(y);
		if (x != y) {
			if (c[x].size < c[y].size)
				::std::swap(x, y);
			c[x].size += c[y].size;
			c[y].parent = x;
		}
		return { x, y };
	}
};

#include<iostream>
#include<vector>

template<class T>
using vec = ::std::vector<T>;

int main() {
	int n, q;
	::std::cin >> n >> q;
	union_find<vec> t(n);
	while (q--) {
		int p, a, b;
		::std::cin >> p >> a >> b;
		if (p)
			::std::cout << (t.same(a, b) ? "1" : "0") << ::std::endl;
		else
			t.unite(a, b);
	}
	return 0;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod = 1e9 + 7;
long long INF = 1e7;
double EPS = 1e-12;
typedef long long int lld;
long double tick(){static clock_t oldt; clock_t newt=clock();
    long double diff=1.0L*(newt-oldt)/CLOCKS_PER_SEC; oldt = newt; return diff; }
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
inline lld sc() { lld a; scanf("%lld", &a); return a; }
inline int scd() { int a; scanf("%d", &a); return a; }
inline double scf() { double a; scanf("%lf",&a); return a; }
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) (c).begin(), (c).end()
#define sz(a) ((int)a.size())
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
#define errorpair(a) cout<<#a<<" = ( "<<((a).first)<<" , "<<((a).second)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll

typedef pair<lld,lld> PA;

lld powP(lld x, lld y) {
    lld ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}
 
bool bitSet(lld n, lld bit){
    if((n & (1LL << bit)) != 0) return true;
    else return false;
}
 
lld findGcd(lld a, lld b){
    while(a != 0) { lld temp = b % a; b = a; a = temp; }
    return b;
}

#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

// vector<lld> G[lim];
string S[lim];
// lld A[lim];

int main(){
    lld R = sc(), C = sc(), k = sc();
    rep(i,0,R-1) cin >> S[i];
    lld allRow = (1 << R) - 1, allCol = (1 << C) - 1;
    lld ans = 0;
    rep(maskRow,0,allRow) rep(maskCol,0,allCol) {
        lld black = 0;
        rep(i,0,R-1) rep(j,0,C-1) {
            black += (S[i][j] == '#') and not bitSet(maskRow, i) and not bitSet(maskCol, j);
        }
        ans += (black == k);
    }
    prL(ans);
    return 0;
}


Measured memory_bytes: 13200
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<double, double>> pairs(n);

    double tot_dist = 0;

    for (int i = 0; i < n; i++) {
        cin >> pairs[i].first >> pairs[i].second;
    }

    for (int i = 0; i < n; i++) {
        pair<double, double> curr = pairs[i];
        for (int j = i + 1; j < n; j++) {
            double curr_x = pairs[i].first;
            double curr_y = pairs[i].second;

            double y_x = pairs[j].first;
            double y_y = pairs[j].second;

            tot_dist += (sqrt(pow((curr_x - y_x), 2) + pow((curr_y - y_y), 2))) * 2 / n;
        }
    }

    cout << setprecision(10) << tot_dist << endl;

    return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;
const int MAX = 10000;
#define NIL -1

typedef struct tree {
    int parent, left, right;
} tree;
tree T[MAX];
int D[MAX], H[MAX]; // depth, height

void setDepth(int u, int d)
{
    if (u == NIL) {
        return;
    }
    D[u] = d;
    setDepth(T[u].left, d + 1);
    setDepth(T[u].right, d + 1);
}

int setHeight(int u)
{
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL) {
        h1 = setHeight(T[u].left) + 1;
    }
    if (T[u].right != NIL) {
        h2 = setHeight(T[u].right) + 1;
    }
    return H[u] = max(h1, h2);
}

// 節点uの兄弟を返す
int getSibling(int u)
{
    if (T[u].parent == NIL) {
        return NIL;
    }
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
        return T[T[u].parent].left;
    }
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
        return T[T[u].parent].right;
    }
    return NIL;
}

void print(int u)
{
    printf("node %d: parent = %d, sibling = %d, ", u, T[u].parent, getSibling(u));
    int deg = 0;
    if (T[u].left != NIL) {
        deg++;
    }
    if (T[u].right != NIL) {
        deg++;
    }
    printf("degree = %d, depth = %d, height = %d, ", deg, D[u], H[u]);
    if (T[u].parent == NIL) {
        printf("root\n");
    } else if (T[u].left == NIL && T[u].right == NIL) {
        printf("leaf\n");
    } else {
        printf("internal node\n");
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, root = 0;
    cin >> n;
    rep(i, n) { T[i].parent = NIL; }

    rep(i, n)
    {
        ll id, left, right;
        cin >> id >> left >> right;
        T[id].left = left;
        T[id].right = right;
        if (left != NIL) {
            T[left].parent = id;
        }
        if (right != NIL) {
            T[right].parent = id;
        }
    }

    rep(i, n)
    {
        if (T[i].parent == NIL) {
            root = i;
        }
    }

    setDepth(root, 0);
    setHeight(root);

    rep(i, n)
    {
        print(i);
    }

    return 0;
}


Measured memory_bytes: 3240
#include<cstdio>

int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int k;
    scanf("%d",&k);
    while(b<=a && k){
        k--;
        b *= 2;
    }
    while(c<=b && k){
        k--;
        c *= 2;
    }
    if(a<b && b<c) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 1660
import sys
N = int(input())
array_N = list(map(int,str(N)))

if not (1 <= N <= 10 ** 8):
    sys.exit()

sum_array_N = 0
for I in range(len(array_N)):
    sum_array_N += array_N[I]

if N % sum_array_N == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;


int main(void){
	int N,K; cin>>N>>K;
	int a[N]; rep(i ,N)cin>>a[i];
	sort(a,a + N);
	int sum = 0;
	for(int j = N - 1; j >= N - K; j--){
		sum += a[j];
	}
	cout<<sum;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int MOD = 1e9+7;

int main() {
    int n,k;
    vector<ll> p(3);
    vector<char> q(3);
    q[0]='s'; q[1]='p'; q[2]='r';
    cin >> n >> k;
    for (int i=0;i<3;i++) cin >> p[i];
    string t;
    cin >> t;
    ll ans=0;
    for (int i=0;i<k;i++) {
        for (int l=0;l<3;l++) {
            if (t[i]==q[l]) ans+=p[l];
        }
        bool flag=false;
        for (int j=i;j+k<n;j+=k) {
            if (t[j]==t[j+k]) {
                if (!flag) {
                    flag=true;
                    continue;
                } else {
                    flag=false;
                }
            } else {
                flag=false;
            }
            for (int l=0;l<3;l++) {
                if (t[j+k]==q[l]) ans+=p[l];
            } 
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N,M;
  cin>>N>>M;
  char A[N][N], B[M][M];
  for(int i=0; i<N; i++){
   for(int j=0; j<N; j++){
   cin>>A[i][j];
   }
  }
  for(int i=0; i<M; i++){
   for(int j=0; j<M; j++){ 
   cin>>B[i][j];
   }
  }
  
  for(int i=0; i+M<=N; i++){
   for(int j=0; j+M<=N; j++){
      bool ans=true;
       for(int x=0; x<M; x++){
        for(int y=0; y<M; y++){
         if(A[i+x][j+y]!=B[x][y]){
           ans=false;
         }
        }
       }
      if(ans){
        cout<<"Yes";
        return 0;
      } 
   }
  }
  
  cout<<"No";
}

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

using namespace std;
typedef long long ll;
int main()
{
    int s=0,m=100000,sum=0;
    int n;
    int a[105];
    cin>>n;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    for(int i=0; i<n; i++)
    {
        s=s+a[i];
        int b;
        b=sum-s;
        if(b>s)
            b=b-s;
        else
            b=s-b;
        if(m>b)
            m=b;
    }
    cout<<m;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(vec) vec.begin(), vec.end()

int main(){
    int n,k,c;
    string s;
    cin >> n >> k >> c >> s;
    vector<int> a;
    rep(i,n){
        if(s.at(i) == 'o'){
            a.push_back(i);
            i += c;
        }
    }
    if(a.size() > k) return 0;
    vector<int> b;
    rrep(i,n){
        if(s.at(i) == 'o'){
            b.push_back(i);
            i -= c;
        }
    }
    reverse(all(b));
    rep(i,k){
        if(a.at(i) == b.at(i)) cout << a.at(i)+1 << endl;
    }
}

Measured memory_bytes: 3448
use proconio::input;

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    let v = [a * c, a * d, b * c, b * d];
    let res = v.iter().max().unwrap();
    println!("{}", res);
}


Measured memory_bytes: 2168
from sys import stdin,stdout
import math
N, D = list(map(int,stdin.readline().strip().split()))
points = []
for _ in range(N):
	x, y = list(map(int,stdin.readline().strip().split()))
	points.append([x,y])
count = 0
for point in points:
	distance = math.sqrt(point[0]**2+point[1]**2)
	if distance<=D:
		count+=1
print(count)


Measured memory_bytes: 39144
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>
#include<set>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

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

    int ans=0;
    rep(i,0,N){
        map<char,bool> dic;

        int cnt=0;
        rep(j,0,i){
            dic[S[j]]=true;
        }
        rep(j,i,N){
            if(dic.count(S[j])==1){
                if(dic[S[j]]==true)cnt++;
                dic[S[j]]=false;
            }
        }
        ans=max(ans,cnt);
    }
    
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

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

int main(){
	ll n,a,b,mm=0,ms=0,ab=0,ans=0,cb=0;
	cin >> n >> a >> b;
	mm = n/(a+b);
	ms = n%(a+b);
	ab = a*mm;
	if(ms > a){
		cb = a;
	}else{
		cb = ms;
	}
	cout << ab+cb << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
typedef long long ll;
typedef pair<int, int> P;

#define DIAG 1
#define UP 2
#define LEFT 3

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int n = sz(s);
    int m = sz(t);

    vector<vector<int> > dp(n+1, vector<int>(m+1));
    vector<vector<int> > prev(n+1, vector<int>(m+1));

    rep(i, n) {
        rep(j, m) {
            if (s[i] == t[j]) {
                dp[i+1][j+1] = dp[i][j] + 1;
                prev[i+1][j+1] = DIAG;
            }
            else {
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
                if (dp[i+1][j+1] == dp[i+1][j]) {
                    prev[i+1][j+1] = LEFT;
                }
                else {
                    prev[i+1][j+1] = UP;
                }
            }
        }
    }

    int l = dp[n][m];
    vector<char> tmp;
    
    while (sz(tmp) < l) {
        if (prev[n][m] == DIAG) {
            tmp.push_back(s[n-1]);
            n--; m--;
        }
        else if (prev[n][m] == LEFT) {
            m--;
        }
        else if (prev[n][m] == UP) {
            n--;
        }
    }
    reverse(all(tmp));
    rep(i, l) cout << tmp[i];
    cout << endl;

}

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

#define STRMAX 100

int main(void)
{
	int num, i;
	char taro[STRMAX], hanako[STRMAX];
	int result;
	int cnt_taro = 0;
	int cnt_hanako = 0;

	scanf("%d", &num);

	for(i=0; i<num; i++) {
		memset(taro, '\0', sizeof(taro));
		memset(hanako, '\0', sizeof(hanako));
		scanf("%s %s", taro, hanako);

		result = strcmp(taro,hanako);
		if (result > 0) {
			cnt_taro += 3;
		}
		else if (result < 0) {
			cnt_hanako += 3;
		}
		else {
			cnt_taro++;
			cnt_hanako++;
		}
	}

	printf("%d %d\n", cnt_taro, cnt_hanako);

	return 0;
}


Measured memory_bytes: 2676
N = int(input())
S = list(map(int, input().split()))
ans = 10000

for T in range(1, N):
    s1 = sum(S[:T+1])
    s2 = sum(S[T+1:])

    diff = abs(s1 - s2)
    if diff < ans:
        ans = diff
        
print (ans)




Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
int main(){
  int n,k;
  cin>>n>>k;
  int a[110];
  rep(i,n) cin>>a[i];
  int dp[100010];
  fill(dp,0);
  rep1(i,k){
    bool f=false;
    rep(j,n){
      if(i-a[j]>=0){
	if(!dp[i-a[j]]){
	  f=true;
	}
      }
    }
    if(f) dp[i]=1;
    else dp[i]=0;
  }
  if(dp[k]) prin("First");
  else prin("Second");
    
	

  return 0;
}


Measured memory_bytes: 640
import java.io.ByteArrayInputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	
	String INPUT = "";
	
	public static void main(String[] args) throws Exception { new Main().run(); }
	
	void run() {
		Scanner sc = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new ByteArrayInputStream(INPUT.getBytes()));
		PrintWriter out = new PrintWriter(System.out);
		
		solve(sc, out);
		out.flush();
	}
	
	void solve(Scanner sc, PrintWriter out) {
		int x = sc.nextInt();
		
		System.out.println(x*x*x);
	}
}



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

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

	bool yes = true;
	int n = s.size();
	for (int i = 0; i < n; ++i) {
		char c = s[i];
		if (i % 2 == 0) {
			//奇数
			if (c == 'R' || c == 'U' || c == 'D') {
				continue;
			}
			else {
				yes = false;
				break;
			}
		}
		else {
			//偶数
			if (c == 'L' || c == 'U' || c == 'D') {
				continue;
			}
			else {
				yes = false;
				break;
			}
		}
	}

	if (yes) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
  ll A, B, C;
  cin >> A >> B >> C;
  if ((A*B*C)%2 == 0) {
    cout << 0 << endl;
  } else {
    cout << min({A*B, B*C, C*A}) << endl;
  }
  return 0;
}

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

using namespace std;

int H,M,cnt=0;
char farm[100][100];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


void dfs(int x, int y, char z){
  //check
  //printf("%d,%d,%c\n",x,y,z);
  //check
  farm[x][y]='.';
  for(int i=0;i<4;i++){
    if(x+dx[i]>=0 && x+dx[i]<H && y+dy[i]>=0 && y+dy[i]<M && farm[x+dx[i]][y+dy[i]]==z) dfs(x+dx[i],y+dy[i],z);
  }
  return ;
}

int main(){
  while(1){
  scanf("%d %d",&H,&M);
  if(H==0 && M==0) break;
  //printf("%d %d\n",H,M);

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



  //check
  /*for(int i=0;i<H;i++){
    for(int j=0;j<M;j++){
      printf("%c",farm[i][j]);
    }
    printf("\n");
  }*/
  //check
  cnt=0;

  for(int i=0;i<H;i++){
    for(int j=0;j<M;j++){
      if(farm[i][j]!='.'){
        cnt++;  dfs(i,j,farm[i][j]);
      }
    }
  }


  printf("%d\n",cnt);
}
  return 0;
}

Measured memory_bytes: 1680
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void app() {
  int n;
  cin>>n;

  auto f=[](int a,int b,int c){
    return a*a+b*b+c*c+a*b+b*c+c*a;
  };

  vector<int> ans(n+1,0);

  rep_range(a,1,n) rep_range(b,1,n){
    if(f(a,b,1)>n) break;
    rep_range(c,1,n){
      int fa=f(a,b,c);
      if(fa>n)break;
      ans[fa]++;
    }
  }

  rep_range(i,1,n+1) cout<<ans[i]<<endl;
}

int main(){app();return 0;}


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

long long N, A[200009], B[200009];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N - 1; i++) {
		if (A[1] >= 1 || A[i + 1] - A[i] >= 2) { cout << "-1" << endl; return 0; }
	}
	if (A[1] >= 1) { cout << "-1" << endl; return 0; }
	for (int i = 1; i <= N; i++) { B[i - A[i]] = max(B[i - A[i]], 1LL * i); }

	long long ret = 0;
	for (int i = 1; i <= N; i++) { if (B[i] >= 1) ret += (B[i] - i); }
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
/* contest template */

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	if (n*a <= b) {
		cout << n*a;
	}
	else {
		cout << b;
	}
	return 0;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    dic = defaultdict(int)
    for _ in range(n):
        dic[input()] += 1
    print('AC x',dic['AC'])
    print('WA x',dic['WA'])
    print('TLE x',dic['TLE'])
    print('RE x',dic['RE'])
if __name__ == "__main__":
    main()

Measured memory_bytes: 74644
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
    int s;
    int a[100005],b[100005];
    while(scanf("%d",&s)!=EOF)
    {
        memset(a,0,sizeof(b));
        memset(b,0,sizeof(b));
        a[1]=s;
        b[a[1]]++;
        for(int i=2;;i++)
        {
            if(a[i-1]%2==0)
                a[i]=a[i-1]/2;
            else
                a[i]=3*a[i-1]+1;
            b[a[i]]++;
            if(b[a[i]]==2)
            {
                printf("%d\n",i);
                break;
            }
        }
    }
    return 0;
}


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

const int maxn=100010;
const int all=1<<15;
const int base=65535;
int f[50010];
int a[maxn];
int que[70010];
bool in[50010];
int n;

int main()
{
	scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		x++;
		y++;
		a[x]^=z;
		a[y]^=z;
	}
	int ans=0;
	int now=0;
	for (int i=1;i<=n;i++)
	if (a[i]!=0)
	{
		if (now&(1<<(a[i]-1)))	ans++;
		now^=1<<(a[i]-1);
	}
	for (int i=0;i<all;i++)
		f[i]=-1;
	f[now]=0;
	in[now]=true;
	int h=1,t=1;
	que[1]=now;
	while (h<=t)
	{
		int u=que[h&base];
		in[u]=false;
		h++;
		for (int i=1;i<=15;i++)
		if (u&(1<<(i-1)))
			for (int j=i+1;j<=15;j++)
			if (u&(1<<(j-1)))
				for (int x=1;x<=15;x++)
				{
					int tmp1=i^x;
					int tmp2=j^x;
					int ha=1;
					int v=u^(1<<(i-1))^(1<<(j-1));
					if (tmp1!=0)
					{
						if (v&(1<<(tmp1-1)))	ha++;
						v^=1<<(tmp1-1);
					}
					if (tmp2!=0)
					{
						if (v&(1<<(tmp2-1)))	ha++;
						v^=1<<(tmp2-1);
					}
					if (f[v]==-1 || f[v]>f[u]+ha)
					{
						f[v]=f[u]+ha;
						if (!in[v])
						{
							t++;
							que[t&base]=v;
						}
					}
				}
	}
	printf("%d\n",f[0]+ans);
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
using namespace std;

typedef pair<int,int> P;

int bit[4010];

void add(int i,int x){
	while(i < 4010){
		bit[i] += x;
		i += i & -i;
	}
}

ll get(int i){
	ll s = 0;
	while(i){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

int h,w,l,p,lu[4000][4000],rd[4000][4000];
ll ans = 0;
bool field[4000][4000] = {};

signed main(){
	cin >> h >> w >> l >> p;
	for(int i = 0;i < p;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		field[a][b] = true;
	}
	for(int i = 0;i < h;i++){
		int cnt = 0;
		for(int j = 0;j < w;j++){
			if(field[i][j]) cnt = 0;
			else cnt++;
			lu[i][j] = cnt;
		}
		cnt = 0;
		for(int j = w - 1;j >= 0;j--){
			if(field[i][j]) cnt = 0;
			else cnt++;
			rd[i][j] = cnt;
		}
	}
	for(int i = 0;i < w;i++){
		int cnt = 0;
		for(int j = 0;j < h;j++){
			if(field[j][i]) cnt = 0;
			else cnt++;
			lu[j][i] = min(cnt,lu[j][i]);
		}
		cnt = 0;
		for(int j = h - 1;j >= 0;j--){
			if(field[j][i]) cnt = 0;
			else cnt++;
			rd[j][i] = min(cnt,rd[j][i]);
		}
	}
	for(int i = -h + 1;i <= w - 1;i++){
		for(int j = 0;j < h;j++) bit[j + 1] = 0;
		vector<int> vec[4010];
		for(int j = 0;j < h;j++){
			if(i + j >= 0 && i + j < w && lu[j][i + j]) vec[j - lu[j][i + j] + 1].push_back(j);
		}
		for(int j = 0;j < h;j++){
			for(int v : vec[j]) add(v + 1,1);
			if(i + j >= 0 && i + j < w && rd[j][i + j] && j + rd[j][i + j] > j + l - 1) ans += get(j + rd[j][i + j]) - get(j + l - 1);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 142884
#include<iostream>
#include<string>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; ++i)

int main(){
int n;
cin>>n;
int cnt=0;
int a[100001];
rep(i,0,n){
    cin>>a[i];
    if(a[i]%2==1) cnt++;
} 
if(cnt%2==0) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}

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

using namespace std;

int main(){
    int a[3], k;
    cin >> a[0] >> a[1] >> a[2] >>k;
    sort(a, a+3);
    int ans = 0;
    for(int i = 0; i < k; i++) a[2] *= 2;
    for(int i = 0; i < 3; i++) ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools

H, W, K = map(int, input().split())
c = []
for _ in range(H):
  c.append(input())

ans = 0  
for h in range(2 ** H):
  for w in range(2 ** W):
    b = 0
    for i in range(H):
      for j in range(W):
        if (h >> i) & 1 == 0 and (w >> j) & 1 ==0:
          if c[i][j] == '#':
            b += 1
    if b == K:
      ans += 1
print(ans)

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

int kouyakusuu(int x,int y){
  int a=x,b=y,c=1;
  while(c!=0){
    c=a%b;
    a=b; b=c;
  }
  return a;
}

int main() {
  int k,n=0,s1,s2;
  cin >> k;
  for (int i = 0; i < k; i++) {
    for (int ii = 0; ii < k; ii++) {
      s1 = kouyakusuu(i+1,ii+1);
      for (int iii = 0; iii < k; iii++) {
        s2 = kouyakusuu(s1,iii+1);
        n+=s2;
      }
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 3636
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	s = readline() |> chomp
	a = Char['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
	for i in 1:length(s)
		for j in 1:26
			if s[i]==a[j]
				print(a[j+n])
			end
		end
	end
	println("")
end
main()

Measured memory_bytes: 172224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
#define BIG 100000000
 
ll  lcm(ll a,ll b)
{
    ll GCD=__gcd(a,b);
    ll lcm=(a*b)/GCD;
    return lcm;
}
ll dp[100005];
ll weight[1000005],value[1000005];
ll total,val;
ll call(ll n)
{
    if(n>=total)
        return 0;
 
    if(dp[n]!=-1)
        return dp[n];
 
    ll res1=BIG,res2=BIG;
 
   // if(weight[n]+c<=val)
    res1=abs(weight[n]-weight[n+1]) + call(n+1);
    if(n+2<=total) res2=abs(weight[n]-weight[n+2]) + call(n+2);
    //cout<<n<<" "<<res1<<" "<<res2<<endl;
    dp[n]=min(res1,res2);
    return dp[n];
 
}
int main()
{
    cin>>total;
    for ( int i = 1; i <=total; ++i )
        cin>>weight[i];
 
    memset(dp, -1, sizeof(dp));
    ll ret=call(1);
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 9600
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

char chlu(char a) {
    if(!isalpha(a))
        return a;
    if(islower(a))
        return toupper(a);
    else
        return tolower(a);
}

int main() {
    string S;
    getline(cin, S);
    rep(i, S.length()) cout << chlu(S.at(i));
    cout << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <cstdio>

int n, m, x, c[12], l[12][12], ans = -1;
bool u[12];

bool check() {
    int res[12] = {0, };
    for (int i = 0 ; i < n ; i++) {
        if (u[i]) {
            for (int j = 0 ; j < m ; j++) {
                res[j] += l[i][j];
            }
        }
    }
    for (int i = 0 ; i < m ; i++) {
        if (res[i] < x) return false;
    }
    return true;
}

int calc() {
    int res = 0;
    for (int i = 0 ; i < n ; i++) {
        if (u[i]) res += c[i];
    }
    return res;
}

void f(int k) {
    if (k == n) {
        if (check()) {
            int tmp = calc();
            if (ans == -1 || tmp < ans) ans = tmp;
        }
        return;
    }
    u[k] = false;
    f(k + 1);
    u[k] = true;
    f(k + 1);
}

int main() {
    scanf("%d%d%d", &n, &m, &x);
    for (int i = 0 ; i < n ; i++) {
        scanf("%d", &c[i]);
        for (int j = 0 ; j < m ; j++) scanf("%d", &l[i][j]);
    }
    f(0);
    printf("%d", ans);
}


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

typedef long long LL;

#define REP(i, n) for(LL i = 0; i < (LL)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    LL N, K;
    cin >> N >> K;
    LL res = 0;
    FOR(b, 1, N + 1) {
        LL x = max<LL>(0, b - K);
        LL r = max<LL>(0, N%b - K + 1);
        LL p = N/b;
        LL y = x*p + r;
        if(K == 0) {
            y--;
        }
        res += y;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(b / a, c) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int main() {
	var(string, s);
	int ans = 1000;
	rep(i, 0, len(s) - 2) {
		chmin(ans, abs(stoi(s.substr(i, 3)) - 753));
	}
	print(ans);
	return 0;
}


Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, K = LI()
    S = list(SS())

    S[K-1] = S[K-1].lower()

    print(''.join(S))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9956
#include <cstdio>
#include <algorithm>
// C - Successive Subtraction

using namespace std;

int A[100005];

int main() {
    int N,i,M,lst,cur1,cur2;

    scanf("%d",&N);

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

    sort(A,A + N);

    M = A[N - 1] - A[0];
    lst = 0;
    for (i = 1;i < N - 1;i++) {
        if (A[i] < 0) {
            lst = i;
            M -= A[i];
        }
        else
            M += A[i];
    }

    printf("%d\n",M);

    cur1 = A[lst];
    for (i = lst + 1;i < N - 1;i++) {
        printf("%d %d\n",cur1,A[i]);
        cur1 -= A[i];
    }

    cur2 = A[N - 1];
    for (i = 0;i < lst;i++) {
        printf("%d %d\n",cur2,A[i]);
        cur2 -= A[i];
    }

    printf("%d %d\n",cur2,cur1);
    
    return 0;
}


Measured memory_bytes: 2176
def main():
    N, K = map(int, input().split(" "))
    S = input()
    if S[K-1] == 'A':
        result = S[:max(K - 1, 0)] + 'a' + S[K:]
    elif S[K-1] == 'B':
        result = S[:max(K - 1, 0)] + 'b' + S[K:]
    else:
        result = S[:max(K - 1, 0)] + 'c' + S[K:]
    print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int h, w;

int main() {
    while (cin >> h >> w) {
        if (h == 0) break;
        int lim = h*h + w*w;
        int res = 1<<29, rh = h, rw = w;
        for (int i = 1; i <= 150; ++i)
            for (int j = i+1; j <= 150; ++j) {
                int sum = i*i + j*j;
                if (sum < lim || (sum == lim && i <= h)) continue;
                if (res > sum) {
                    res = sum, rh = i, rw = j;
                }
                else if (res == sum) {
                    if (rh > i) {
                        rh = i, rw = j;
                    }
                }
            }
        cout << rh << " " << rw << endl;
    }
    return 0;
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {
    
    int n; cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; ++i) cin >> h[i];

    int ans = 0, cur = 0;

    for(int i = 0; i < n; ++i) {
        if(h[i] >= cur) {
            ++ans;
            cur = h[i];
        }
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256