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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

vector<int> ZAlgorithm(string s) {
    vector<int> v(s.length(), 0);
    v[0] = s.length();
    int i = 1, j = 0;
    while (i < s.length()) {
        // 位置 i からと先頭からの共通接頭辞の長さをカウント
        while (i + j < s.length() && s[j] == s[i + j]) { ++j; }
        v[i] = j;
        if (j == 0) {
            ++i;
            continue;
        }
        // i より左側に既に出現した同じパターンの値をコピー
        int k = 1;
        while (i + k < s.length() && k + v[k] < j) {
            v[i + k] = v[k];
            ++k;
        }
        i += k;
        j -= k;
    }
    return v;
}

int N;
string S;

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

    cin >> N >> S;

    ll ans = 0;

    for(int i = 0; i < N; ++i) {
        string s = S.substr(i, S.length() - i);
        auto v = ZAlgorithm(s);
        for(int j = 1; j < s.length(); ++j) {
            ans = max(ans, min(v[j], j));
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 384
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    LL A,B,N;
    R(N,A,B);
    W(N/(A+B)*A+min(A,N%(A+B)));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long int
#define MOD 1000000007

int main() {
    string s;
    cin>>s;
    int a[26]={0},flag=0;
    for(int i=0;i<s.length();i++)
        a[s[i]-'a']++;
    for(int i=0;i<26;i++)
        if(a[i]%2!=0) flag=1;
    flag==1?cout<<"No\n":cout<<"Yes\n";
	// your code goes here
	return 0;
}


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

#define ll long long

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

	int n;
	cin>>n;
	pair<ll,ll> a[n];
	ll x,y;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		a[i]={y,x};
	}
	sort(a,a+n);
	ll tot=0;
	int flag=1;
	for(int i=0;i<n;i++){
		tot+=a[i].second;
		if(tot>a[i].first){
			flag=0;
			break;
		}
	}
	if(flag) cout<<"Yes\n";
	else cout<<"No\n";

	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main(void)
{
  long long a, b, c ,d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  long long product[4];
  product[0] = a * c;
  product[1] = a * d;
  product[2] = b * c;
  product[3] = b * d;
  long long max = -1000000000000000000;
  for (int i = 0; i < 4; i++)
  {
    if (product[i] > max)
      max = product[i];
  }
  printf("%lld\n", max);
  return 0;
}


Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int l = sc.nextInt();
		int sum = 0;

		if (l > 0) {
			for (int i = 2; i <= n; i++) {
				sum += l + i - 1;
			}
		} else if (l < (1 - n)) {

			for (int i = 1; i <= n - 1; i++) {
				sum += l + i - 1;
			}
		} else {
			for (int i = 1; i <= n; i++) {
				sum += l + i - 1;
			}
		}

		System.out.println(sum);

	}
}


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

typedef long long ll;

const ll mod = 1e9+7;
const int MAX = 100005;
const int N = 2;

ll dp[N][MAX];

int a[105];

ll sum(ll a ,ll b){
    return (a+b)%mod;
}

ll sub(ll a, ll b){
    return (a-b+mod)%mod;
}

int main(){
    int n, k;
    cin>>n>>k;
    for(int i = 1; i<=n; ++i){
        cin>>a[i];
    }

    int acum = 0;
    for(int i = 0; i<N; ++i){
        dp[i][0] = 1;
    }

    int ii;
    for(int i = 1; i<=n; ++i){
        ii = i&1;
        acum+=a[i];
        for(int j = 1; j<= acum && j<= k; ++j){
            dp[ii][j] = sum(dp[ii^1][j], dp[ii][j-1]);
            if(j>a[i]){
                dp[ii][j] = sub(dp[ii][j], dp[ii^1][j-a[i]-1]);
            }
        }
    }
    cout<<dp[n&1][k]<<"\n";
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
#define MOD 998244353

// 繰り返し二乗法
long long bipow(long long n, int m) {
    if (m == 0) return 1;
    if (m % 2 == 0) {
        n = (n * n) % MOD;
        return bipow(n, m / 2) % MOD;
    } else
        return (n * bipow(n, m - 1)) % MOD;
}

// fact_num[i] = i! % MOD
// fact_denpow[i] = (i**(MOD-2)) % MOD
// fact_den[i] = fact_denpow[i]! % MOD
// nCm = fact_num[n] * fact_den[m] * fact_den[n-m]
// で計算できる（MODを適切に取る）
// O(NlogN)
void set_table(int N, vector<long long> &fact_num, vector<long long> &fact_den){
    fact_num.resize(N+1, 0);
    fact_den.resize(N+1, 0);
    vector<long long> fact_denpow(N+1, 0);

    fact_num[0] = 1;
    for(int i=1; i<=N; i++) fact_num[i] = (fact_num[i-1] * i) % MOD;

    for(int i=0; i<=N; i++) fact_denpow[i] = bipow(i, MOD-2);
    fact_den[0] = 1;
    for(int i=1; i<=N; i++) fact_den[i] = (fact_den[i-1] * fact_denpow[i]) % MOD;
}

// mCn
long long comb(const vector<long long> &fact_num, const vector<long long> &fact_den, int m, int n){
    return ((fact_num[m] * fact_den[n]) % MOD * fact_den[m-n]) % MOD;
}

int main(){
    long long N, A, B, K;
    cin >> N >> A >> B >> K;

    vector<long long> fact_num, fact_den;
    set_table(N, fact_num, fact_den);

    long long ans = 0;
    for(int x=0; x<=N; x++){
        long long rem = K - A * x;
        if(rem < 0 || rem % B != 0) continue;
        long long y = rem / B;
        if(y > N) continue;
        long long tmpA = comb(fact_num, fact_den, N, x);
        long long tmpB = comb(fact_num, fact_den, N, y);
        ans += (tmpA * tmpB) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7296
input = gets.chomp.to_i
count = 1                   # 1番目から始まる
num = input

while num != 1 && num != 2 && num !=4
    # print "num",num," count",count,"\n"

    if num.even?            # 奇数の場合
        num = num / 2    
    else
        num = num * 3 + 1       # 偶数の場合
    end

    count += 1
end

count += 3                  # 1の次の値を出力するため
#print "答え num",num," count",count
p count


Measured memory_bytes: 3836
import numpy as np
N, M = list(map(int, input().split()))
can = []
for i in range(1, int(np.sqrt(M)) + 1):
	if M % i == 0:
		if N <= M // i:
			can.append(i)
		if N <= i:
			can.append(M // i)

if N == 1:
	print(M)
else:
	print(max(can))



Measured memory_bytes: 18852
#!/usr/bin/env python3
#ABC113 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))


n,m = LI()
lst = [[] for _ in range(n)]
py = [LI() for _ in range(m)]
for i in range(m):
    p,y = py[i]
    lst[p-1].append(y)
for i in lst:
    i.sort()
for i in range(m):
    p,y = py[i]
    s1 = '00000' + str(p)
    s2 = '00000' + str(bisect.bisect_right(lst[p-1],y))
    ans = s1[-6:] + s2[-6:]
    print(ans)


Measured memory_bytes: 72240
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

ll tall[100010];
bool ans[100010];

int main(void){
    ll n;
    ll m;
    cin >> n >> m;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        tall[i+1] = tmp;
    }

    REP(i,m){
        ll tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        if(tall[tmp1] == tall[tmp2]){
            ans[tmp1] = ans[tmp2] = true;
        }else if(tall[tmp1] > tall[tmp2]){
            ans[tmp2] = true;
        }else if(tall[tmp1] < tall[tmp2]){
            ans[tmp1] = true;
        }
    }

    ll ansnow=0;

    for(ll i=1; i<=n; i++){
        if(ans[i] == false){
            ansnow++;
        }
    }

    cout << ansnow << endl;

    return 0;
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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(void){
  char x; cin >> x;
  if(x == 'A' ||x == 'B'|| x == 'C'|| x == 'D'|| x == 'E'|| x == 'F'|| x == 'G'|| x == 'H'|| x == 'I'|| x == 'J'|| x == 'K'|| x == 'L'|| x == 'M'|| x == 'N'|| x == 'O'|| x == 'P'|| x == 'Q'|| x == 'R'|| x == 'S'|| x == 'T'|| x == 'U'|| x == 'V'|| x == 'W'|| x == 'X'|| x == 'Y'|| x == 'Z'){
    cout << "A" << endl;
  }
  else cout << "a"<< endl;
  return 0;
}


Measured memory_bytes: 3632
/* ファイル名：ITP1_10_A.c	*/
/* 内容：２点 P1(x1, y1), P2(x2, y2) の距離を求める	*/

/* include	*/
#include <stdio.h>
#include <math.h>
/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:２点 P1(x1, y1), P2(x2, y2) の距離を求める	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	double x1;	/* P1のx座標	*/
	double y1;	/* P1のy座標	*/
	double x2;	/* P2のx座標	*/
	double y2;	/* P2のy座標	*/
	
	/* 処理・出力	*/
	double x_dif;	/* 2点のx座標の差	*/
	double y_dif;	/* 2点のy座標の差	*/
	double r;		/* 2点の距離		*/
	
	
	/* 2点間の座標を取得する(P1のx座標、P1のy座標、P2のx座標、P2のy座標の順)	*/
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	
	/* x座標の差を出す	*/
	x_dif = fabs(x1 - x2);
	
	/* y座標の差を出す	*/
	y_dif = fabs(y1 - y2);
	
	/* 2点の距離を出す	*/
	r = sqrt(pow(x_dif,2) + pow(y_dif,2));
	
	/* 2点の距離を出力する	*/
	printf("%lf\n",r);
	
	return 0;
}



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

int main(){
    int N,M;
    cin >> N >> M;
    
    //cout << "A" << endl;
    
    vector<int> H(N);
    for ( int i = 0; i < N; ++i){
        cin >> H.at(i);
    }
    
    vector<int> A(M), B(M);
    for ( int i = 0; i < M; ++i){
        int a,b;
        cin >> a >> b;
        A.at(i) = a - 1;
        B.at(i) = b - 1;
        //cin >> A.at(i) >> B.at(i);
    }
    //cout << "A" << endl;
    
    vector<vector<int>> R;
    R.resize(N);
    for ( int i = 0; i < M; ++i){
        R.at(A.at(i)).push_back(B.at(i));
        R.at(B.at(i)).push_back(A.at(i));
    }
    //cout << "A" << endl;
    
    
    int ans = 0;
    for ( int i = 0; i < N; ++i){
        int ans_sub = 1;
        for ( int j = 0; j < R.at(i).size(); ++j){
            if ( H.at(i) <= H.at(R.at(i).at(j))){
                ans_sub = 0;
            }
        }
        ans += ans_sub;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 9596
n = int(input())
cnt = [0] * (n + 1)

for i in range(1, n + 1):
    for j in range(1, n // i + 1):
        cnt[i * j] += 1

ans = 0
for i in range(1, n + 1):
    ans += cnt[i] * i

print(ans)

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

int main()
{
  string T = "CODEFESTIVAL2016";
  string S; cin >> S;
  int  cnt = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
const val mod = (1e9 + 7).toInt()
fun main() {
    val s = readLine()!!.toInt()

    val ans = Array(2001) { 0 }

    ans[0] = 1
    for (x in 1..s) {
        for (y in 3..x) ans[x] = (ans[x] + ans[x - y]) % mod
    }
    println(ans[s])
}

Measured memory_bytes: 51036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i <b; i++)
using pii = pair<int,int>;
#define all(a) a.begin(), a.end()

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

const int MOD = 1e9 + 7;

map<long long, int> prime_factor(long long n){
    map< long long, int> ret;

    for(long long i = 2; i * i <= n; i++){
        while(n % i == 0){
            ret[i]++;
            n /= i;
        }
    }

    if( n != 1) ret[n] = 1;
    return ret;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    int N; cin >> N;
    vector<int> A(N);
    map<ll,int> mp;
    rep(i, 0, N) cin >> A[i];

    //ll lis = A[0];
    rep(i, 0, N){
        map<ll,int> tmp = prime_factor(A[i]);
        for(auto e: tmp){
            if(mp[e.first] < e.second) mp[e.first] = e.second;
        }
    }
    ll lis = 1, ans = 0;
    for(auto e: mp){
        lis *= modpow(e.first, e.second, MOD);
        lis %= MOD;
    }

    rep(i, 0, N){
        ans += lis * modinv(A[i], MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 896
s = input()
n = len(s)
ans = [0] * n

cnt = 0

for i in range(n-1):
    if s[i] == "R":
        cnt += 1
        if s[i+1] == "L":
            if cnt % 2 == 0:
                ans[i], ans[i+1] = cnt//2, cnt//2
            else:
                ans[i], ans[i+1] = cnt//2 + 1, cnt//2

    else:
        cnt = 0

cnt = 0

for i in range(n-1, 0, -1):
    if s[i] == "L":
        cnt += 1
        if s[i-1] == "R":
            if cnt % 2 == 0:
                ans[i] += cnt//2
                ans[i-1] += cnt//2
            else:
                ans[i] += cnt//2 + 1
                ans[i-1] += cnt//2
    else:
        cnt = 0

print(*ans)

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

int main(){
    string S;
    cin >> S;
    int cnt=0;
    for(int i=1;i<S.size();i++){
        if(S[i-1]!=S[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
}


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

int main(){
  string S;
  cin >> S;
  string T = "ATCG";
  int ans = 0;
  for(int i = 0; i < S.size(); i++){
    int now = 0;
    for(int j = i; j < S.size();j++){
      bool isATCG = false;
      for(int k = 0; k < T.size(); k++){
        if(S[j] == T[k]){
          isATCG = true;
        }
      }
      if(isATCG){
        now++;
      }
      else{
        break;
      }
    }
    ans = max(ans,now);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

int data_[210][2] = { -2 };

void input(void) {

	return;
}


int main(void) {

	int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
	double x = 0;
	double y = 0;

	while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF) {
		y = (double)(c * d - a * f) / (double)(b * d - a * e);
		x = (double)(c - b * y) / (double)a;
		printf("%.3f %.3f\n", x, y);
	}



	return 0;
}

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

const long long INF = 1LL<<61;
long long N, K;
vector<long long> A;

long long solve() {
    sort(A.begin(), A.end());
    long long left = -INF, right = INF;
    while (right - left > 1) {
        long long x = (left + right) / 2;
        long long S = 0, T = 0;
        for (int i = 0; i < N; ++i) {
            if (A[i] > 0) {
                int l2 = -1, r2 = N;
                while (r2 - l2 > 1) {
                    int m = (l2 + r2) / 2;
                    if (A[i] * A[m] <= x) l2 = m;
                    else r2 = m;
                }
                S += r2;
            }
            else if (A[i] < 0) {
                int l2 = -1, r2 = N;
                while (r2 - l2 > 1) {
                    int m = (l2 + r2) / 2;
                    if (A[i] * A[m] <= x) r2 = m;
                    else l2 = m;
                }
                S += N - r2;
            }
            else if (x >= 0) S += N;
            if (A[i] * A[i] <= x) ++T;
        }
        long long num = (S - T) / 2;
        if (num >= K) right = x;
        else left = x;
    }
    return right;
}

int main() {
    cin >> N >> K;
    A.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    cout << solve() << endl;
}


Measured memory_bytes: 4816
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

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

    // char N[100000];
    int zero_num = 0;
    int one_num = 0;
    char c;
    // strcpy(N, str.c_str());
    for(int i=0; i<str.length(); i++){
        c = str[i];
        
        if((c - '0') == 0){
            zero_num += 1;
        }else{
            one_num += 1;
        }
    }

    int ans;
    if(zero_num < one_num){
        ans = str.length() - (one_num - zero_num);
    }else{
        ans = str.length() - (zero_num - one_num);
    }

    cout << ans << endl;

    return 0;
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<int> c(26, 0);
  rep(i, S.size()) {
    int n = S[i] - 'a';
    c[n]++;
  }

  rep(i, c.size()) {
    if (c[i] == 0) {
      char l = 'a' + i;
      cout << l << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
A, B, C = map(int, input().split())

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
	count += 1
print(count)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi num[10];
  for(int i=0;i<n;i++){
    ll nu[3];cin>>nu[0]>>nu[1]>>nu[2];
    for(int j=0;j<BITLE(3);j++){
      ll hoge=0;
      for(int k=0;k<3;k++){
	if(BITLE(k)&j)hoge+=nu[k];
	else hoge-=nu[k];
      }
      num[j].pb(hoge);
    }
  }
  ll ans=-llINF;
  for(int i=0;i<8;i++){
    ll hoge=0;
    sort(ALL(num[i]),greater<ll>());
    for(int j=0;j<m;j++){
      hoge+=num[i][j];
    }
    ans=max(ans,hoge);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
cnt = 0
for i in range(n):
  sum = c
  L = list(map(int, input().split()))
  for k in range(m):
    sum += B[k]*L[k]
  if sum > 0:
    cnt += 1
print(cnt)

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

using namespace std;

const int MAXN = 50005;
const int MOD = 1000000007;

int n, x, y, z, cnt;
int p[10][MAXN], fin[10][MAXN], t[MAXN];
int dp[2][45][MAXN];
map <string, int> mp;
string r[MAXN];

vector <string> f (int x) {
    vector <string> res;
    if (x == 0) {
        res.push_back("");
        return res;
    }
    for (int i=0; i<x; i++) {
        vector <string> tmp = f(i);
        for (auto s : tmp) res.push_back(((char) (x - i + '0')) + s);
    }
    return res;
}

void ubaci (string s) {
    int len = s.size();
    int curr = 0;
    for (int i=0; i<len; i++) {
        int d = s[i] - '0';
        if (p[d][curr] == 0) p[d][curr] = ++cnt;
        curr = p[d][curr];
    }
    t[curr] = 1;
}

void dfs (string s, int br) {
    mp[s] = br;
    r[br] = s;
    for (int i=0; i<10; i++) {
        if (p[i][br]) dfs(s + ((char) (i + '0')), p[i][br]);
    }
}

void gen () {
    vector <string> sx = f(x), sy = f(y), sz = f(z);
    for (auto s1 : sx) {
        for (auto s2 : sy) {
            for (auto s3 : sz) {
                ubaci(s1 + s2 + s3);
            }
        }
    }
    mp[""] = 0;
    dfs("", 0);
    for (int i=0; i<=cnt; i++) {
        int len = r[i].size();
        for (int j=len; j>=0; j--) {
            string suf = r[i].substr(j);
            if (mp.find(suf) != mp.end()) {
                int ind = mp[suf];
                for (int k=0; k<10; k++) {
                    if (p[k][ind] != 0) fin[k][i] = p[k][ind];
                }
            }
        }
    }
}

int f (int flg, int pos, int br) {
    //for (int i=0; i<pos; i++) cout << " ";
    //cout << "bla " << flg << " " << pos << " " << br << endl;
    if (dp[flg][pos][br] != -1) return dp[flg][pos][br];
    if (pos == n) return flg;
    int res = 0;
    for (int i=0; i<10; i++) {
        res = (res + f(flg | t[fin[i][br]], pos + 1, fin[i][br])) % MOD;
    }
    return dp[flg][pos][br] = res;
}

int main () {
    memset(dp, -1, sizeof dp);
    cin >> n >> x >> y >> z;
    gen();
    cout << f(0, 0, 0);
    return 0;
}


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

using namespace std;

int main(void){
    long long n, ac, wa, tle, re;
    ac = 0;
    wa = 0;
    tle = 0;
    re = 0;
    cin >> n;

    string str[n];

    for(int i = 0; i < n; ++i){
        cin >> str[i];
        if(str[i] == "AC")++ac;
        else if(str[i] == "WA")++wa;
        else if(str[i] == "TLE")++tle;
        else if (str[i] == "RE")++re;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

Measured memory_bytes: 6724
import sys
input = sys.stdin.readline

from collections import deque

N = int(input())

graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    graph[a].append([b, a, c])
    graph[b].append([a, b, c])
distance = [-1] * (N + 1)

Q, K = map(int, input().split())
distance = [-1] * (N + 1)
distance[K] = 0
que = deque()
for i in graph[K]:
    que.append(i)

while len(que) != 0:
    for _ in range(len(que)):
        abc = que.popleft()
        if distance[abc[0]] == -1: #動き先の値がまだ決まっていないとき
            distance[abc[0]] = distance[abc[1]] + abc[2]
            for j in graph[abc[0]]:
                que.append(j)
# print (distance)

for _ in range(Q):
    x, y = map(int, input().split())
    print (distance[x] + distance[y])

Measured memory_bytes: 50080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader s = new FastReader();
        String s1=s.next();
        System.out.println(s1.replace("?","D"));
    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 45684
#include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
using namespace std;
typedef long long ll;
const int N = 200010;
int a,b,c,a1,b1,c1;
int main(){
	cin>>a>>b>>c;
	int cnt = 0;
	while(a%2==0 && b%2==0 && c%2==0 && cnt<1000){
		a1 = a>>1;
		b1 = b>>1;
		c1 = c>>1;
		a = a1+b1,b =a1+c1, c = b1+c1;
		cnt++; 
	}
	if(cnt==1000) puts("-1"); else
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Integer[] one = {1, 3, 5, 7, 8, 10, 12};
        Integer[] two = {4, 6, 9, 11};
        Integer[] three = {2};

        List<Integer> oneList = Arrays.asList(one);
        List<Integer> twoList = Arrays.asList(two);
        List<Integer> threeList = Arrays.asList(two);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if((oneList.contains(x) && oneList.contains(y)) ||
                (twoList.contains(x) && twoList.contains(y)) ||
                (threeList.contains(x) && threeList.contains(y))
                ){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }
}


Measured memory_bytes: 21712
n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))
# print(n, k, q)
# print(a)

p = []
for i in range(n):
    p.append(0)
# print(p)

for i in a:
    p[i - 1] += 1
# print(p)

for i in p:
    print('Yes') if k - (q - i) > 0 else print('No')


Measured memory_bytes: 8628
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

int N, Q;
string s;
vector<int> v{0};

void solve() {
  for (int i = 1; i < s.size(); i++) {
    if (s[i - 1] == 'A' && s[i] == 'C') {
      v.push_back(v.back() + 1);
    } else {
      v.push_back(v.back());
    }
  }

  while (Q--) {
    int l, r;
    cin >> l >> r;
    cout << v[r - 1] - v[l - 1] << endl;
  }
}

signed main() {
  cin >> N >> Q;
  cin >> s;
  solve();
  return 0;
}


Measured memory_bytes: 1908
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#define pc(...)
#endif

#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        deque<ll> Q;
        ll curr = 0;
        int k;
        cin >> k;
        for (size_t i = 1; i < 10; i++)
            Q.pb(i);
        for (size_t i = 1; i <= k; i++)
        {
            pc(Q);
            curr = Q.front();
            db(curr, i);
            Q.pop_front();
            int last = curr % 10;
            if (last != 0)
                Q.pb(curr * 10 + last - 1);
            Q.pb(curr * 10 + last);
            if (last != 9)
                Q.pb(curr * 10 + last + 1);
        }
        cout << curr << '\n';
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define xx first
#define yy second
#define D if(0)
#define cerr D cerr

using namespace std;
typedef long long ll;

template <typename T>
vector<T> read_n(ll n) {
  vector<T> ret(n);
  for(ll i = 0; i < n; i++) cin >> ret[i];
  return ret;
}

template <typename iter>
void dump(iter begin, iter end) {
  for(iter it = begin; it != end; it++) {
    if(it != begin) cout << " ";
    cout << *it;
  } cout << endl;
}

const ll top = 1e18;

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

  ll n; cin >> n;

  ll ret = 0;
  for(ll i = 2; i*i <= n; i++) {
    if(n % i == 0) {
      int next = 1;
      int acc = 0;
      while(n % i == 0) {
        n /= i;

        if(++acc >= next) {
          acc -= next;
          ret++;
          next++;
        }
      }
    }
  }

  if(n != 1) {
    ret++;
  }

  cout << ret << "\n";

  return 0;
}


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

using namespace std;

long long int knapsack(vector<int> &v, vector<int> &wt, int n, int W) {
    int maxProfit = 1e5 + 1;
    long long int inf = LONG_MAX;
    vector<vector<long long int>> dp(n + 1, vector<long long int>(maxProfit));
    for (int i = 0; i <= n; ++i)
        dp[i][0] = 0;
    for (int j = 1; j < maxProfit; ++j) {
        dp[0][j] = inf;
    }
    for (int i = 1; i <= n; ++i) {
        for (int profit = 1; profit < maxProfit; ++profit)
            if (profit >= v[i - 1] && dp[i - 1][profit - v[i - 1]] != inf)
                dp[i][profit] = min(dp[i - 1][profit], dp[i - 1][profit - v[i - 1]] + wt[i - 1]);
            else dp[i][profit] = dp[i - 1][profit];
    }
    for (int profit = maxProfit - 1; profit >= 0; --profit) {
        if (dp[n][profit] <= W) {
            return profit;
        }
    }
    return -1ll;
}

int main() {
    int n, w;
    cin >> n >> w;
    vector<int> v(n), wt(n);
    for (int i = 0; i < n; ++i) {
        cin >> wt[i] >> v[i];
    }
    cout << knapsack(v, wt, n, w);
}


Measured memory_bytes: 80256
from itertools import product
#初期入力
N = int(input())
testimony ={j:[-1 for i in range(N)] for j in range(1,N+1)}
A=[]
for i in range(1,N+1):
    a = int(input())
    A.append(a)
    for j in range(a):
        x,y = list(map(int, input().split()))
        testimony[i][x-1] =y

#各人が正直か不親切かを仮定する。仮定(Assumption)が矛盾するか、判定を全探索

assumption_correct =[]
for assumption in product([1,0], repeat=N):
    count_2=0
    for i in range(N):      #証言する人        
        if assumption[i] ==1:
            count =0 
            for j in range(N):  #証言受けた人 
                         
                if testimony[i+1][j] ==assumption[j]:
                    count +=1
            if count == A[i]:
                count_2 +=1
    if count_2 ==sum(assumption):
        assumption_correct.append(sum(assumption))
print(max(assumption_correct))

Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n;
	cin >> n;
	int sum = 0;
	int minv = 10000000;
	vector<int>w(n);
	repp(i, 0, n) {
		cin >> w[i];
		sum += w[i];
	}
	for (int i = 0; i < n; ++i) {
		int sum2 = 0;
		for (int j = 0; j < i; ++j) {
			sum2 += w[j];
		}
		minv = min(minv, abs(sum - 2*sum2));
	}
	cout << minv << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
	int n; cin>>n;
  rep(i,n){
    int a; cin>>a;
    if(a%2) return cout<<"first"<<endl, 0;
  }
  cout << "second" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T>
bool chmax(T &a, T b){
    if(a < b){a = b; return true;}
    else return false;
}

int main(){
    int N, W;
    cin >> N >> W;
    vector<int> weight(N);
    vector<long long> value(N);
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];
    
    long long dp[110][100100] = {0};
    for (int i = 0; i < N; ++i) {
        for (int w = 0; w <= W; ++w) {
            if (w - weight[i] >= 0) {
                chmax(dp[i + 1][w], dp[i][w - weight[i]] + value[i]);
            }
            chmax(dp[i + 1][w], dp[i][w]);
        }
    }
    
    cout << dp[N][W] << endl;
    return 0;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 200 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

void solve() {
	string t = "";
	li cnt = 0;
	int lst = 0;
	forn(i, n){
		t += s[i];
		if (sz(t) == 3){
			if (t == "ABC"){
				t = "A";
				cnt += lst + 1;
			}
			else{
				if (t[0] == 'A')
					++lst;
				else
					lst = 0;
				t = t.substr(1);
			}
		}
	}
	printf("%lld\n", cnt);
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if(read()) {
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


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

public class Main {
	private static void solve(){
	//Implement solution here.
		int n = ni();
		int k = ni();
		char[] ca = next().toCharArray();
		ca[k-1] = Character.toLowerCase(ca[k-1]);
		System.out.println(new String(ca));
	}

    //Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 22356
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  int i;
  int m,b;
  while(str!="-"){
    cin >> m;
    for(i=0;i<m;i++){
      cin >> b;
      str=str.substr(b,str.size()-b)+str.substr(0,b);
    }
    cout << str << endl;
    cin >> str;
  }
   
}


Measured memory_bytes: 3216
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;
	string s,r;
	cin >> s >> r;

	rep(i,3){
		if(s[i]==r[i]){
			ans++;
		}
	}

	cout << ans << endl;
}

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

using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    cout << 0 << " " << 0 <<  '\n';
    return 0;
  }
  int ac = 0, pn = 0;
  vector<int> vec(100000);
  for (int i = 0; i < 100000; i++) {
    vec.at(i) = 0;
  }
  vector<bool> vecf(100000);
  for (int i = 0; i < 100000; i++) {
    vecf.at(i) = false;
  }
  for (int i = 0; i < m; i++) {
    int num;
    string s;
    cin >> num >> s;
    if (s == "WA") {
      vec.at(num - 1) ++;
    }
    if (s ==  "AC" && vecf.at(num - 1) == false) {
      ac++;
      pn += vec.at(num - 1);
      vec.at(num - 1) = 0;
      vecf.at(num - 1) = true;
    }
  }
  cout << ac << " " << pn << '\n';
	return 0;
}


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

int main(void) {
	int N, K;
	string S;

	cin >> N >> K >> S;

	char d = 'a' - 'A';
	char c = (S[K - 1] + d);
	S[K - 1] = c;

	cout << S << '\n';
	return 0;
}


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

int main() {
    string S; cin >> S;
    map<string, string> ma;
    ma["Sunny"] = "Cloudy";
    ma["Cloudy"] = "Rainy";
    ma["Rainy"] = "Sunny";
    cout << ma[S] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
long long  a,b,c,d,i,j,k,x,y,z,ans;
char f[100005];
int main(){
	scanf("%s",f);
	for (i=1;i<=strlen(f)-1;i++){
		if (f[i]!=f[i-1]) ans++;
	}
	printf("%lld",ans);
}

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

int main()
{
  ll a;
  cin>>a;
  ll c[a];
  for(ll i=0;i<a;i++)
  cin>>c[i];
  ll sum=0,ans=c[0];
  for(int i=0;i<a;i++)
  {
    if(ans>c[i])
    {
      sum+=ans-c[i];
    }
    else
    {
      ans=c[i];
    }
    //cout<<sum<<endl;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 5132
n=int(input())

def f(n):
  if n==1:
    return []
  arr=[]
  temp=n
  for i in range(2,int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp//=i
      arr.append([i,cnt])
  if temp!=1:
    arr.append([temp,1])
  if arr==[]:
    arr.append([n,1])
  return arr

arr=[]
for p,e in f(n):
  for i in range(1,e+1):
    arr.append(p**i)
arr.sort()

cnt=0
for i in arr:
  if n%i==0:
    cnt+=1
    n//=i

print(cnt)

Measured memory_bytes: 63460
def solve():
    from bisect import bisect
    from itertools import accumulate
    from sys import stdin
    f_i = stdin
    
    while True:
        n = int(f_i.readline())
        if n == 0:
            break
        
        a = list(map(int, f_i.readline().split()))
        b = float(f_i.readline())
        r, v, e, f = map(float, f_i.readline().split())
        
        r = int(r)
        a_n = a.pop()
        
        dp = [1 / (v - f * (r - x))for x in range(r)]
        dp += [1 / (v - e * (x - r))for x in range(r, a_n)]
        
        dp = list(accumulate(dp))
        cost = tuple(time + b for time in dp)
        
        for a_i in a:
            base = dp[a_i-1]
            for i, tpl in enumerate(zip(dp[a_i:], cost), start=a_i):
                pre, new = tpl
                new += base
                if new < pre:
                    dp[i] = new
        
        print(dp[-1])

solve()


Measured memory_bytes: 6800
#include  <iostream>
#include  <cstdlib>


long long solve(void);

int main(void)
{

	long long ans;
	ans = solve();

	std::cout << ans << std::endl;
  
	
	return EXIT_SUCCESS;
}

long long solve(void)
{
	int N, X, T;
	std::cin >> N >> X >> T;

	long long ans = 0;
	ans = ((N / X) + (N % X != 0)) * T;

	return ans;
}



Measured memory_bytes: 3596