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

int main(){
  int N, D;
  cin >> N >> D;
  int cood[N][D];
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++) cin >> cood[i][j];
  }
  int dist_sqr, dist_int, cnt = 0;
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      dist_sqr = 0;
      for(int k = 0; k < D; k++) dist_sqr += (cood[j][k] - cood[i][k]) * (cood[j][k] - cood[i][k]);
      dist_int = int(sqrt(dist_sqr));
      if(dist_sqr == dist_int * dist_int) cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    for(int i = 1; i <= 9; ++i) {
        for(int j = 1; j <= 9; ++j) {
            if(n == i * j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
xs = []
ys = []
hs = []
for i in range(N):
    x, y, h = map(int, input().split())
    xs.append(x)
    ys.append(y)
    hs.append(h)

for cx in range(100 + 1):
    for cy in range(100 + 1):
        flg = True
        for i in range(N):
            if hs[i] == 0:
                continue
            H = hs[i] + abs(xs[i] - cx)  + abs(ys[i] - cy)
            if H != 0:
                break
        if H == 0:
            break
        for i in range(N):
            h_ = max(H - abs(xs[i] - cx) - abs(ys[i] - cy), 0)
            if hs[i] != h_:
                flg = False
                break
        if flg:
            print("{0} {1} {2}".format(cx, cy, H))
            exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+10 , OO = 0x3f3f3f3f;

#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(n) for(int &x : n) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


int n;


int main()
{   

      ios_base::sync_with_stdio(0) , cin.tie(0);cout.tie(0);


      ll n;
      cin >> n;
      ll ans = 1e18;
      for (ll i=1 ;i*i<=n;i++) {
            ll div = n/i;
            if ( i*div == n) 
                  ans = min(ans,i+div-2);
      }
      cout << ans << endl;


      return 0;
}

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

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

	int k, x;
	cin >> k >> x;

	for (int i = x-k+1; i <= x+k-1; i++) {
		cout << i << ' ';
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 256
inf = float('inf')


def calc(mask):
    t = [0] * 3
    cnt = 0
    for j in range(n):
        idx = (mask >> (2 * j)) & 3
        if idx == 3:
            cnt += 1
            continue
        t[idx] += l[j]

    if 0 in t:
        return inf

    return sum(abs(tt - gg) for tt, gg in zip(t, goal)) + (n - cnt - 3) * 10


def dfs(cur, mask):
    # l[cur]をa,b,c,未使用のいずれかにあてがう

    # base case
    if cur == n:
        return calc(mask)

    res = inf
    for i in range(4):
        # i == 0,1,2 : a,b,cにあてがう / i == 3 : 未使用
        res = min(res, dfs(cur + 1, mask | i << (2 * cur)))
    return res


n, *goal = map(int, input().split())
l = [int(input()) for _ in range(n)]

print(dfs(0, 0))


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

int main() {
 int N ;
 cin >> N ;
 vector<int> A(N),B(N);
  int ans =0;
  for (int i=0;i<N;i++){
    cin >>A.at(i);
    B.at(i)=A.at(i);
  }
  sort(B.begin(),B.end());
   for (int i=0;i<N;i++){
     if (A.at(i) != B.at(i)){
       ans++;
       if (ans==3){
         break;
       }
     }
   }

  
  if (ans<3){
   cout << "YES" ;
  }
  else{ 
    cout <<"NO" ;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
typedef long long LL;
const int N=5010;
int n,m,f[N];
int mul(int a,int b){return (LL)a*b%m;}
void inc(int&a,int b){a+=b;if(a>=m)a-=m;}
int main(){
	cin>>n>>m;
	f[0]=1;
	ref(i,1,n)
		ref(j,0,n-1)if(f[j])
			if(j+(i+1>>1)<n)inc(f[j+(i+1>>1)],f[j]);
	int ans=0;
	ref(i,0,n-1)inc(ans,f[i]);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())

W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1-a, 100*B):
        W.add(a+b)

S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1-c, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w+s <= F and s <= w*E//100:
            if s/(w+s) > rate:
                rate = s/(w+s)
                ans = w+s, s
                
print(ans[0], ans[1])

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();

    int max = Math.max(a, b);
    int c = 0;
    for (int i = max; i >= 1; i--) {
      if (a % i == 0 && b % i == 0) {
        c++;
      }
      if (c == k) {
        System.out.println(i);
        break;
      }
    }
  }
}


Measured memory_bytes: 21716
#include <map>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <sstream>
#include <vector>
#include <stack>
#include <utility>
#include <math.h>
using namespace std;

int main()
{
	int K, S;
	cin >> K >> S;
	int ans = 0;

	for (int X = 0; X <= K; X++)
	{
//		if (S < X + 0 + 0) break;
		for (int Y = 0; Y <= K; Y++)
		{
//			if (S < X + Y + 0) break;
			if (S - (X + Y) >= 0 && S - (X + Y) <= K) ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int MAX=10000001;
	static boolean[] is=new boolean[MAX];
	static{
		Arrays.fill(is,true);
		is[0]=is[1]=false;
		for(int i=2;i*i<=is.length;i++){
			if(is[i]){
				for(int j=i+i;j<is.length;j+=i){
					is[j]=false;
				}
			}
		}
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		for(;;){
			int n=cin.nextInt();
			if(n==0)break;
			if(n%2==0)n--;
			for(int i=n;i>=13;i-=2){
				if(is[i]){
					if(is[i-2]&&is[i-6]&&is[i-8]){
						System.out.println(i);
						break;
					}
				}
			}

		}
	}

}

Measured memory_bytes: 34304
""" A
    https://atcoder.jp/contests/abc175/tasks/abc175_a
"""
import sys
import math
from functools import reduce
from bisect import bisect_left

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return [lambda _: readIntegerSet(m) for _ in range(0, n)]

def main(S):
    candidate = 0
    best = 0

    for c in list(S.rstrip()):
        if c == "S":
            if candidate > best:
                best = candidate
            candidate = 0
        else:
            candidate += 1

    if candidate > best:
        best = candidate

    return best

if __name__ == "__main__":
    _S = readString()

    print(main(_S))

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using Pa = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T,U;
    int A,B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    cout << (A-(S==U)) << " " << (B-(T==U)) << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> a(3*N);
    for(auto &in:a)cin >> in;
    sort(a.begin(),a.end());
    ll res = 0;
    for(int i = 0; i < N; i++){
        res += a[3*N - 2*(i+1)];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2560
### constant

MAX_INT = (1 << 30)

### main

while true
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if n == 0 && m == 0

  edges = n.times.map{[]}
  dedges = n.times.map{[]}

  nbrs = n.times.map{[]}
  dnbrs = n.times.map{[]}

  m.times do
    a, b, c = gets.strip.split(' ').map{|s| s.to_i}
    a -= 1
    b -= 1

    edges[a][b] = edges[b][a] = c
    nbrs[a] << b
    nbrs[b] << a
  end

  for i in (0...n)
    for j in ((i + 1)...n)
      for k in (0...n)
        if ! edges[i][k].nil? && ! edges[k][j].nil?
          dedges[i][j] = dedges[j][i] = k
          dnbrs[i] << j
          dnbrs[j] << i
        end
      end
    end
  end

  start = 0
  goal = n - 1

  dists = n.times.map{[MAX_INT] * 3}
  used = n.times.map{[false] * 3}

  dists[start][2] = 0
  used[start][2] = true
  q = [[start, 2]]

  while ! q.empty?
    u = q.min{|a, b| dists[a[0]][a[1]] <=> dists[b[0]][b[1]]}
    q.delete(u)

    u0, u1 = u
    next if u0 == goal

    for v0 in nbrs[u0]
      d = dists[u0][u1] + edges[u0][v0]
      if dists[v0][u1] > d
        dists[v0][u1] = d
        if ! used[v0][u1]
          used[v0][u1] = true
          q << [v0, u1]
        end
      end
    end

    if u1 == 2
      for v0 in dnbrs[u0]
        k = dedges[u0][v0]
        d = dists[u0][2]

        if dists[k][1] > d
          dists[k][1] = d
          if ! used[k][1]
            used[k][1] = true
          end
        end

        if dists[v0][0] > d
          dists[v0][0] = d
          if ! used[v0][0]
            used[v0][0] = true
            q << [v0, 0]
          end
        end
      end
    end
  end

  puts [dists[goal][0], dists[goal][2]].min
end

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

int main() {    
    int d, t, s;
    cin >> d >> t >> s;
    if(d <= t*s){cout << "Yes" << endl;}
    else cout << "No" << endl;
    return 0;
} 


Measured memory_bytes: 3584
n=int(input())
if n==0:
    print(0)
else:
    a=abs(n)
    if n>0:
        p=0
    else:
        p=1
    inf=2**p
    while True:
        if a<=inf:
            break
        else:
            p+=2
            inf+=2**p
    sp=p
    while p>=0:
        if p==sp:
            if p%2==0:
                #sn=n
                n-=2**p
                #print(p,str(sn)+"-"+str(2**p)+"="+str(n))
            else:
                #sn=n
                n+=2**p
                #print(p,str(sn)+"+"+str(2**p)+"="+str(n))
            p-=1
            ans="1"
        elif p%2==0 and 2*abs(n)>=abs(n-2**p):
            #sn=n
            n=n-2**p
            #print(p,str(sn)+"-"+str(2**p)+"="+str(n))
            p-=1
            ans=ans+"1"
        elif p%2==1 and 2*abs(n)>=abs(n+2**p):
            #sn=n
            n=n+2**p
            #print(p,str(sn)+"+"+str(2**p)+"="+str(n))
            p-=1
            ans=ans+"1"
        else:
            #print(p,"else")
            p-=1
            ans=ans+"0"
    if len(ans)<sp+1:
        ans+="0"*(sp+1-len(ans))
    print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int>z(3);
    vector<int>d(3 * n);
    for (int i = 0; i < n * 3; i++) {
        int n = 0;
        if (s.at(i) == 'R') {
            z.at(0)++;
            n = 0;
        }
        if (s.at(i) == 'B') {
            z.at(1)++;
            n = 1;
        }
        if (s.at(i) == 'G') {
            z.at(2)++;
            n = 2;
        }
        if ((z.at(n) > z.at(0) && z.at(n) > z.at(1)) || (z.at(n) > z.at(2) && z.at(n) > z.at(1)) || (z.at(n) > z.at(2) && z.at(n) > z.at(0))) {
            d.at(i) = 1;
        }
        if (z.at(n) <= z.at(0) &&z.at(n) <= z.at(2) && z.at(n) <= z.at(1)) {
            d.at(i) = 2;
        }
    }
    int m=0;
    ll ans = 1;
    for (int i = 0; i < n * 3; i++) {
        if (d.at(i) ==1)m++;
        if (d.at(i) == 0) {
            ans *= m;
            m--;
        }
        ans %= 998244353;
    }
    reverse(d.begin(), d.end());
    m = 0;
    for (int i = 0; i < n * 3; i++) {
        if (d.at(i) == 2)m++;
        if (d.at(i) == 0) {
            ans *= m;
            m--;
        }
        ans %= 998244353;
    }
    for (int i = 1; i < n+1; i++) {
        ans *= i;
        ans %= 998244353;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1796
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int X,Y;
vector<edge> G[2010];
bool F[2010];
int d[2010];
int num[2010];

void Dijkstra(int s){
	std::priority_queue<P,vector<P>,std::greater<P>> que;
	std::fill(d,d+N,INF);
	d[s]=0;
	que.push(P(0,s));
	while(!que.empty()){
		P p =que.top();que.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		for(int i=0;i<(signed)G[v].size();i++){
			edge e =G[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}

signed main(){
	cin>>N>>X>>Y;
	X--,Y--;
	REP(i,N-1){
		edge e;
		e.to=i+1,e.cost=1;
		G[i].push_back(e);
		e.to=i,e.cost=1;
		G[i+1].push_back(e);
	}
	G[X].push_back({Y,1});
	G[Y].push_back({X,1});
	REP(i,N){
		Dijkstra(i);
		REP(j,N){
			if(i!=j){
				num[d[j]]++;
			}
		}
	}
	for(int i=1;i<=N-1;i++){
		cout<<num[i]/2<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
    
int main(){
    int n;
    scanf("%d", &n);
    long int a[n] = {0};
    for(int i=0; i<n; i++) scanf("%ld", &a[i]);
    long int ans_ev = 0, ans_od = 0;
    long int sum = 0;
    // 偶数番号
    for(int i=0; i<n; i++)
    {
        sum += a[i];
        if(i%2==0)
        {
            if(sum <= 0)
            {
                ans_ev += -sum + 1;
                sum = 1;
            }
        }
        else
        {
            if (sum >= 0)
            {
                ans_ev += sum + 1;
                sum = -1;
            }
        }
    }
    sum = 0;
    // 奇数番号
    for(int i=0; i<n; i++)
    {
        sum += a[i];
        if(i%2==1)
        {
            if(sum <= 0)
            {
                ans_od += -sum + 1;
                sum = 1;
            }
        }
        else
        {
            if (sum >= 0)
            {
                ans_od += sum + 1;
                sum = -1;
            }
        }
    }
    
    printf("%ld\n", min(ans_ev, ans_od));
    return 0;
}

Measured memory_bytes: 1024
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Nice Shopping
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;
const int INF = 1 << 30;

/* typedef */

/* global variables */

int as[MAX_N], bs[MAX_N];

/* subroutines */

inline void setmin(int &a, int b) { if (a > b) a = b; }

/* main */

int main() {
  int an, bn, m;
  scanf("%d%d%d", &an, &bn, &m);

  int mina = INF, minb = INF;
  for (int i = 0; i < an; i++)
    scanf("%d", as + i), setmin(mina, as[i]);
  for (int i = 0; i < bn; i++)
    scanf("%d", bs + i), setmin(minb, bs[i]);

  int minsum = mina + minb;
  while (m--) {
    int x, y, c;
    scanf("%d%d%d", &x, &y, &c);
    x--, y--;
    int sum = as[x] + bs[y] - c;
    setmin(minsum, sum);
  }

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/


int main()
{
  ll r;cin>>r;
  printf("%.20f",M_PI*2*r);
  return 0;
}


Measured memory_bytes: 3800
def main():
    n = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    s = sum(A) - sum(B)
    if s < 0:
        print(-1)
    else:
        D = sorted([d for a, b in zip(A, B) if (d := a - b) > 0])
        c = sum([a != b for a, b in zip(A, B)])
        for d in D:
            if d <= s:
                c -= 1
                s -= d
            else:
                break
        if s > 0 and len(A) == len(D):
            c += 1
        print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24032
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] d = new int[3];
		d[0] = scanner.nextInt();
		d[1] = scanner.nextInt();
		d[2] = scanner.nextInt();
		Arrays.parallelSort(d);
		System.out.println(d[0] + d[1]);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string S;
  int K;

  cin >> S;
  cin >> K;

  REP(i, K) {
    if(S[i] != '1') {
      cout << S[i];
      return 0;
    }
  }
  cout << '1';
}

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

char map[71][71];
char answer[71][71][71];
int w,h;


char *secretnum(char *a,char *b)
{
	int k;
	int len1,len2;
	
	len1 = strlen(a);
	len2 = strlen(b);
	
	if(len1 > len2){
		return a;
	}else if(len1 < len2 ){
		return b;
	}else{
		for(k=0;k<len1;k++){
			if(a[k] - b[k] > 0){
				return a;
			}else if(a[k] - b[k] < 0){
				return b;
			}
		}
	}
	return a;
}

int main(void)
{
	int i,j,c;
	int len;
	char ans[71];
	
	while(1)
	{
		scanf("%d %d ",&w,&h);
		if(w==0 && h==0)break;
		
		for(i=0;i<h;i++){
			scanf("%s ",map[i]);
		}

		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				answer[i][j][0] = '\0';
				if(map[i][j] - '0' < 10 && map[i][j] - '0' >= 0){
					if(i>0)strcpy(answer[i][j],secretnum(answer[i][j],answer[i-1][j]));
					if(j>0)strcpy(answer[i][j],secretnum(answer[i][j],answer[i][j-1]));
					len = strlen(answer[i][j]);
					answer[i][j][len] = map[i][j];
					answer[i][j][len+1] = '\0';
					if(answer[i][j][0] == '0')answer[i][j][0] = '\0';
				}
			}
		}
		
		ans[0] = '\0';
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				strcpy(ans,secretnum(ans,answer[i][j]));
			}
		}
		
		printf("%s\n",ans);
	}
	return 0;
}

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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll N,M,K;
	cin>>N>>M>>K;
    
    
    vector<set<ll>> f_set(N);
    vector<set<ll>> b_set(N);
    rep(i,M){
        ll a,b;
        cin>>a>>b;
        f_set[a-1].insert(b-1);
        f_set[b-1].insert(a-1);
    }
    rep(i,K){
        ll a,b;
        cin>>a>>b;
        b_set[a-1].insert(b-1);
        b_set[b-1].insert(a-1);
    }
    deque<ll> dq;
    ll flag[N] = {};
    ll ans_all[N] = {};
    rep(i,N){
        if(flag[i]==0){
            ll ans = 0;
            dq.push_back(i);
            set<ll> group_set = {};
            group_set.insert(i);
            flag[i] = 1;
            while(!dq.empty()){
                ll id = dq.front();
                dq.pop_front();
                for(auto x:f_set[id]){
                    if(flag[x] == 0){
                        group_set.insert(x);
                        flag[x] = 1;
                        dq.push_back(x);
                    }
                }
            }
            for(auto x:group_set){
                ll not_f = 0;
                for(auto y:f_set[x]){
                    if(group_set.count(y)==1){
                        ++not_f;
                    }
                }
                for(auto y:b_set[x]){
                    if(group_set.count(y)==1){
                        ++not_f;
                    }
                }
                ans_all[x] = group_set.size()-1 - not_f;
            }
        }
    }
    rep(i,N-1){
        cout<<ans_all[i]<<" ";
    }
    cout<<ans_all[N-1]<<"\n";
    return 0;
}

Measured memory_bytes: 36096
#coding: utf-8

def factoraization(n):
    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([n, 1])
    
    return arr
    
if __name__ == '__main__':
    N = int(input())
    
    num_lst = []
    for i in range(1, N + 1, 2):
        num_lst.append(i)
        
    result = 0
    
    for j in num_lst:
        
        count = 1
        x = factoraization(j)

        for t in range(len(x)):
            count *= (int(x[t][1]) + 1)
            
            if count == 8:
                result += 1
    
    print(result)

Measured memory_bytes: 62580
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner kbd = new Scanner(System.in);
    void run(){
	while(kbd.hasNext()){
	    int k = kbd.nextInt();
	    if(k==0) break;

	    int i;
	    long sum=0;
	    for(i=0; i<(k*(k-1)/2); i++)
		sum += kbd.nextInt();
	   
	    System.out.println(sum/(k-1));
	}
    }
}
	   

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

using namespace std;

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

int main() {
  int N, M;
  while(cin >> N >> M && (N || M)) {
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    bool ok = 0;
    rep(m, 1<<M) {
      if(__builtin_popcount(m) != L[0]) continue;
      string temp;
      int count = L[0];
      rep(k, M)
        temp.push_back('0' + (m >> k & 1));
      bool ng = 0;
      REP(k, 1, N) {
        count -= temp[k-1] == '1';
        if(L[k] == count) temp.push_back('0');
        else if(L[k] == count + 1) temp.push_back('1'), count ++;
        else {
          ng = 1;
          break;
        }
      }
      if(ng) continue;
      cout << temp << endl;
      ok = 1;
      break;
    }
    if(!ok) cout << "Goofy" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3048
n = int(input())
a = []
b = []
cnt = 0
for _ in range(n):
    a1,b1 = map(int,input().split())
    a.append(a1)
    b.append(b1)
c = sorted(zip(b,a))
for i in range(n):
    cnt += c[i][1]
    if cnt > c[i][0]:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 32644
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)
#define Sort(a) sort(a.begin(),a.end())

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	char c1,c2;cin>>c1>>c2;
	if(c1==c2)cout<<'H';
	else cout<<'D';
	return 0;
}


Measured memory_bytes: 256
public class Hello{
    public static void Main(){
        int line1 = int.Parse(System.Console.ReadLine());
        int line2 = int.Parse(System.Console.ReadLine());
        int line3 = int.Parse(System.Console.ReadLine());
        int ans=(line1+line2)*line3/2;
        System.Console.WriteLine(ans);
    }
}


Measured memory_bytes: 2648
/* به نام یزدان */
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 100 * 1000 + 10;
int n, h[MAX_N], dp[MAX_N];

void read_input() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> h[i];
}

void solve() {
	dp[1] = abs(h[0] - h[1]);
	for (int i = 2; i < n; i++)
		dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
	cout << dp[n - 1];
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	read_input();
	solve();
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iostream>
#include <utility>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
 
using namespace std;
using ll = long long;
using ld = long double;
using Vl = vector<ll>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
using vs = vector<string>;

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

ll N;
int main() {
    cin >> N;
    ll B[N];
    REP(i,N-1) cin >> B[i];

    ll sum = B[0];
    sum+=B[N-2];
    if(N==2){
        cout << sum << endl;
        return 0;
    }
    FOR(i,1,N-1){
        sum+= min(B[i],B[i-1]);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
	long long int N,sum=0;
  	cin >> N;
  	long long int hoge = N;
  	while(N>0){
    	sum += N%10;
      	N = N/10;
    }
  	if(hoge%sum == 0) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,k;
    cin >> n >> k;
    vi h(n);
    rep(i,n)cin >> h[i];
    sort(all(h));
    int ans = 0;
    rep(i,n-k){
        ans += h[i];
    }
    cout << ans << endl;
}


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

const int N=2e5+5;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        char c;
        cin>>c;
        if(c>='A' && c<='Z')
            cout<<"A"<<endl;
        else if(c>='a' && c<='z')
            cout<<"a"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.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>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

struct MyStruct
{
	int list[13];
};



signed main() {
	int i, j, k, n, m, sum = 0, cnt = 0;
	string s, s1, s2;
	bool flag = false;
	vector<vector<int>>list(1005, vector<int>(1005, 0));
	vector<vector<int>>list2(1005, vector<int>(1005, 0));
	vector<vector<int>>list3(1005, vector<int>(1005, 0));
	vector<int>list4(10005, 0);
	int x1, y1, x2, y2, a, b, tmp, r;
	

	cin >> a >> b;

	if (a<b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	/* 最大公約数を出力 */
	cout << b << endl;





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


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

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    if(x-a<=b && x-a>=0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

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

int main(){
int a,b,c;
int d=0,e=0;
while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
//if(a==0&&b==0&&c==0){break;}
if(a*a+b*b==c*c){d++;}
if(a==b){e++;}}
cout<<d<<endl<<e<<endl;}

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

#define rep(i, x, n) for(int i=(x);i<(n);i++)
#define reps(i, x, n) for(int i=(x);i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int h[n + 5], highest[n + 5] = {};
  reps(i, 1, n){
    cin >> h[i];
  }
  int a, b;
  rep(i, 0, m){
    cin >> a >> b;
    highest[a] = max(highest[a], h[b]);
    highest[b] = max(highest[b], h[a]);
  }
  int ans = 0;
  reps(i, 1, n){
    if(highest[i] < h[i]){
      ans ++;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4404
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define ff first
#define ss second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
LL gcd(LL a, LL b) {
	LL c;
	while (a != 0) {
		c = a;
		a = b % a;
		b = c;
	}
	return b;
}
const int N = 105;
char s[N];
int main()
{
	El3zba;
	scanf("%s", s + 1);
	for (int i = 1; i <= 100; i++)
	{
		if (s[i] == 'R'&&i % 2 != 1)
			return cout << "No\n", 0;
		else if (s[i] == 'L'&&i % 2 != 0)
			return cout << "No\n", 0;
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

struct Edge {
	int u;
	int v;
	int c;

	Edge(int u_, int v_, int c_) {
		u = u_;
		v = v_;
		c = c_;
	}

	Edge() {}
};

const int N = 2500;
const int INF = 1e9 + 239;

int d[N];
vector<Edge> ed;

int run(int n, int st, int en) {
	fill(d, d + N, INF);
	d[st] = 0;
	vector<int> bad;
	for (int i = 0; i < n; i++) {
		for (auto t : ed) {
			if (d[t.u] != INF && d[t.u] + t.c < d[t.v]) {
				d[t.v] = d[t.u] + t.c;
				if (i + 1 == n) {
					bad.push_back(t.u);
				}
			}
		}
	}
	{
		vector<int> nd(n, INF);
		queue<int> q;
		for (auto t : bad) {
			nd[t] = 0;
			q.push(t);
		}
		while (!q.empty()) {
			int u = q.front();
			q.pop();
			for (auto e : ed) {
				if (e.u == u && nd[e.v] > nd[e.u] + 1) {
					nd[e.v] = nd[e.u] + 1;
					q.push(e.v);
				}
			}
		}
		if (nd[en] != INF) return 1;
	}
	return min(0, d[en]);
}

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

	int n, m, p;
	cin >> n >> m >> p;
	while (m--) {
		int u, v, c;
		cin >> u >> v >> c;
		u--;
		v--;
		c -= p;
		c *= -1;
		ed.push_back(Edge(u, v, c));
		// cerr << u << ' ' << v << ' ' << c << endl;
	}
	int ans = run(n, 0, n - 1);
	cout << -ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;

bool a(string s)
{
  for (int i = 0; i < s.size() / 2; i++)
  {
    if (s[i] != s[s.size() - 1 - i])
    {
      return false;
    }
  }
  return true;
}

int main()
{
  string s;
  cin >> s;
  string ans = "No";
  if (a(s) && a(s.substr(0, (s.size() - 1) / 2)))
  {
    ans = "Yes";
  }

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


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
#define repM1(i, n) for(ll i = (ll)(n - 1); i > 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

vector<vector<ll>> edge;
vector<ll> ans;
vector<ll> depth;


void bfs() {
	
	queue<ll> q;
	depth[1] = 0;
	q.push(1);

	while (!q.empty()) {
		ll v = q.front();
		q.pop();
		rep(i, edge[v].size()) {
			if (depth[edge[v][i]] > depth[v] + 1) {
				depth[edge[v][i]] = depth[v] + 1;
				ans[edge[v][i]] = v;
				q.push(edge[v][i]);
			}
		}
	}

	return;
}

int main()
{
	cout << fixed << setprecision(18);

	ll n, m;
	cin >> n >> m;

	ll a, b;
	edge.resize(n + 1);

	rep(i, n + 1) {
		ans.push_back(INF);
		depth.push_back(INF);
	}

	rep(i, m) {
		cin >> a >> b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	bfs();

	cout << "Yes" << endl;
	for (ll i = 2; i < n + 1; i++)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 13684
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int N = int.Parse(input[0]);
		int K = int.Parse(input[1]);
		// 文字列の入力
		string S = Console.ReadLine();
		string output = S.Substring(0, K-1) + Char.ToLower(S[K-1]) + S.Substring(K);
		//出力
		Console.WriteLine(output);
	}
}

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

int main(){
    string s;
    cin >> s;
    if(s.find("7") != string::npos) cout <<"Yes"<< endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,x;cin>>n>>m>>x;
    int a;
    int cost_0=0,cost_n=0;
    for(int i=0;i<m;i++){
        cin>>a;
        if(a<x){
            cost_0++;
        }
        else{
            cost_n++;
        }
    }
    if(cost_0<cost_n){
        cout<<cost_0<<endl;
    }
    else{
        cout<<cost_n<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#define ll long long
#define fr(i,p,n) for(ll i=p;i<n;i++)
#define fr1(i,p,n) for(ll i=p;i>=n;i--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(15) << std::fixed;
using namespace std;

ll dp[3005][3005];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,s;
        cin>>n>>s;
        ll a[n+1];
        fr(i,1,n+1) cin>>a[i];
        dp[0][0]=1;
        fr(i,1,n+1)
        {
            fr(j,0,s+1)
            {
                if(j-a[i]>=0)
                    dp[i][j]+=(dp[i-1][j-a[i]])%MOD1;
                dp[i][j]%=MOD1;
                dp[i][j]+=(dp[i-1][j]*2)%MOD1;
                dp[i][j]%=MOD1;
            }
        }
        cout<<dp[n][s]<<endl;
    }
    return 0;
}


Measured memory_bytes: 74064
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int area=a*b;
		int length=2*a+2*b;
		System.out.println(area+" "+length);
	}

}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<ll>ans;
    ll i=0;
    if(n==0){
        ans.push_back(0);
    }
    while(n!=0){
        if(n%2==0){
            ans.push_back(0);
        }
        else {
            ans.push_back(1);
            if(i%2==0)n--;
            else n++;
        }
        n/=2;
        i++;
    }
    reverse(all(ans));
    for(auto u:ans){
        cout <<u;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;
	
	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i-1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

void dfs(int from) {
	int c = 1;
	for (auto t : tree[from]) {
		c = c != color[from] ? c : c + 1;
		color[t] = c;
		colorMap[make_pair(from, t)] = c;
		m = max(c, m);
		dfs(t);
		c++;
	}
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int main() {
	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U;
	cin >> U;
	if (U == S)A--;
	else B--;
	cout << A << ' ' << B << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);
  
  if(a[2] == a[0]+a[1]){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 384
class Factorial:
    def __init__(self, n, mod=10**9+7):
        self.fac = [0] * (n+1)
        self.ifac = [0] * (n+1)
        self.fac[0] = 1
        self.ifac[0] = 1
        self.mod = mod
        modmod = self.mod - 2
        for i in range(n):
            self.fac[i+1] = self.fac[i] * (i+1) % self.mod
            self.ifac[i+1] = self.ifac[i] * pow(i+1, modmod, self.mod) % self.mod

    def comb(self, n, r):
        if n == 0 and r == 0:
            return 1
        if n < r or n < 0:
            return 0
        tmp =  self.ifac[n-r] * self.ifac[r] % self.mod
        return tmp * self.fac[n] % self.mod

    def perm(self, n, r):
        if n == 0 and r == 0:
            return 1
        if n < r or n < 0:
            return 0
        return (self.fac[n] * self.ifac[n-r]) % self.mod

def resolve():
    n, k = map(int, input().split())
    a = sorted(map(int, input().split()))
    mod = 10 ** 9 + 7
    fact = Factorial(n + 1)

    mn, mx = 0, 0
    for i in range(k, n+1):
        mx = (mx + a[i-1] * fact.comb(i-1, k-1)) % mod
        mn = (mn + a[n-i] * fact.comb(i-1, k-1)) % mod
    ans = mx - mn
    if ans < 0:
        ans += mod
    print(ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 15988
#include<iostream>
using namespace std;
int main(){
  string s; cin>>s;

  bool flag = true;
  for(int i=0;i<s.size();i++){
    if((i+1)%2==0){
      if(s.at(i) == 'R'){
        flag = false;
      }
    }else{
      if(s.at(i) == 'L'){
        flag = false;
      }
    }
  }

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


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

string S;
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> S;
    if (S=="Sunny") cout << "Cloudy" << endl;
    else if (S=="Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}

Measured memory_bytes: 256