akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  rep (i, n) {
    int tmp;
    cin >> tmp;
    mp[tmp]++;
  }

  int dupl = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    if (itr->second > 1) dupl += itr->second - 1;
    // cout << itr->first << ": " << itr->second << endl;
  }
  // P(dupl);
  if (dupl % 2 == 1) dupl++;
  P(n - dupl);



  return 0;
}



Measured memory_bytes: 4992
import random
from copy import deepcopy

d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]

def min_max(l):
    l_min = min(l)
    l_max = max(l)
    return [1+(i - l_min) / (l_max - l_min) for i in l]

dd = [max(s[i]) for i in range(d)]
qq = min_max(c)
dd = min_max(dd)

ddd = [i for i in range(d)]
qqq = [i for i in range(26)]

ans = []

for i in range(d):
    ans.append(s[i].index(max(s[i]))+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.choices(ddd,k=1,weights=dd)[0]
    lin = [p+1 for p in range(26)]
    Q = random.choices(qqq,k=1,weights=qq)[0]
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(25000):
    random_search()

for i in ans:
    print(i)

Measured memory_bytes: 87880
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n, m, c;
    cin >> n >> m;
    int a, b[n+1]={0};
    for(int i=0; i<m; i++){
      for(int j=0; j<2; j++){
      cin >> a;
      b[a]++;
    }
    }
    for(int i=1; i<=n; i++){
      cout << b[i] << endl;
    }
}


Measured memory_bytes: 3616
from math import floor,sqrt
N=int(input())

p = [1]*floor((10**6))
p[0]=p[1]=0
prime=[]
for i in range(2,len(p)):
    if p[i]==0:
        continue
    prime.append(i)
    for j in range(i*2,len(p),i):
        p[j]=0

ans=0
for x in prime:
    if N%x!=0:
        continue
    cnt=0
    while N%x==0:
        cnt+=1
        N//=x
    ans+=floor((-1+sqrt(1+8*cnt))/2)
print(ans+int(N!=1))


Measured memory_bytes: 20084
#include <stdio.h>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#define mod 1000000007
#define ll long long
#define pi acos(-1)
using namespace std;

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

    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, temp;
    cin>>n;
    vector<int> h(n,0);
    for(int i=0;i<n;i++){
        cin>>temp;
        h[i]=temp;
    }
    vector<int> dp(n+1,INT_MAX);
    dp[0] =0;
    dp[1] = abs(h[1]-h[0]);
  for(int i=2;i<n;i++){
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
  }
    cout<<dp[n-1];
 }

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

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

  // データを受け取る
  vector<vector<pair<int, int>>> vvp(n, vector<pair<int, int>>(0));
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vvp.at(i).resize(a);

    for (int j = 0; j < a; j++) {
      int x, y;
      cin >> x >> y;
      x--; // 0-indexed
      vvp.at(i).at(j) = make_pair(x, y);
    }
  }

  // 受け取ったデータの確認
#ifndef ONLINE_JUDGE
  for (int i = 0; i < n; i++) {
    cout << "i: " << i << endl;
    for (auto p : vvp.at(i)) {
      cout << "x,y: " << p.first << "," << p.second << endl;
    }
  }
#endif

  // bit全探索する
  //
  // n=3の場合、1000 = 8 のため 0〜7 の8パターンになる
  // つまり 000〜111 が探索範囲となる
  // 0,1 の定義は以下とする
  //
  // * 0 = 不親切な人
  // * 1 = 正直者
  //
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int ok = true;

    for (int j = 0; j < n; j++) {
      // j桁目のフラグが立っている (=1) 場合、
      // j番目のユーザーを「正直者」と仮定し、証言を採用する
      //
      // 証言が bit 全探索のパターンと矛盾するかどうかを確認
      if (i & (1 << j)) {
        for (auto p : vvp.at(j)) {
          int x = p.first;
          int y = p.second;
          // ### 例
          // i = 3 の場合、2進数に変換すると 011 になる。
          // つまり、1人目・2人目が正直者であるパターン。
          //
          // (x, y) = (2, 1) の場合、0-indexed にすると (1, 1) となる
          //
          // (i >> x) = (011 >> 1) から、右シフトすると 001 となる。
          // フラグが立っているため、2人目の人は正直者であるパターン。
          //
          // XOR で探索するパターンと、証言に矛盾があるか確認。
          // 矛盾がある場合、(0,1) or (1,0) の組み合わせで結果 1 が返る
          if (((i >> x) ^ y) & 1) {
            // 矛盾が発生したら bool を false にする
            ok = false;
          }
        }
      }
    }

    if (ok) {
      ans = max(ans, __builtin_popcount(i));
    }
  }

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


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

map<vector<int>,vector<int>> memo;

vector<int> f(vector<int> &a){
  int n = a.size();
  // for (int i = 0; i < n; i++) {
  //   cout << a[i] << " ";
  // }
  // cout << endl;
  
  vector<int> res;
  if(n==1){
    return res;
  }

  if(memo[a].size()>0 && memo[a][0]<0){
    return vector<int>();
  } else if(memo[a].size()>0){
    return memo[a];
  }
  
  for (int i = n-1; 0 < i; i--) {
    if(i==a[i]){
      vector<int> aa = a;
      aa.erase(aa.begin()+i);
      res = f(aa);
      if(res.size()==n-2){
	res.push_back(i);
	memo[a]=res;
	return res;
      }else{
	break;
      }
    }
  }

  // for (int i = 0; i < res.size(); i++) {
  //   cout << res[i] << " ";
  // }
  // cout << endl;

  memo[a]=vector<int>{-1};
  return vector<int>();
}

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

  vector<int> b(n+1);
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }

  vector<int> res = f(b);

  if(res.size()==n){
    for (int i = 0; i < n; i++) {
      cout << res[i] << endl;
    }
  }else{
    cout << -1 << endl;
  }

  // for (auto a:memo) {
  //   for (int i = 0; i < a.first.size(); i++) {
  //     cout << a.first[i] << " ";
  //   }
  //   cout << endl;
  //   for (int i = 0; i < a.second.size(); i++) {
  //     cout << a.second[i] << " ";
  //   }
  //   cout << endl;
  // }

  return 0;
}


Measured memory_bytes: 384
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define mod 1000000007
#define N 500055
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,ans,vis[N],t[N],l[N],r[N];
vector <int> v[30];
char str[N];
inline void add(int x,int k){
	for (;x<=n;x+=x&-x) t[x]+=k;
}
inline int query(int x){
	int sum=0;
	for (;x;x-=x&-x) sum+=t[x];
	return sum;
}
signed main(){
	scanf("%s",str+1);n=strlen(str+1);
	F(i,1,n) vis[str[i]-'a']++,v[str[i]-'a'].pb(i);
	int pd=0;F(i,0,25) if (vis[i]&1) pd++;
	F(i,0,25) l[i]=0,r[i]=v[i].size()-1;
	F(i,1,n) add(i,1);
	if (pd>1) ret;
	F(i,1,n){
		int t=str[i]-'a';
		if (l[t]<=r[t]){
			if (l[t]==r[t]){
				ans+=(query(n)-query(v[t][l[t]]))/2;
				add(v[t][l[t]],-1);
			}
			else{
				ans+=query(n)-query(v[t][r[t]]);
				add(v[t][l[t]],-1);
				add(v[t][r[t]],-1);
			}
			r[t]--;l[t]++;
		}
	}
	wrn(ans);
	return 0;
}

Measured memory_bytes: 9204
#include <iostream>
#include <vector>


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

using namespace std;

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

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

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<int>;
using vvi = vc<vi>;

using ll = long long;


int main() {
    int n, m, l;
    cin >> n >> m >> l;

    ll A[100][100];
    REP(i, n) REP(j, m) cin >> A[i][j];
    ll B[100][100];
    REP(j, m) REP(k, l) cin >> B[j][k];

    ll C[100][100];
    REP(i, n) REP(k, l) C[i][k] = 0;

    REP(i, n) REP(j, m) REP(k, l) C[i][k] += A[i][j] * B[j][k];

    REP(i, n) {
        REP(k, l) {
            cout << C[i][k];
            if (k != l - 1) cout << " ";
            else cout << "\n";
        }
    }

    return 0;
}



Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main(){
long a,s,d;
cin >>a>>s>>d;
if(a-d>0){
cout <<a-d <<" " <<s;}
else if(s-d+a>0){
cout <<0 <<" " <<s-d+a;}
  else {
  cout <<0 <<" " <<0;}
return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n,t,x,y;
	cin>>n;
	while(n--)
	{
		cin>>t>>x>>y;
		if(t<x+y||(t-x-y)%2)
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

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

typedef long long ll;
#define fore(i,ii,iii) for(int i=ii;i<iii;i++)
#define mset(a,b) memset(a,b,sizeof(a))
#define pb push_back

const int N=21;
const ll MOD=1e9+7;
int n,x;
ll dp[N][1<<N];
vector<int>g[N];
ll solve(int k,int mask) {
  if(k==n)return 1;
  if(dp[k][mask]!=-1)return dp[k][mask];
  int res=0;
  for(int i:g[k]) {
    if(mask&(1<<i)) {
      res=(res+solve(k+1,mask^(1<<i)))%MOD;
    }
  }
  return dp[k][mask]=res;
}

int main() {
  ios::sync_with_stdio(false);
  mset(dp,-1);
  cin>>n;
  fore(i,0,n)fore(j,0,n){
    cin>>x;
    if(x)g[i].pb(j);
  }
  cout<<solve(0,(1<<n)-1)<<endl;
}

Measured memory_bytes: 344448
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	cin>>n;
    	ll ar[n];
    	for(int i=0;i<n;i++)
    	{
    		cin>>ar[i];
    	}
    	sort(ar,ar+n);
    	ll cnt = n-1;
    	ll ans = ar[n-1];
    	cnt--;
    	for(int i=n-2;i>=0;i--)
    	{
    		if(cnt>=2)
    		{
    			cnt -= 2;
    			ans += 2*ar[i];
    		}
    		else if(cnt==1)
    		{
    			ans += ar[i];
    			cnt--;
    		}
    		if(cnt==0)
    			break;
    	}
    	cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 5204
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){
  int i, j, k;

  int n1 = mid - left;
  int n2 = right - mid;
  for (i = 0; i < n1; i++) L[i] = A[left + i];
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  i = j = 0;
  for (k = left; k < right; k++){
    cnt++;
    if (L[i] <= R[j]){
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int n, int left, int right ){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int main(){
  int A[MAX], n, i;
  scanf("%d", &n);
  cnt = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    if (A[i] >= SENTINEL){
      return 1;
    }
  }
  mergeSort(A, n, 0, n);

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

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

  return 0;
}


Measured memory_bytes: 5628
import sys
readline = sys.stdin.readline

def main():
    N,W = map(int, readline().split())
    value = []; weight = []
    for _ in range(N):
        v, w = map(int, readline().split())
        value.append(v); weight.append(w)
    DP0 = [0] * (W+1)
    DP1 = [0] * (W+1)
    for i in range(N):
        for w in range(weight[i], W+1):
            DP1[w] = max(DP0[w], DP0[w-weight[i]]+value[i])
        DP0 = DP1.copy()
    print(max(DP0))


if __name__ == "__main__":
    main()



Measured memory_bytes: 6520
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　RedcoderになるためAtCoderを巡る旅をしてます。

　　　 　＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　   ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << 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;
}

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

    double N;
    cin >> N;
    double cnt = ceil(N / 2);
    printf("%.10f", cnt / N);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, k;
    cin >> n >> k;

    vl p(n);
    vl rui(n+1);
    rep(i, n) {
        cin >> p[i];
        rui[i+1] = rui[i] + p[i];
    }

    ll u = 0;
    rep(i, n-k+1) {
        chmax(u, rui[i+k] - rui[i]);
    }

    double ans = (double)(u+k)/2.0;
    
    exout(ans);
    re0;
}

Measured memory_bytes: 3456
#include<iostream>
using namespace std;
int main() {
	char c[10][10];
    while (cin>>c[0][0]){
        for (int i = 0; i < 8; i++)
            for (int j = 0; j < 8; j++){
                if(i==0&&j==0)continue;
                cin >> c[i][j];}
        int a, b;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (c[i][j] == '1') {
                    a = i;
                    b = j;
                    goto C;
                }
            }
        }
    C:
        if (c[a][b + 1] == '1') {
            if (c[a + 1][b] == '1') {
                if (c[a + 1][b + 1] == '1')
                    cout << 'A';
                else cout << 'G';
            }
            else {
                if (c[a + 1][b + 1] == '1')
                    cout << 'E';
                else cout << 'C';
            }
        }
        else if (c[a + 1][b + 1] == '1')
            cout << 'F';
        else if (c[a + 1][b - 1] == '1')
            cout << 'D';
        else cout << 'B';
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 2980
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        String[] y = x.split("/", 0);
        Calendar cl = Calendar.getInstance();
        cl.set(Integer.parseInt(y[0]), Integer.parseInt(y[1]), Integer.parseInt(y[2]));
        Calendar clh = Calendar.getInstance();
        clh.set(2019, 4, 30);
        if(clh.compareTo(cl) >= 0){
            System.out.println("Heisei");
        } else {
            System.out.println("TBD");
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll x;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>x;
    if(x>=30)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3644
/********************************************************************
 * ????????¢????????????                                                                                                       *
********************************************************************/
#include <stdio.h>

int main(){
        int W, H, x, y, r;
        char line[30];

        fgets(line, sizeof(line), stdin);
        sscanf(line, "%d %d %d %d %d", &W, &H, &x, &y, &r );

        if(x+r <= W && y+r <= H && x-r >= 0 && y-r >= 0 ) printf("Yes\n");
        else printf("No\n");




        return 0;
}

Measured memory_bytes: 592
n, c = map(int, input().split())
X = [0] * n
V = [0] * n
right = [0] * n
left = [0] * n
rl = [0] * n
lr = [0] * n
rlm = [0] * n
lrm = [0] * n

##(lambda arr, idx:sum(arr[:idx]))([1,2,3,4,5],3)


calsum = 0
for i in range(n):
    X[i], V[i] = map(int, input().split())
    calsum += V[i]
    right[i] = calsum - X[i]
    rl[i] = calsum - 2 * X[i]

calsum = 0
for i in range(n):
    calsum += V[n - i - 1]
    left[i] = calsum - (c - X[n - i - 1])
    lr[i] = calsum - 2 * (c - X[n - i - 1])

m = 0
for i in range(0, n - 1):
    m = max(m, left[i])
    rlm[i] = m + rl[n - i - 2]

m = 0
for i in range(0, n - 1):
    m = max(m, right[i])
    lrm[i] = m + lr[n - i - 2]

print(max(0, max(right), max(left), max(rlm), max(lrm)))


Measured memory_bytes: 36240
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX_H 20
#define MAX_W 20
 
int H,W;
int id[MAX_H][MAX_W];
 
bool check(int x,int y){
    const int dx[4] = {-1,0,-1,0};
    const int dy[4] = {-1,-1,0,0};
    if(x < 1 || y < 1) return true;
    set<int> st;
    for(int i = 0 ; i < 4 ; i++){
	int nx = x + dx[i],ny = y + dy[i];
	st.insert(id[ny][nx]);
    }
    return (st.size() < 4);
}
 
int dfs(int x,int y,int num){
    if(x == W) return dfs(0,y+1,num);
    if(y == H) return 1;
    if(id[y][x] >= 0) return dfs(x+1,y,num);
    if(!check(x,y)) return 0;
 
    int res = 0;
    if(x+1 < W && id[y][x+1] == -1){
	id[y][x] = id[y][x+1] = num;
	res += dfs(x+2,y,num+1);
	id[y][x] = id[y][x+1] = -1;
    }
    if(y+1 < H && id[y+1][x] == -1){
	id[y][x] = id[y+1][x] = num;
	res += dfs(x+1,y,num+1);
	id[y][x] = id[y+1][x] = -1;
    }
    return res;
}
 
int main(){
    while(cin >> H >> W,H){
	memset(id,-1,sizeof(id));
	cout << dfs(0,0,0) << endl;
    }
    return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>

const int MOD_CONST = 2019;

using namespace std;


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

	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}

	sort(d.begin(), d.end());

	int ans = d[n / 2] - d[n / 2 -1];

	cout << ans << endl;
	


}

Measured memory_bytes: 768
w,h,n=map(int,input().split())
A=[[0 for i in range(w)] for j in range(h)]
for i in range(n):
  a,b,c=map(int,input().split())
  if c==1:
    for i in range(h):
      for j in range(a):
        A[i][j]=1
  elif c==2:
    for i in range(h):
      for j in range(w-a):
        A[i][j+a]=1
  elif c==3:
    for i in range(b):
      A[i]=[1 for i in range(w)]
  else:
    for i in range(h-b):
      A[h-i-1]=[1 for i in range(w)]
ans=0
for i in range(h):
  ans+=A[i].count(0)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 1e9+7
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 1e9 + 7;
const int N = 2e5+5, M = N;
//=========================================

const int MAXN = 405;
int n;
int a[MAXN], pre[MAXN];
int dp[MAXN][MAXN];

int slimes(int i, int j){
    if(i >= j)
        return 0;

    if(dp[i][j] != -1)
        return dp[i][j];

    dp[i][j] = LLONG_MAX;
    for(int k = i; k <= j; ++k){
        int x = (pre[k] - pre[i - 1]);
        int y = (pre[j] - pre[k]);
        x += y;
        dp[i][j] = min(dp[i][j], slimes(i, k) + slimes(k + 1, j) + x);
    }

    return dp[i][j];
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    cin >> n;
    for(int i = 0; i < n; ++i)
        cin >> a[i];

    memset(dp, -1, sizeof(dp));
    memset(pre, 0, sizeof(pre));

    pre[0] = a[0];
    for(int i = 1; i < n; ++i)
        pre[i] = (pre[i - 1] + a[i]);

    cout << slimes(0, n - 1) << endl;

    return 0;
}


Measured memory_bytes: 4960
#include <iostream>

using namespace std;

int solve(int A, int B, int C)
{
	int ans = 0;
	while (!(A & 1) && !(B & 1) && !(C & 1)) {
		if (A == B && B == C) {
			return -1;
		}
		int A2 = (B + C) / 2;
		int B2 = (C + A) / 2;
		int C2 = (A + B) / 2;
		A = A2;
		B = B2;
		C = C2;
		++ans;
	}
	return ans;
}

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	cout << solve(A, B, C) << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    long long X, Y;
    cin >> X >> Y;
    long long sum = 1;
    while (X * 2 <= Y)
    {
        X = X * 2;
        sum++;
    }
    
    cout << sum << endl;

    return 0;
}

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

using namespace std;


void solve() {
    int n; cin >> n;
    char c[5] = {'M','A','R','C','H'};
    int a[5] = {0,0,0,0,0};
    for (int _ = 0; _ < n; _++) {
        string s; cin >> s;
        for (int i = 0; i < 5; i++) {
            if (s[0] == c[i]) a[i]++;
        }
    }
    long long res=0;
#define rep(i) for(int i=0;i<5;i++)
    rep(i)rep(j)rep(k)if(i!=j&&i!=k&&j!=k) {
        res += 1ll*a[i]*a[j]*a[k];
    }
    res /= 6;
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main() {
	int S[101], top = 0;
	string s;
	while (cin >> s) {
		if (s == "+") S[--top] += S[top + 1];
		else if (s == "-") S[--top] -= S[top + 1];
		else if (s == "*") S[--top] *= S[top + 1];
		else S[++top] = atoi(s.c_str());
	}
	cout << S[top] << endl;
	return 0;
}


Measured memory_bytes: 3140
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
int main()
{
	int n, m;
  cin>>n>>m;
  if(n<m) swap(m, n);
  ll f[1000001]; f[0]=1;
  for(ll i=1; i<=n+m; i++) f[i]=f[i-1]*i%MOD;
  ll invf[1000001];
  invf[n+m]=inv(f[n+m]);
  for(ll i=n+m-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
  ll ans=n;
  ll tot=f[n+m]*invf[n]%MOD*invf[m]%MOD;
  ll tinv=inv(tot);
  for(int i=0; i<m; i++){
    ans+=f[n-m+2*i]*invf[i]%MOD*invf[n-m+i]%MOD*f[2*m-2*i-1]%MOD*invf[m-i]%MOD*invf[m-i-1]%MOD*tinv%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}

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

int main()
{
  int a, b, k;
  cin >> a >> b >> k;
  int i;
  int count = 0;
  for(i = min(a, b); i >= 0; i--)
  {
    if(a%i == 0 && b%i == 0)
    {
      count++;
    }
    if(count == k) break;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static void swap(ref long x,ref long y)
        {
            var tmp = x;
            x = y;
            y = tmp;
        }
        

        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var n = Read();
            var input = Reads();
            var a = new long[n + 2];
            a[0] = 0;
            a[n + 1] = 0;
            long sum = 0;
            for (int i = 0; i <n; i++)
            {
                a[i+1] = input[i];
                sum += Math.Abs(a[i + 1] - a[i]);
            }
            sum += Math.Abs(a[n + 1] - a[n]);


            var ans = new long[n];
            for (int i = 1; i < n+1; i++)
            {
                ans[i-1] = sum+ Math.Abs(a[i - 1] - a[i + 1]) - Math.Abs(a[i] - a[i - 1]) - Math.Abs(a[i] - a[i + 1]);
                Console.WriteLine(ans[i-1]);
            }
            



            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 30812
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
//using namespace atcoder;

int main(){
    ll K;
    string S;
    cin >> K;
    rep(i,K){
        cout << "ACL";
    } 
    cout << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int n,a[200009],b[200009],head=1,tail,ans=0;
int judge(int x){
	for(int i=1;i<=2*n-1;i++)
		if(a[i]>=x)	b[i]=1;
		else b[i]=0;
	int ahd=n,fwd=n;
	while(ahd>1&&fwd<2*n-1){
		if(b[ahd]==b[ahd-1])	return b[ahd];
		else if(b[fwd]==b[fwd+1])	return b[fwd];
		ahd--;fwd++;
	}
	for(int i=1;i<n;i++)	b[n]^=1;
	return b[n];
}
int main(){
	scanf("%d",&n);tail=2*n-1;
	for(int i=1;i<=2*n-1;i++)	scanf("%d",&a[i]);
	while(head<=tail){
		int mid=(head+tail)/2;
		if(judge(mid)==1)
			{head=mid+1;ans=max(ans,mid);} 
		else tail=mid-1;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1792
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
a = inl()
x = 0
for i in range(n-1):
    for j in range(i+1,n):
        if a[i]>a[j]:
            x += 1
y = 0
for i in range(n):
    for j in range(n):
        if a[i]>a[j]:
            y += 1
print((k*x+k*(k-1)*y//2)%R)


Measured memory_bytes: 3188
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

// template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> v = {a, b, c};
  sort(ALL(v));
  cout << (v[0] + v[1] == v[2]) << endl;
  return;
}


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

int main()
{
  int N;

  cin >> N;

  vector<string> S(N);

  for (int i = 0; i < N; i++)
  {
    cin >> S.at(i);
  }

  int AC = 0, WA = 0, TLE = 0, RE = 0;

  for (int i = 0; i < N; i++)
  {
    if (S.at(i) == "AC")
    {
      AC++;
    }
    else if (S.at(i) == "WA")
    {
      WA++;
    }
    else if (S.at(i) == "TLE")
    {
      TLE++;
    }
    else
    {
      RE++;
    }
  }

  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
}


Measured memory_bytes: 6424
#include <iostream>

using namespace std;

int main() {
    long n,a,b;
    cin>>n>>a>>b;
    
    long k=n/(a+b);
    if(n%(a+b)>a)
    {
        cout<<k*a+a;
    }
    else
    {
        cout<<k*a+n%(a+b);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }

int n, q;
int main() {
    cin >> n;
    vector<int> s(n, 0);
    for(int i = 0; i < n; ++i) cin >> s.at(i);
    cin >> q;
    vector<int> t(q, 0);
    for(int i = 0; i < q; ++i) cin >> t.at(i);

    sort(s.begin(), s.end());

    int cnt = 0;
    for(int i = 0; i < q; ++i) {
        int no = lower_bound(s.begin(), s.end(), t.at(i)) - s.begin();
        if(no != n) {
            if(s.at(no) == t.at(i)) cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    ll x;
    cin >> x;

    ll v = 100;
    int ans = 0;
    while (v < x) {
        ll hoge = v / 100;
        v += hoge;
        ++ans;
    }
    cout << ans << newl;

    return 0;
}

Measured memory_bytes: 3608
import collections

N, M = map(int,input().split())
H = [int(i) for i in input().split()]

X = []
for i in range(M):
    Aj, Bj = map(int,input().split())
    if H[Aj - 1] < H[Bj - 1]:
       X.append(Aj)
    elif H[Bj - 1] < H[Aj - 1]:
       X.append(Bj)
    elif H[Aj - 1] == H[Bj - 1]:
        X.append(Aj)
        X.append(Bj)

low_H = collections.Counter(X)
ans = N - len(low_H)
print(ans)


Measured memory_bytes: 22044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int N;
    cin >> N;

    cout << (N-1)/2 << endl;

   return 0;
}

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

int main() {
  long long N;
  cin >> N;
  long long ac=0, wa=0, tle=0, re=0;
  for (int i=0; i<N; i++) {
    string s;
    cin >> s;
    if (s == "AC") {
      ac++;
    } else if (s == "WA") {
      wa++;
    } else if (s == "TLE") {
      tle++;
    } else {
      re++;
    }
  }
  
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define For(i,x,y) for(int i = x; i <= y; ++i)
#define FOR For
#define rev_For(i,x,y) for(int i = x; i >= y; --i)
#define REV_FOR rev_For
#define ll long long
#define Size(v) ((int)v.size())
#define _section "\n--------------------\n"
#define fi first
#define se second
#define pb push_back
using namespace std;
// using namespace __gnu_pbds;


int N, W;
const int nax = 105;
const int NAX = 100005;
const int INF = 1e15;
int w[nax], v[nax];
int dp[nax][100005];

void input() {
	cin >> N >> W;
	FOR (i, 1, N) {
		cin >> w[i] >> v[i];
	}

	FOR (i, 0, nax - 1) {
		FOR (j, 0, NAX - 1) {
			dp[i][j] = -1;
		}
	}
}

int calc(int i, int j) {
	// considering the i-th item, j space left
	if (j < 0) return -INF;
	if (i <= 0) return 0;

	if (dp[i][j] != -1) return dp[i][j];

	int ret = -INF;

	if (calc(i - 1, j) != -INF) ret = max(ret, calc(i - 1, j));
	if (calc(i - 1, j - w[i]) != -INF) ret = max(ret, calc(i - 1, j - w[i]) + v[i]);

	return (dp[i][j] = ret);
}

void solve() {
	cout << calc(N, W);
}

signed main() {
#ifdef _DEBUG
	// freopen("INPUT.inp", "r", stdin);
	//freopen("OUTPUT.out", "w", stdout);
	clock_t start, end;
	start = clock();
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------------------------------------------
//----------------------------------MAIN PROGRAM--------------------------------------
	int t = 1;
	while (t--) {
		input();
		solve();
	}
//--------------------------------------END-------------------------------------------
//------------------------------------------------------------------------------------
#ifdef _DEBUG
	end = clock();
	cerr << "\n----------\nTime Elapsed: " << fixed << double(end - start) / double(CLOCKS_PER_SEC) << setprecision(6) << '\n';
#endif
	return 0;
}

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

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

  for(int i = 1; i <= n; i++)
    {
      // 3 no baisuu
      if(i % 3 == 0)
	{cout << " " << i;}

      // 3 ga tuku
      else
	{
	  x = i;
	  do{
	    if( x % 10 == 3)
	      {cout << " " << i;
		break;}
	    x = x / 10;
	  }while(x);	  
	}
      
    }
  
  cout << endl;
  return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 1 << 30;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n,0);
    rep(i,n)cin >> a[i];
    ll res = LONG_LONG_MAX;
    for(ll bit = 0;bit < (1 << n);bit++){
        if(__builtin_popcount(bit) < k)continue;
        ll height = a.front();
        ll cost = 0;
        //rep(i,n)if(bit & (1 << i))h.emplace_back(a[i]);
        //rep(i,h.size()){
        //    while(h[i] < height){
        //        h[i]++;
        //        cost++;
        //    }
        //    height = h[i]+1;
        //}
        auto h = a;
        rep(i,n){
            if(bit & (1 << i)){
                while(h[i] < height){
                    h[i]++;
                    cost++;
                }
                height = h[i]+1;
            }else{
                height = max(height,h[i] + 1);
            }
        }
        res = min(res,cost);
    }
    cout << res << "\n";
    return 0;
}


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

int main(){
	int N, K;
  	char S[51];
  
  cin >> N >> K;
  cin >> S;
  
  if(S[K-1] == 'A') S[K-1] = 'a';
  if(S[K-1] == 'B') S[K-1] = 'b';
  if(S[K-1] == 'C') S[K-1] = 'c';
  
  cout << S << endl;
  
  return 0;
  
}


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

int main(){
	int n,x,c = 0; cin>>n;
	vector<int> a,b;
	for(int i = 0;i<n;i++){
		cin>>x;
		a.push_back(x);
		b.push_back(x);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < n;i++){
		if(a[i] != b[i]){
			c++;
		}
	}
	//cout<<"c:"<<c;
	if(c!=2 && c!=0)
		cout<<"NO\n";
	else
		cout<<"YES\n";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<set>
#include<queue>
#include<algorithm>
#define maxn 100005
using namespace std;
typedef pair<int,int> PII;
typedef set<int>::iterator siter;
int n,fa[maxn],cnt;
queue<PII> q;
set<int> G1[maxn],G2[maxn];
int find(int x)
{
	if(fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		G1[u].insert(v); G1[v].insert(u);
	}
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		G2[u].insert(v); G2[v].insert(u);
		if(G1[u].find(v)!=G1[u].end()) q.push(PII(u,v));
	}
	while(!q.empty())
	{
		int u=q.front().first,v=q.front().second; q.pop();
		u=find(u),v=find(v);
		if(u==v) continue;
		cnt++;
		if(cnt==n) break;
		if(G1[u].size()+G2[u].size()>G1[v].size()+G2[v].size()) swap(u,v);
		fa[u]=v;
		G1[u].erase(v); G1[v].erase(u);
		G2[u].erase(v); G2[v].erase(u);
		for(siter it=G1[u].begin();it!=G1[u].end();it++)
		{
			int x=*it;
			G1[x].erase(u); G1[x].insert(v);
			G1[v].insert(x);
			if(G2[x].find(v)!=G2[x].end()) q.push(PII(x,v));
		}
		for(siter it=G2[u].begin();it!=G2[u].end();it++)
		{
			int x=*it;
			G2[x].erase(u); G2[x].insert(v);
			G2[v].insert(x);
			if(G1[x].find(v)!=G1[x].end()) q.push(PII(x,v));
		}
	}
	int cnt=0;
	for(int i=1;i<=n;i++)
		if(find(i)==i) cnt++;
	printf("%s\n",cnt==1?"YES":"NO");
}

Measured memory_bytes: 31104
#include <stdio.h>

int main(){
    int x, y;
    while(1){
        scanf("%d %d", &x, &y);
        if(x==0 && y==0)break;
        if(x<y){
            printf("%d %d\n", x, y);
        }else{
            printf("%d %d\n", y, x);
        }
    }
    return 0;
}

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

int main( int argc, char* argv[]) {
  int N, T;
  cin >> N >> T;
  vector<int> C(N,1001);
  for( int i=0; i<N; ++i ){
    int c, t;
    cin >> c >> t;
    if( t <= T ){
      C[i] = c;
    }
  }
  sort(C.begin(), C.end());
  if( C[0]>1000 ){
    cout << "TLE" << endl;
  } else {
    cout << C[0] << endl;
  }
  return 0;
}
   

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

int main() {
  double a, b, h, m, deg, ans;
  scanf("%lf %lf %lf %lf", &a, &b, &h, &m);
    
  //c2=a2+b2−2ab*cos𝐶
  deg = fabs((11*m-60*h)*M_PI/360);
  ans = sqrt(a*a + b*b - 2*a*b*cos(deg));
  
  printf("%.16lf", ans);
  return(0);
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll K;
    string S="ACL";
    cin >> K;

    REP(i,K){
        cout << S;
    }
    cout << " " << endl;

}


Measured memory_bytes: 3572
grade :: Int -> Int -> Int -> String
grade (-1) _ _ = "F"
grade _ (-1) _ = "F"
grade m f r | m + f >= 80 = "A"
            | m + f >= 65 = "B"
            | m + f >= 50 = "C"
            | m + f >= 30 = if r >= 50 then "C" else "D"
            | otherwise   = "F"

main :: IO ()
main = do
  [m, f, r] <- fmap (map read . words) getLine
  if m == -1 && f == -1 && r == -1
    then return ()
    else do
    putStrLn $ grade m f r
    main

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n),b(n),c(n);
	for(auto&i:a)cin>>i; for(auto&i:b)cin>>i; for(auto&i:c)cin>>i;
	sort(a.begin(),a.end()); sort(b.begin(),b.end()); sort(c.begin(),c.end());
	vector<uint64_t>mp(n);
	for(int i=0;i<n;++i){
		auto citer=upper_bound(c.begin(),c.end(),b.at(i));
		if(citer==c.end())break;
		mp.at(i)=c.end()-citer;
	}
	for(int i=n-2;i>=0;--i)mp.at(i)+=mp.at(i+1);
	uint64_t ans=0;
	for(auto&i:a){
		auto biter=upper_bound(b.begin(),b.end(),i);
		if(biter==b.end())break;
		ans+=mp.at(biter-b.begin());
	}
	cout<<ans<<"\n"s;
}

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


int main(){

int n,k;
cin >> n >> k;
vector<int>p(n);
rep(i,n) cin >> p[i];

sort(p.begin(),p.end());
int ans = 0;
rep(i,k){
    ans += p[i];
}



cout << ans << endl;


}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

long long int mod = 1000000007LL;
long long int sum = 0LL;
long long int freq[60];
long long int addent1;
int main()
{
  int n;
  scanf("%d",&n);
  long long int a[n];
  for(int i = 0; i < n; i++) {
    scanf("%lld",&a[i]);
  }
  for(int i = 0; i < 60; i++) {
    freq[i] = 0LL;
  }
  for(int i = 0; i < n; i++) {
    for(int j = 59; j >= 0; j--) {
      if (a[i] >= (1LL << j)) {
        freq[j] = freq[j] + 1LL;
        a[i]    = a[i] - (1LL << j);
      }
    }
  }
  for(int i = 0; i < 60; i++) {
    addent1 = ((freq[i]%mod) * (((long long int)n - (freq[i])%mod)))%mod;
    sum = (sum + ((addent1 * ((1LL << i)%mod)) % mod)) % mod;
  }
  printf("%lld\n",sum);
  return 0;
}


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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
constexpr int INF = 0x3f3f3f3f; constexpr ll BINF = 0x3f3f3f3f3f3f3f3fLL;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve() {
	int n; cin >> n;
	vvi g(n);
	for (int i=0;i<n;i++) {
		int k; cin >> k; g[i].resize(k);
		cin >> g[i];
	}
	vi par(n, -1), dep(n);
	function<void(int, int)> dfs = [&] (int u, int p) {
		for (int v : g[u]) if (v - p) {
			dep[v] = dep[u] + 1;
			par[v] = u;
			dfs(v, u);
		}
	};
	dfs(0, -1);
	const int M = 20;
	vvi dp(n, vi(M, -1));
	for (int i=0;i<n;i++) dp[i][0] = par[i];
	for (int j=1;j<M;j++) for (int i=0;i<n;i++)
		if (dp[i][j - 1] != -1) dp[i][j] = dp[dp[i][j - 1]][j - 1];
	auto lca = [&] (int u, int v) {
		if (dep[u] > dep[v]) swap(u, v);
		for (int j=M-1;j>=0;j--) if (dp[v][j] != -1 && dep[dp[v][j]] >= dep[u]) v = dp[v][j];
		if (u == v) return u;
		for (int j=M-1;j>=0;j--) if (dp[u][j] != dp[v][j]) u = dp[u][j], v = dp[v][j];
		return par[u];
	};
	int q; cin >> q;
	while (q--) {
		int u, v; cin >> u >> v;
		cout << lca(u, v) << endl;
	}
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 28604
n,d = map(int,input().split(" "))
import math
countd = 0

for i in range(n):
    x,y = map(int,input().split(" "))
    xyd2 = (x**2 + y**2)
    # print(xyd2)
    xyd = math.sqrt(xyd2)
    # print(xyd)
    if xyd <= d:
        countd += 1

print(countd)

Measured memory_bytes: 9044