akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{

      int n;
      cin>>n;
      ll a[n];
      ll sum=0,mn=0;
      for(int i=0;i<n;i++){
            cin>>a[i];
            mn=__gcd(mn,a[i]);
      }
      cout<<mn<<endl;

}


Measured memory_bytes: 4420
#include <stdio.h>

int main() {
  int h,w,i,j,k,p,q;
  scanf("%d %d",&h,&w);
  int s[h][w];
  char temp[w];
  int blank = 0;
  for (i=0;i<h;i++) {
    scanf("%s",temp);
    for (j=0;j<w;j++) {
      if (temp[j] == '.') {
        s[i][j] = 0;
        blank++;
      } else {
        s[i][j] = -1;
      }
    }
  }

  s[0][0] = 1;
  k = 1;
  while (s[h-1][w-1] < 1 && k < h*w + 1) {
    for (i=0;i<h;i++) {
      for (j=0;j<w;j++) {
        if (s[i][j] == k) {
          p = 0;
          q = -1;
          if (0<j) {
            if (s[i+p][j+q]==0) {
              s[i+p][j+q]=k+1;
            }
          }
          p = 0;
          q = 1;
          if (j<w-1) {
            if (s[i+p][j+q]==0) {
              s[i+p][j+q]=k+1;
            }
          }
          p = -1;
          q = 0;
          if (0<i) {
            if (s[i+p][j+q]==0) {
              s[i+p][j+q]=k+1;
            }
          }
          p = 1;
          q = 0;
          if (i<h-1) {
            if (s[i+p][j+q]==0) {
              s[i+p][j+q]=k+1;
            }
          }
        }
      }
    }
    k++;
  }
  if(s[h-1][w-1] == 0) {
    printf("-1\n");
  } else {
    printf("%d\n",blank-s[h-1][w-1]);
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    int x;
    cin >> x;
    if(x < 600) cout << 8 << endl;
    else if( x < 800) cout << 7 << endl;
    else if( x < 1000) cout << 6 << endl;
    else if( x < 1200) cout << 5 << endl;
    else if( x < 1400) cout << 4 << endl;
    else if( x < 1600) cout << 3 << endl;
    else if( x < 1800) cout << 2 << endl;
    else cout << 1 << endl; 
}

Measured memory_bytes: 3592
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut a:Vec<u128> = (0..n+1).map(|_| read()).collect();
    let b:Vec<u128> = (0..n).map(|_| read()).collect();
    let mut cnt = 0;
    for i in 0..n {
        let x = min(a[i], b[i]);
        cnt += x;
        cnt += min(a[i+1], b[i] - x);
        a[i+1] -= min(a[i+1], b[i] - x);
    }
    println!("{}", cnt);
}


Measured memory_bytes: 5132
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
struct S{
  int p,q;
  char s;
  S(){}
  S(int p,int q,char s):p(p),q(q),s(s){}
};
S fi(vector<S> a){
  int i,j,k;
  for(i=0;i<(int)a.size();++i){
    if(a[i].s=='('){
      k=1;
      for(j=i;k;){
	++j;
	if(0){
	}else if(a[j].s=='('){
	  ++k;
	}else if(a[j].s==')'){
	  --k;
	}
      }
      S b=fi(vector<S>(a.begin()+i+1,a.begin()+j));
      if(b.s=='o')
	return b;
      a.insert(a.erase(a.begin()+i,a.begin()+j+1),b);
    }
  }
  for(i=1;i<(int)a.size();i+=2){
    if(a[i].s=='*'){
      S b=S(a[i-1].p*a[i+1].p-a[i-1].q*a[i+1].q,a[i-1].p*a[i+1].q+a[i-1].q*a[i+1].p,'\0');
      a.insert(a.erase(a.begin()+i-1,a.begin()+i+2),b);
      if(abs(a[i-1].p)>10000||abs(a[i-1].q)>10000)
	return S(0,0,'o');
      i-=2;
    }
  }
  while((int)a.size()>1){
    S b;
    if(0){
    }else if(a[1].s=='+'){
      b=S(a[0].p+a[2].p,a[0].q+a[2].q,'\0');
    }else if(a[1].s=='-'){
      b=S(a[0].p-a[2].p,a[0].q-a[2].q,'\0');
    }
    a.insert(a.erase(a.begin(),a.begin()+3),b);
    if(abs(a[0].p)>10000||abs(a[0].q)>10000)
      return S(0,0,'o');
  }
  return a[0];
}
int main(){
  int i,j;
  string s;
  while(cin>>s){
    int ln=s.length();
    vector<S> a;
    a.reserve(ln);
    for(i=0;i<ln;){
      if(0){
      }else if(s[i]=='i'){
	a.push_back(S(0,1,'\0'));
	++i;
      }else if('0'<=s[i]&&s[i]<='9'){
	for(j=i+1;j<ln&&'0'<=s[j]&&s[j]<='9';++j);
	a.push_back(S(atoi(s.substr(i,j-i).c_str()),0,'\0'));
	i=j;
      }else{
	a.push_back(S(0,0,s[i]));
	++i;
      }
    }
    for(i=0;i<(int)a.size();++i){
      if(a[i].s=='\0'&&(abs(a[i].p)>10000||abs(a[i].q)>10000))
	break;
    }
    if(i<(int)a.size()){
      cout<<"overflow"<<endl;
      continue;
    }
    S b=fi(a);
    if(b.s=='o'){
      cout<<"overflow"<<endl;
    }else{
      if(0){
      }else if(b.p&&b.q){
	cout<<b.p<<(b.q>0?"+":"")<<b.q<<"i"<<endl;	
      }else if(b.p){
	cout<<b.p<<endl;
      }else if(b.q){
	cout<<b.q<<"i"<<endl;
      }else{
	cout<<0<<endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define fi                      first
#define se                      second
#define pb                      push_back
#define pbb                     pop_back
#define mp                      make_pair
#define pii     	            pair<int,int>
#define all(x)                  x.begin(), x.end()
#define mem(array, value)       memset(array, value, sizeof(array))
#define fastRead 	            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#ifdef Lollipop
    #define line                    cout << "\n===================\n"
    #define trace(...)              __f( #__VA_ARGS__ , __VA_ARGS__ )
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " = " << arg1 << "\n";
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " = " << arg1 << " , ";
    __f(comma + 1, args...);
    }
#else
    #define line
    #define trace(...)
#endif

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

inline ll power(ll a, ll p){
    ll res = 1, x = a;
    while (p){
        if (p & 1) res = (res * x);
        x = (x * x), p >>= 1;
    }
    return res;
}
inline ll big_mod(ll a, ll p, ll m){
    ll res = 1 % m, x = a % m;
    while (p){
        if (p & 1) res = (res * x) % m;
        x = (x * x) % m, p >>= 1;
    }
    return res;
}

const ll INF = 1e15;


int main ()
{
    #ifdef Lollipop
        freopen ("input.txt", "r", stdin);
        //freopen ("output.txt", "w", stdout);
    #endif
    //fastRead;

    string s;
    cin >> s;
    int len = s.size();
    int res = 0;

    for (int i = 1; i < len; i++){
        if (s[i] == s[i - 1]){
            if (s[i] == '0'){
                s[i] = '1';
            }
            else{
                s[i] = '0';
            }
            res++;
        }
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 512
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a:u32,
        b:u32,
        c:u32,
        x:u32
    }
    let mut _cnt = 0;
    for i in 0..a + 1 {
        for j in 0..b + 1 {
            for k in 0..c + 1 {
                let cost = 500 * i + 100 * j + 50 * k;
                if cost == x {
                    _cnt += 1;
                }
            }
        }
    }
    println!("{}", _cnt)
}


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

#define DEBUG(...) fprintf(stderr,__VA_ARGS__)
#define clr(x) memset(x,0,sizeof x)
#define RG register

#define px first
#define py second

using std :: max;
using std :: min;
using std :: pair;
using std :: make_pair;

typedef long long LL;
typedef pair<LL,LL> pll;
typedef pair<int,int> pii;

static const int INF = 1 << 30;
static const LL oo = 1LL << 60;
static const int maxm = 1e5 + 10;
static const LL mod = 1e9 + 7;

template <class T> inline bool chkmax(T &x, T y) {
    return x < y ? x = y,true : false;
}

template <class T> inline bool chkmin(T &x, T y) {
    return x > y ? x = y,true : false;
}

template <class T> inline void read (T &in) {
    in = 0; char ch = getchar(); T f = 1;
    for (;ch > '9' || ch < '0';ch = getchar()) if (ch == '-') f = -1;
    for (;ch >= '0' && ch <= '9';ch = getchar()) in = in * 10 + ch - '0';
    in = in * f;
}

LL prm[maxm],sig[maxm],ddf[maxm],pre[maxm];
int npr[maxm],ind[maxm],e[maxm];
LL n,K,ans;

LL fpm(LL x,LL k) {
	LL res = 1;
	while(k) {
		if(k & 1) res = res * x % mod;
		x = x * x % mod;
		k >>= 1;
	}
	return res;
}

void getPrime(int N) {
	sig[1] = 1,e[1] = 0;
	for(int i = 2;i <= N;i++) {
		if(!npr[i]) prm[++prm[0]] = i,sig[i] = 2,e[i] = 1;
		for(int j = 1;j <= prm[0] && 1LL * i * prm[j] <= N;j++) {
			npr[1LL * i * prm[j]] = 1;
			if(i % prm[j] == 0) {
				sig[i * prm[j]] = sig[i] / (e[i] + 1) * (e[i] + 2);
				e[i * prm[j]] = e[i] + 1;
				break;
			}
			sig[i * prm[j]] = sig[i] * sig[prm[j]];
			e[i * prm[j]] = 1;
		}
	}
	for(int i = 1;i <= N;i++) pre[i] = pre[i - 1] + sig[i];
}

int main() {

	read(n); read(K);

/*	
	for(int r = K;r <= n;r++) {
		for(int b = r + 1;b <= n;b++) {
			if(r) ans += (n - r) / b + 1;
			else ans += (n - r) / b;
		}
	}
*/

	for(LL r = K;r <= n;r++) {
		for(LL b = r + 1, nxt = 0;b <= n;b = nxt + 1) {
			if(n - r >= b) {
				nxt = min(n, (n - r) / ((n - r) / b));
				LL num = (n - r) / b + (r != 0);
				ans += 1LL * num * (nxt - b + 1);
			} else {
				ans += (n - b + 1);
				break;
			}
		}
	}
	
	printf("%lld\n", ans);

	return 0;
}


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

using namespace std;
#define MAX 500001

int H, A[MAX];

int _left(int node) {
  return node * 2;
}
int _right(int node) {
  return node * 2 + 1;
}

void maxHeapify(int A[], int node) {
  int left, right, largest;
  left = _left(node);
  right = _right(node);

  if (left <= H && A[left] > A[node]) {
    largest = left;
  } else {
    largest = node;
  }
  if (right <= H && A[right] > A[largest]) {
    largest = right;
  }
  if (largest != node) {
    swap(A[node], A[largest]);
    maxHeapify(A, largest);
  }
}

void buildMaxHeap(int A[]) {
  for (int i = H / 2; i >= 1; i--) {
    maxHeapify(A, i);
  }
}

int main() {
  cin >> H;
  for (int i = 1; i <= H; i++) {
    cin >> A[i];
  }
  buildMaxHeap(A);
  for (int i = 1; i <= H; i++) {
    cout << " " << A[i];
  }
  cout << endl;

  return 0;
}



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

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		if(n%500 <= a)
			System.out.println("Yes"); 
		else System.out.println("No");
	}
}

Measured memory_bytes: 23252
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n,q,b,e;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	cin>>q;
	for(int j=0;j<q;j++){
		cin>>b>>e;
		reverse(a.begin()+b,a.begin()+e);
	}
	for(int i=0;i<n;i++){
		if(i==0)cout<<a[i];
		else cout<<" "<<a[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3136
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        av: [usize; n]
    };

    let mut x = av[0];
    let mut y = av[0];
    let mut pairs = Vec::new();
    for &a in av.iter().skip(1).chain(vec![0].iter()) {
        if a > y {
            y = a;
        } else {
            pairs.push((x, y));
            x = a;
            y = a;
        }
    }
    let pairs = pairs
        .into_iter()
        .filter(|(x, y)| x != y)
        .collect::<Vec<_>>();

    let mut money = 1000;
    for (x, y) in pairs {
        let v = money / x * y;
        let rest = money - (money / x * x);
        if v + rest > money {
            money = v + rest;
        }
    }
    println!("{}", money);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2272
/**
 * Created by hiramekun at 20:51 on 2019-12-22.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    vl a(n);
    cin >> a;

    ll now = 0;
    rep(i, n) {
        if (a[i] == now + 1) {
            now++;
        }
    }
    if (now) {
        cout << n - now << '\n';
    } else {
        cout << -1 << '\n';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define pb push_back
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
#define tp(a, b, c) make_tuple(a, b, c)
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef pair<ll, P> TP;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//
ll n;
//-------------------関数----------------------//
int main() {
  ll k;
  cin >> k;
  vector<ll> a;
  REP(i, k) {
    ll h;
    cin >> h;
    a.pb(h);
  }
  ll mi = 0, ma = INF;
  ll Ma, Mi;
  while (ma - mi > 1) {
    ll m = mi + ma;
    ll moto = m / 2;
    m /= 2;
    REP(i, k) { m = m - (m % a[i]); }
    if (m >= 2) {
      ma = moto;
    } else {
      mi = moto;
    }
  }
  Ma = ma;
  mi = 0;
  ma = INF;
  while (ma - mi > 1) {
    ll m = mi + ma;
    ll moto = m / 2;
    m /= 2;
    REP(i, k) { m = m - (m % a[i]); }
    if (m <= 2) {
      mi = moto;
    } else {
      ma = moto;
    }
  }
  ll h = Ma;
  REP(i, k) { h = h - (h % a[i]); }
  if (h != 2) {
    cout << -1 << endl;
    return 0;
  }
  h = mi;
  REP(i, k) { h = h - (h % a[i]); }
  if (h != 2) {
    cout << -1 << endl;
    return 0;
  }
  cout << Ma << " " << mi << endl;
}


Measured memory_bytes: 1400
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int t;cin>>t;while(t--)
#define N 100003
#define M 103
#define inf LLONG_MAX
//int mod=1e9+7;
//int mod=998244353;

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

    int r,g,b,n;
    cin>>r>>g>>b>>n;
    int ans=0,i,j,k;
    for(i=0;i<=(n/r)+1;++i)
    {
        for(j=0;j<=(n/g)+1;++j)
        {
            k=n-i*r-j*g;
            if(k>=0 and k%b==0)
                ++ans;
        }
    }
    cout<<ans;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if (N % 1111 == 0) {cout << "Yes" << endl;}
  else if (N / 10 % 111 == 0) {cout << "Yes" << endl;}
  else if (N % 1000 % 111 == 0) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

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

using namespace std;

int main()
{
	int num[5];
	
	for (int i = 0; i < 5; i++){
		cin >> num[i];
	}
	sort(num, num + 5);
	
	cout << num[4];
	for (int i = 3; i >= 0; i--){
		cout << " " << num[i];
	}
	cout << endl;
	
	return (0);
}

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

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

using namespace std;
using ll = long long;

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

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

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

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

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

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

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

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

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

ll Fact(ll n) {
    ll res = 1;
    for (int i = 1; i <= n; i++) {
        res *= i;
        res %= MOD;
    }
    return res;
}

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

    int N, M;
    cin >> N >> M;

    ll ans = 0;
    if (abs(N - M) >= 2) {
        ans = 0;
    }
    else {
        ans = Fact(N) * Fact(M);
        if (N == M) {
            ans *= 2;
        }
        ans %= MOD;
    }


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per for(int i=n-1;i>=0;--i)
#define ll long long 
#define pb push_back
#define all(x) (x).begin(),(x).end() 
#define in insert
#define transup(str) transform(str.begin(),str.end(),str.begin(),::toupper)
#define translow(str) transform(str.begin(),str.end(),str.begin(),::tolower)
#define intmax INT_MAX
#define intmin INT_MIN
using namespace std;
int gcd(int a,int b){

	if (b==0){
		return a;
	}
	else{
		return gcd(b,a%b);
	}
}
std::vector<int> primefactors;   
void primefactorisation(int n)  
{  
 	
    while (n % 2 == 0)  
    {  
        primefactors.pb(2);
        n = n/2;  
    }  
  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        
        while (n % i == 0)  
        {  
            primefactors.pb(i);
            n = n/i;  
        }  
    }
    if (n>2)
    {
        primefactors.pb(n);
    }
    return ;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
ll check(int*arr,int s,int e,int key){

    ll ans=-1;
    while(s<=e){
       
        ll mid=(s+e)/2;
        if (arr[mid]==key)
        {
            ans=1;
            break;
        }
        else if (arr[mid]>key)
        {
            e=mid-1;
        }
        else if (arr[mid]<key)
        {
            s=mid+1;
        }
    }

    return ans;
}
void sieve(){

	int prime[10000]={0};
	for (int i = 4; i < 10000; i+=2)
	{
		prime[i]=1;
	}
	prime[2]=0;
	for(int i=3;i<10000;i+=2){
		for(int j=i*i;j<10000;j+=i){
			prime[j]=1;
		}
	}
	prime[0]=1;
	prime[1]=1;
	std::vector<int> vprime;
	for(int i=0;i<10000;++i){
		if (prime[i]==0)
		{
			vprime.pb(i);
		}
	}

}
bool compare(int a,int b){
	return a>b;
}
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	 
	ll x;
    cin>>x;
    int cnt=0;
    if (x/500!=0)
    {
        cnt+=(x/500)*1000;
        int rem=x%500;
        cnt+=(rem/5)*5;
        cout<<cnt<<endl;
    }
    else{
        cnt+=(x/5)*5;
        cout<<cnt<<endl;
    }
	return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  if ((a + b) % 2 == 0) cout << (a + b) / 2 << endl;
  else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> s(H, vector<char>(W));
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> s.at(i).at(j);
        }
    }
    vector<int> dx = {1, 0, -1, 0};
    vector<int> dy = {0, 1, 0, -1};
    
    string ans = "Yes";
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if(s.at(i).at(j)=='#') {
                bool ok = false;
                for(int k = 0; k < 4; k++) {
                    int y = i+dy.at(k);
                    int x = j+dx.at(k);
                    if(y<0||y>=H||x<0||x>=W) continue;
                    if(s.at(y).at(x)=='#') ok = true;
                }
                if(!ok) ans = "No";
            }
        }
    }
    
    cout << ans << endl;
}


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

int main(){
  std::string a, b;
  std::cin >> a;
  std::cin >> b;
  int flag,n = a.length(), m = b.length();
  if(n != m){
    if(n > m)
      std::cout << "GREATER" << std::endl;
    else
      std::cout << "LESS" << std::endl;
  }
  else{
    flag = 1;
    int i;
    for(i = 0; i < n; i++){
      if(a[i] == b[i])
        continue;
      else if(a[i] > b[i]){
        std::cout << "GREATER" << std::endl;
        break;
      }
      else{
        std::cout << "LESS" << std::endl;
        break;
      }
    }
    if(i == n)
      std::cout << "EQUAL" << std::endl;
  }
  return 0;
}

      

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    S=input()
    ans=0

    for p in range(1000):
        p=str(p).zfill(3)
        now=0
        for i,d in enumerate(p):
            while(now<n and S[now]!=d):
                now+=1
            if(i<=1):
                now+=1
        ans+=(now<n)
    print(ans)
resolve()

Measured memory_bytes: 40560
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int cx,cy,ch;
    vector<int> x(n),y(n),h(n);
    for(int i=0; i<n; i++){
        cin >> x[i] >> y[i] >> h[i];
    }
    for(cx=0; cx<=100; cx++){
        for(cy=0; cy<=100; cy++){
            ch=0;
            for(int i=0; i<n; i++){
                if(h[i]>0&&ch<=0)ch=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
                else continue;
            }
            for(int i=0; i<n; i++){
                if(h[i]!=max(ch-abs(x[i]-cx)-abs(y[i]-cy),0))break;
                if(i==n-1){
                    cout << cx << " " << cy << " " << ch << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
require'prime'
h={};2.step(36){|i|h[i]=i.prime_division}
while(l=gets.chomp)!="0 0"
    l=l.split
    n=l[0].to_i;m=l[1].to_i(n)
    p h[n].map{|a,b|z=m;r=0;r+=(z/=a) while z>0;r/b}.min
end

Measured memory_bytes: 6256
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;
using ll = long long int;
using pii = pair<int,int>;
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


ll N,M,Q;
vector<pii> LR,Query;
// vector<pair<int,pii> > Query;
vector<vector<int> > cal;
void input(){
  #ifdef __LOCAL
    fs::path p = __FILE__;
    fs::path input,output;
    input = output = p.parent_path();
    input += string("/input/") + string(p.stem()) + string(".txt");
    output += string("/output/") + string(p.stem()) + string(".txt");
    freopen(input.c_str(), "r", stdin);
    freopen(output.c_str(), "w", stdout);
  #endif
  cin >> N >> M >> Q;
  cal.assign(N,vector<int>(N,0));
  for (int i = 0; i < M; i++)
  {
    int l,r ; cin >> l >> r;
    l--,r--;
    cal[l][r]++;
    LR.emplace_back(l,r);
  }
  for (int i = 0; i < Q; i++)
  {
    int p,q; cin >> p >> q;
    p--,q--;
    Query.emplace_back(p,q);
    // Query.emplace_back(p,make_pair(q,i));
  }
}
 
int solve(){
  vector<vector<int>> dp(N,vector<int>(N,0));
  DBG(cal)
  for (int i = 0; i < N; i++)
  {
    dp[i][i] = cal[i][i];
  }
  // k..区間の幅
  for (int k = 1; k < N; k++)
  {
    for (int l = 0; l < N; l++)
    {
      int r=l+k;
      if(r>=N) continue;
      dp[l][r] = dp[l][r-1]+dp[l+1][r]-dp[l+1][r-1]+cal[l][r];
    }
  }
  for (int i = 0; i < Q; i++)
  {
    cout << dp[Query[i].first][Query[i].second] << "\n";
  }
  DBG(dp)
  return 0;
}

int main()
{
  input();
  solve();
  return 0;
}


Measured memory_bytes: 5232
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;

int main() {
	int i, j, k;
	int n;
	vector<string>w;

	cin >> n;

	for (i = 0; i < n; i++) {
		string st;
		cin >> st;

		w.push_back(st);
	}
	
	bool flag = false;

	for (i = 0; i < n; i++) {
		string st = w[i];
		for (j = 0; j < n; j++) {
			if (i == j)continue;
			if (w[i] == w[j]) {
				flag = true;
				break;
			}
		}
	}

	if (flag == true) {
		cout << "No" << endl;
		getchar();
		getchar();
		return 0;
	}

	for (i = 0; i < n-1; i++) {
		char ch = w[i][w[i].length() - 1];

		if (i < n - 1 && w[i + 1][0] == ch) {

		}
		else {
			cout << "No" << endl;
			getchar();
			getchar();
			return 0;
		}

	}

	cout << "Yes" << endl;


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

N = int(input().split()[0])
xyh_list = []
not_zero_h_list = []

for _ in range(N):
    x, y, h = list(map(int, input().split()))
    xyh_list.append((x, y, h))
    if h != 0:
        not_zero_h_list.append((x, y, h))

# 高さ0の情報は除く
target_x, target_y, target_h = not_zero_h_list[0]

for cx in range(0, 101):
    for cy in range(0, 101):
        # cx, cy = 2, 2
        H_list = []
        # 基準
        H = target_h + abs(target_x - cx) + abs(target_y - cy)
        H = max(0, H)
        is_ok = True

        # 他の座標の結果と一致するかどうか確認する
        for x, y, h in xyh_list:  # ここが問題
            if h == 0:
                if (H - abs(x - cx) - abs(y - cy)) <= 0:
                    continue
                else:
                    # 一致しない
                    is_ok = False
                    break
            else:
                HH = h + abs(x - cx) + abs(y - cy)
                HH = max(0, HH)
                if HH != H:
                    # 一致しない
                    is_ok = False
                    break
        if is_ok:
            break

    if is_ok:
        break
ans = "{} {} {}".format(cx, cy, H)
print(ans)


Measured memory_bytes: 3064
S=raw_input()
A=[]
Ans=0
for i in range(len(S)):
    if len(A)>0:
        if A[-1]!=S[i]:
            A.pop()
            Ans+=2
        else:
            A.append(S[i])
    else:
        A.append(S[i])

print Ans

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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	int n; cin >> n;
	vi v(n * 3);
	rep(i, 0, n * 3) cin >> v[i];
	sort(all(v));
	reverse(all(v));
	ll ans = 0;
	for (int i = 1, j = 0; j < n; j++, i += 2) ans += v[i];
	cout << ans << endl;
}


Measured memory_bytes: 1408
def rtnIdx(bg, num):
    for i in range(len(bg)):
        for j in range(len(bg[0])):
            if bg[i][j] == num:
                return i, j
    return -1, -1


def checkBingo(bg, lis):
    isBingo = [[False for i in range(3)] for j in range(3)]
    for num in lis:
        i, j = rtnIdx(bg, num)
        if i != -1:
            isBingo[i][j] = True

    flag = False

    # check column/row
    for i in range(3):
        if isBingo[i][0] is True and isBingo[i][1] is True and isBingo[i][2] is True:
            flag = True
        if isBingo[0][i] is True and isBingo[1][i] is True and isBingo[2][i] is True:
            flag = True

    # check diagonals
    if isBingo[0][0] is True and isBingo[1][1] is True and isBingo[2][2] is True:
        flag = True

    if isBingo[0][2] is True and isBingo[1][1] is True and isBingo[2][0] is True:
        flag = True

    return flag


bingo = []

for _ in range(3):
    array = list(map(int, input().split()))
    bingo.append(array)

n = int(input())
lis = []
for _ in range(n):
    lis.append(int(input()))

if checkBingo(bingo, lis):
    print("Yes")
else:
    print("No")

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

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> s(M),c(M);
    vector<int> A(N,-1);
    rep(i,M){
        cin >> s[i] >> c[i];
    }
    int ans = -1;
    bool can = true;
    rep(i,M){
        if(s[i] == 1 && c[i] == 0 && N != 1){
            ans = -1;
            can = false;
            break;
        }

        if(A[s[i]-1] == -1 || A[s[i]-1] == c[i]){
            A[s[i]-1] = c[i];
        }else{
            ans = -1;
            can = false;
            break;
        }
    }
    
    if(!can){
        cout << ans << endl;
    }else{
        rep(i,N){
            if(N == 1 && M == 0 && A[i] == -1) A[i] = 0;
            if(i == 0 && A[i] == -1) A[i] = 1;
            if(A[i] == -1){
                A[i] = 0;
            }
        }
        rep(i,N){
            cout << A[i];
        }
        cout << endl;
    }

}  

Measured memory_bytes: 256
import itertools
 
def resolve():
    N, M = map(int, input().split())
    a_list = []
    b_list = []
    h_list = list(map(int, input().split()))

    for i in range(M):
        a, b = map(int, input().split())
        a_list.append(a)
        b_list.append(b)

    not_good_oka_list = []

    for i in range(M):
        if h_list[a_list[i]-1] == h_list[b_list[i]-1]:
            not_good_oka_list.append(a_list[i]-1)
            not_good_oka_list.append(b_list[i]-1)
        elif h_list[a_list[i]-1] < h_list[b_list[i]-1]:
            not_good_oka_list.append(a_list[i]-1)
        else:
            not_good_oka_list.append(b_list[i]-1)

    print(N - len(set(not_good_oka_list)))

if __name__ == "__main__":
    resolve()

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

using namespace std;

int main()
{
    int n,ara[105],sum=0,bsum=0,ans=INT_MAX;

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>ara[i];
        sum+=ara[i];
    }
    for(int i=0;i<n-1;i++){
        bsum+=ara[i];
        sum-=ara[i];
        ans=min(ans,abs(sum-bsum));
    }
    cout <<ans<<endl;

    return 0;
}


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

namespace multiset
{

class multiset
{
  private:
    std::vector<int> tree;
    int MSB;

    void add(int i, int x)
    {
        for (; i < tree.size(); i += i & -i) {
            tree[i] += x;
        }
    }

    int sum(int i)
    {
        int res = 0;
        for (; i > 0; i -= i & -i) {
            res += tree[i];
        }
        return res;
    }

    int bisect(int w)
    {
        int i = 0;
        for (int k = MSB; k > 0; k /= 2) {
            if (i + k < tree.size() && tree[i + k] < w) {
                w -= tree[i + k];
                i += k;
            }
        }
        return i + 1;
    }

    int get_MSB(int N)
    {
        int i = 1;
        while (i < N) {
            i *= 2;
        }
        return i / 2;
    }

  public:
    multiset(int N) : tree(N + 1), MSB(get_MSB(N)) {}
    void insert(int x) { add(x, 1); }
    void erase(int x) { add(x, -1); }
    int lower_bound(int x)
    {
        int s = sum(x);
        return (s == 0) ? 0 : bisect(s);
    }

    size_t size() { return sum(tree.size() - 1); }
};

} // namespace multiset

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

    std::vector<int> A(N);
    for (auto &&a : A) {
        std::cin >> a;
    }

    std::vector<int> B = A;
    std::sort(begin(B), end(B));
    B.erase(std::unique(begin(B), end(B)), end(B));

    std::transform(begin(A), end(A), begin(A), [&](int val) -> int {
        return std::lower_bound(begin(B), end(B), val) - begin(B) + 1;
    });

    multiset::multiset ms(B.size());
    for (auto a : A) {
        auto i = ms.lower_bound(a - 1);
        if (i != 0) {
            ms.erase(i);
        }
        ms.insert(a);
    }

    std::cout << ms.size() << '\n';
}


Measured memory_bytes: 1408
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;

int main(){
  int n,m,q,qi,pi,l,r,cnt;
  int g[501][501]={};
  vector<pair<int,int>> lr;
  scanf("%d %d %d",&n,&m,&q);
  for(int i=0;i<m;i++){
    scanf("%d %d",&l,&r);
    lr.push_back(make_pair(l,r));
  }
  sort(lr.begin(),lr.end());
  for(int i=0;i<m;i++)
    for(int j=lr[i].second;j<=n;j++)
      g[lr[i].first][j]++;
  for(int i=0;i<q;i++){
    cnt=0;
    scanf("%d %d",&qi,&pi);
    for(int j=qi;j<=pi;j++){
      //printf("%d\n",g[j][pi]);
      cnt+=g[j][pi];
    }
    printf("%d\n",cnt);
  }
}

Measured memory_bytes: 3568
'use strict'

const main = arg => {
 const input = arg.trim().split("\n")[0].split(" ").map(num => parseInt(num, 10));
 const dividerNum = input[2];
 const nums = [...Array(input[1] + 1).keys()].slice(input[0]);
 const validNums = nums.filter(num => dividerNum % num === 0);

 console.log(validNums.length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));




Measured memory_bytes: 17140
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  ll N,M,K;
  cin >> N >> M >> K;
  vector<vector <ll> >dp1(N+1,vector<ll>(M+1));
  dp1[0][0] = 0;
  for(int i=1; i < N+1; i++)
    dp1[i][0] = i*M;
  for(int j=1; j < M+1; j++)
    dp1[0][j] = j*N;
  bool can = false;
  for(int i=1; i < N+1; i++){
    for(int j=1; j < M+1; j++){
      dp1[i][j] = dp1[i][j-1] + (N-i) - i;
    }
  }
  for(int i=0; i < N+1; i++)
    for(int j=0; j < M+1; j++)
      if(dp1[i][j] == K)
	can = true;
  if (can)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 8064
N,M,X=list(map(int,input().split()))
A=list(map(int,input().split()))
#print(A)
A.append(X)
#print(A)
C=sorted(A)
#print(C)

search=C.index(X)
length=len(C)
#print([search,length])
print(min(search,length-search-1))


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

int main(void) 
{
  int N;
  cin >> N;
  string S, T;

  cin >> S >> T;

  for (int i = 0; i < N; i++)
  {
    cout << S[i] << T[i];
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

bool p[60001];

int main(){
	int n,s,l;
	p[0]=p[1]=1;
	reps(i,2,60000)if(!p[i])for(int j=i+i;j<=60000;j+=i)p[j]=1;
	while(~scanf("%d",&n)){
		for(int i=n-1;i>1;i--)if(!p[i]){s=i;break;}
		for(int i=n+1;i<60000;i++)if(!p[i]){l=i;break;}
		printf("%d %d\n",s,l);
	}
	return 0;
}

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

int main() {
    int A[9], N;
    bool X[9] = {false};
    for(int i = 0; i < 9; ++i) cin >> A[i];
    cin >> N;
    
    int b[N];
    for(int i = 0; i < N; ++i) cin >> b[i];

    for(int i = 0; i < 9; ++i){
        for(int j = 0; j < N; ++j){
            if(A[i] == b[j]) X[i] = true;
        }
    }
    if(X[0]&&X[1]&&X[2] ||X[3]&&X[4]&&X[5]
     ||X[6]&&X[7]&&X[8] ||X[0]&&X[3]&&X[6]
     ||X[1]&&X[4]&&X[7] ||X[2]&&X[5]&&X[8]
     ||X[0]&&X[4]&&X[8]||X[2]&&X[4]&&X[6])
      
      cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() 
{
    int i,a[10]={0},in;
    
    for(i=0;i<4;i++)
    { cin>>in;
      a[in]++;
    }
    if(a[1]==1&&a[9]==1&&a[7]==1&&a[4]==1)
    cout<<"YES";
    else
    cout<<"NO";
	
	return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)
cnt = 0
if n % 2 == 0:
    for i in range(n // 2):
        if s[i] != s[n - 1 - i]:
            cnt += 1
else:
    for i in range(n // 2):
        if s[i] != s[n - 1 - i]:
            cnt += 1
print(cnt)


Measured memory_bytes: 38384
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
using namespace std;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    string s;
    cin >> n >> k >> s;
    k--;

    if (s[k] == 'A')
        s[k] = 'a';
    if (s[k] == 'B')
        s[k] = 'b';
    if (s[k] == 'C')
        s[k] = 'c';

    std::cout << s << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * https://abc054.contest.atcoder.jp/tasks/abc054_d
 */
public class Main {

	static Drag[] drags;
	static int[][][] dp;
	static int SIZE = 400;
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Ma = sc.nextInt();
		int Mb = sc.nextInt();
		drags = new Drag[N];
		for(int i=0; i<N; i++){
			drags[i] = new Drag(
				Integer.parseInt(sc.next()),
				Integer.parseInt(sc.next()),
				Integer.parseInt(sc.next())
			);
		}
		sc.close();
		dp = new int[drags.length][SIZE+1][SIZE+1];
		for(int i=0; i<N; i++){
			for(int a=0; a<=SIZE; a++){
				for(int b=0; b<=SIZE; b++){
					dp[i][a][b] = -1;
				}
			}
		}
		
		int ans = Integer.MAX_VALUE;
		for(int a=Ma; a<=400; a+=Ma){
			int b = (a/Ma)*Mb;
			if(b>400) break;
			ans = Math.min(ans, dfs(0,a,b));
		}
		System.out.println(ans>=Integer.MAX_VALUE/2 ? -1 : ans);
	}

	 
	static int dfs(int n, int a, int b) {
		if(a==0 && b==0){
			return 0;
		}else if(n==drags.length) {
			return Integer.MAX_VALUE/2;
		}else if (dp[n][a][b]>=0) {
			return dp[n][a][b];
		}
		int res;
		Drag d = drags[n];
		if(a-d.a<0 || b-d.b<0) {
			res = dfs(n+1, a, b);
		}else{
			res = Math.min(dfs(n+1, a, b), dfs(n+1, a-d.a, b-d.b)+d.c);
		}
		dp[n][a][b] = res;
		return res;
	}
	
	static String getKey(int n, int a, int b){
		return n+"."+a+"."+b;
	}
	
	static class Drag{
		int a;
		int b;
		int c;
		Drag(int a, int b, int c){
			this.a = a;
			this.b = b;
			this.c = c;
		}
	}

}


Measured memory_bytes: 51924
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]    
      
def program():
  N, M = map(int, input().split())
  uf = UnionFind(N)
  for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1,b-1)
  
  ans = max([uf.size(i) for i in range(N)])
  return ans

print(program())

Measured memory_bytes: 22112
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main() {FIN
    
    int l, r, d, m = 0;
    cin >> l >> r >> d;
    for (; l <= r; l++) {
		if (l % d == 0) m++;
	}
	cout << m << "\n";
    
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		System.out.printf("%d %d %f\n",x/a,x%a,(double)x/a);
		sc.close();
	}
}


Measured memory_bytes: 26432
package main

import "fmt"

func main() {
	var N int
	var S string
	fmt.Scan(&N)
	fmt.Scan(&S)
	max, x := 0, 0
	for i := 0; i < N; i++ {
		if 'I' == rune(S[i]) {
			x++
		} else {
			x--
		}
		if x > max {
			max = x
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
int W, H, x, y;
string op;
int dir = 1;

void forDir(int len){
  if(dir == 1) y += len;
  if(dir == 2) x += len;
  if(dir == 3) y -= len;
  if(dir == 4) x -= len;

  if(x >= W) x = W;
  if(y >= H) y = H;
  if(x <= 1) x = 1;
  if(y <= 1) y = 1;
}

void backDir(int len){
  if(dir == 1) y -= len;
  if(dir == 2) x -= len;
  if(dir == 3) y += len;
  if(dir == 4) x += len;

  if(x >= W) x = W;
  if(y >= H) y = H;
  if(x <= 1) x = 1;
  if(y <= 1) y = 1;
}

int main(){
  while(cin >> W >> H){
    if(W == 0 && H == 0) break;
    
    x = 1, y = 1;
    dir = 1;
    
    while(cin >> op){
      int move = 0;
      if(op == "STOP") break;
      
      else if(op == "FORWARD"){
	cin >> move;
	forDir(move);
      }
      
      else if(op == "BACKWARD"){
	cin >> move;
	backDir(move);
      }
      
      else if(op == "RIGHT"){
	dir++;
	if(dir == 5) dir = 1;
      }
      
      else if(op == "LEFT"){
	dir--;
	if(dir == 0) dir = 4;
      }
      //printf("dir = %d, x = %d, y = %d\n", dir, x, y);
    }
    cout << x << ' ' << y << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <bitset>

#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define ull unsigned long long
#define pll pair < ll, ll >
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int inf = (1ll << 30) - 1;
const int maxn = (int) 1e5 + 10;

using namespace std;
bitset<2000*2000+2000> dp;
int n;
int a[2020];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a + n);
	int sum = 0;
	for(int i = 0; i < n; i++){
		sum += a[i];
	}
	dp[0] = 1;
	for(int i = 0; i < n; i++){
		dp |= (dp<<a[i]);
	}
	int cur = (sum + 1)/2;
	for(int i = cur; i <= sum; i++){
		if(dp[i]){
			cout << i << endl;
			return;
		}
	}
	
	
}

int main () {
	#ifdef LOCAL
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
	#endif
    int t=1;
    //scanf("%d", &t);
    for(int i=1; i <= t; i++){
      //printf("Case #%d\n", i);
      solve();
    }

    return 0;
}



Measured memory_bytes: 1664
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny")
    cout << "Cloudy" << endl;
  else if (s == "Cloudy")
    cout << "Rainy" << endl;
  else if (s == "Rainy")
    cout << "Sunny" << endl;

  return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
s = input()
ans = "Yes"
for i in range(a):
    if s[i] == "-":
        ans = "No"
if s[a] != "-":
    ans = "No"
for i in range(a + 1, a + b + 1):
    if s[i] == "-":
        ans = "No"
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
//#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using intpair = pair<int, int>;
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

signed main(){
    int k; cin >> k;
    string s; cin >> s;
    
    if(s.length() > k) {
        cout << s.substr(0,k) << "..." << endl;
    }else{
        cout << s << endl;
    }
}

Measured memory_bytes: 3644