akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,bool>
#define mp make_pair

using namespace std;

ll n,x,m;

const int nax = 1e5 + 5;

ll a[nax];

ll fi[nax];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>x>>m;
    a[1] = x;
    for(int i=2;i<nax;i++)
    {
        a[i] = (a[i-1] * a[i-1]) % m;
    }

    ll st = -1;
    ll kn = -1;

    for(int i=1;i<nax;i++)
    {
        ll cur = a[i];
        if(fi[cur] > 0)
        {
            st = fi[cur];
            kn = i;
            break;
        }
        else fi[cur] = i;
    }

    ll ans = 0;

    if(n < nax)
    {
        for(int i=1;i<=n;i++)
        {
            ans += a[i];
        }
        cout<<ans;
        return 0;
    }

    ll cyc_len = kn - st;
    for(int i=1;i<st;i++)
    {
        ans += a[i];
    }
    ll cyc_sum = 0;
    for(int i=st;i<kn;i++)
    {
        cyc_sum += a[i];
    }
    ll rest = n - st + 1;
    ll cyc_cnt = rest / cyc_len;


    ans += cyc_cnt * cyc_sum;
    n -= cyc_cnt * cyc_len;

    for(int i=st;i<=n;i++)
    {
        ans += a[i];
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 5148
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def s_inpl(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
INF = float("inf")

N = int(input())
A = inpl()

ans_l = []
if N % 2 == 0:
    for i in range(1, N):
        if i % 2 == 1:
            ans_l.append(i)
            ans_l.append(i)
else:
    for i in range(1, N):
        if i % 2 == 0:
            ans_l.append(i)
            ans_l.append(i)
    ans_l.append(0)

A.sort()
ans_l.sort()

if A == ans_l:
    print((2**(N//2))%(1000000007))
else:
    print(0)


Measured memory_bytes: 58288
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func mainFn() {
	n := getInt()
	as := getIntSlice(n)

	b := make([]int, n)
	l, r := 0, n-1
	isL := true
	for i := n - 1; i >= 0; i-- {
		if isL {
			b[l] = as[i]
			l++
		} else {
			b[r] = as[i]
			r--
		}

		isL = !isL
	}

	for i := range b {
		puts(b[i])
	}
}

// -----------------------------------------

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// scanner.Buffer(make([]byte, buf), buf)
	scanner.Split(bufio.ScanWords)
	mainFn()
	writer.Flush()
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}

func puts(a ...interface{}) {
	if _, err := fmt.Fprintln(writer, a...); err != nil {
		panic(err)
	}
}


Measured memory_bytes: 8576
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto r = new int[](N);
    foreach (i, a; readln.split.to!(int[])) r[a-1] = i.to!int+1;
    writeln(r.to!(string[]).join(" "));
}

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

int main()
{
  int m, d, count = 0;
  cin >> m >> d;
  for (int i = 22; i <= d; i++) {
    if (i % 10 < 2) continue;
    int p = i / 10 * (i % 10);
    if (p <= m) count++;
  }
  cout << count << endl;
}


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

using namespace std;

struct Unionfind {
    vector<int> par;
    vector<int> rank;

    void init(int n) {
        par.resize(n);
        rank.resize(n);
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        else {
            if (rank[x] < rank[y]) par[x] = y;
            else {
                par[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }
    }

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

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

    Unionfind uf;
    uf.init(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b, a--, b--;
        uf.unite(a, b);
    }

    set<int> se;
    for (int i = 0; i < n; i++)se.insert(uf.root(i));

    cout << se.size() - 1 << endl;
    return 0;
}

Measured memory_bytes: 7932
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main(void) {
    const static unsigned int MAX_XI_VALUE = 50;
    int n, a;
    cin >> n >> a;

    vector<vector<vector<long long int>> > dp(n + 1, vector<vector<long long int> >(n + 1, vector<long long int>(n * MAX_XI_VALUE + 1)));

    int now;
    cin >> now;
    dp[1][1][now] = 1;

    for (int i = 2; i <= n; ++i) {
        cin >> now;
        dp[i][1][now] = 1;
        for (int j = 1; j <= i; ++j) {
            for (int k = 1; k < n * MAX_XI_VALUE + 1; ++k) {
                dp[i][j][k] += dp[i - 1][j][k];
                if (k >= now) {
                    dp[i][j][k] += dp[i - 1][j - 1][k - now];
                }
            }
        }
    }

/*
    cout << "RESULT" << endl;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k < n * MAX_XI_VALUE + 1; ++k) {
                cout << i << " " << j << " " << k << endl;
                cout << dp[i][j][k] << endl;
            }
        }
    }
*/

    long long int result = 0;
    for (int j = 1; j <= n; ++j) {
        result += dp[n][j][a * j];
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 55188
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    /*public static StreamTokenizer in;
    static {
        try{
            in = new StreamTokenizer(new BufferedReader(new InputStreamReader(new BufferedInputStream(System.in))));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static int nextInt() throws IOException{ in.nextToken(); return (int)in.nval; }*/
    public static void main(String[] args) throws IOException{
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int n=sc.nextInt();
        int k=sc.nextInt();
        int count[]=new int[n+1];
        while(k-->0){
            int d=sc.nextInt();
            while(d-->0){
                int p=sc.nextInt();
                count[p]++;
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++){
            if(count[i]==0)
                ans++;
        }
        System.out.println(ans);

    }
}


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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 201

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define print(v) for (auto i: v) cout << i << " ";

ll n, k;
vii arr;

bool poss(ll m) {
    ll s = 0, x;
    REP(i, 0, n) {
        if (arr[i].first < m)
            continue;
        x = (m/arr[i].second)*arr[i].second;
        s += (arr[i].first - x)/arr[i].second;
    }
    if (s <= k)
        return true;
    return false;
}

int main() {
    fast
    cin >> n >> k;
    vi a(n), f(n);
    REP(i, 0, n)
        cin >> a[i];
    REP(i, 0, n)
        cin >> f[i];
    sort(all(a));
    sort(all(f), greater<ll>());
    REP(i, 0, n)
        arr.pb({a[i]*f[i], f[i]});
    sort(all(arr));
    ll l = 0, h = arr[n-1].first, mid = (l+h)/2;
    while (l < h) {
        if (poss(mid))
            h = mid;
        else
            l = mid + 1;
        mid = (l + h)/2;
    }
    cout << l << endl;
}


Measured memory_bytes: 9584
/**
 * author: Behradm
 * Created: 2020.09.19 16:26:12
 * In The Name of God
**/
#include <bits/stdc++.h>

using namespace std;

int main() {   
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }

  for (int i = 0; i < n - 2; i++) {
    if (a[i].first == a[i].second && a[i + 1].first == a[i + 1].second && a[i + 2].first == a[i + 2].second) {
      cout << "Yes\n";
      return 0;
    }
  }

  cout << "No\n";
  return 0;
}


Measured memory_bytes: 3640
h,w = map(int,input().split())
A = [list(input()) for i in range(h)]
AH = []
AW = []
for i in range(h):
    if '#' in A[i]:
        AH.append(i)
for j in range(w):
    flag = 0
    for i in range(h):
        if A[i][j]=='#':
            flag = 1
    if flag:
        AW.append(j)
for i in AH:
    res = []
    for j in AW:
        res.append(A[i][j])
    print("".join(res))

Measured memory_bytes: 3064
n = int(input())
from collections import defaultdict
l = defaultdict(list)

for i in range(n):
  s,p = input().split()
  p=int(p)
  l[s].append({"i":i,"p":p})

for city in sorted(l.keys()):
  l[city].sort(
    key = lambda x: (x["p"])
    ,reverse = True
  )
  for c in l[city]:
    print(c["i"]+1)


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

using namespace std;

int main() {
  long long n;
  cin >> n;
  for(int i=61;i>=0;--i) {
    if( (n>>i) & 1 ) {
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, long long> c;
  for (auto ai : a) {
    c[ai]++;
    c[ai + 1]++;
    c[ai - 1]++;
  }
  long long ans = 0;
  for (auto ci : c) {
    ans = max(ans, ci.second);
  }
  cout << ans << '\n';
}

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

using namespace std;

int main() {
    int n;
    int m;
    cin >> n;
    vector<int> v(n);
    vector<int> x(0);
    for (int i = 0; i < n; i++) { cin >> v[i]; }
    for(int i=0;i<n;i++){
        m=lower_bound(x.begin(),x.end(),v[i])-x.begin();
        if(m==0){x.insert(x.begin(),v[i]);}
        else{x[m-1]=v[i];}
    }

    cout<<x.size();
    return 0;

}

Measured memory_bytes: 1276
package main

import (
  "fmt"
  "strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
  	ans := make([]int, 0)
	for i := 1; i <= n; i++ {
		iS := strconv.Itoa(i)
		if len(iS) % 2 != 0 {
			ans = append(ans, 1)
		}
	}
  fmt.Println(len(ans))
}



Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int n,m,k;
	int a[100100];
	int b[100100];
	int mna=100100,mnb=100100;
	cin>>n>>m>>k; 
	REP(i,n)	
	{
		cin>>a[i];
		mna=min(mna,a[i]);}
	REP(i,m)
	{
		cin>>b[i];
		mnb=min(mnb,b[i]); 
	}
	ll ans=mna+mnb;
	//cout<<ans<<endl;
	while(k--)
	{
		int x,y,c;
		cin>>x>>y>>c;
		x--,y--;
		ll res=a[x]+b[y]-c;
		ans=min(ans,res);
	 } 
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 1024
def merge(a, left, mid, right):
    L = a[left:mid] + [INF]
    R = a[mid:right] + [INF]
    
       
    i = 0
    j = 0
    for k in range(left, right):
     
        global idx
        
        if( L[i] <= R[j] ):
            a[k] = L[i]
            i += 1
        else:
            a[k] = R[j]
            j += 1
            idx += mid - left - i

def merge_sort(a, left, right):
    if( left + 1 < right ):
        mid = (left + right) // 2 
        merge_sort(a, left, mid)
        merge_sort(a, mid, right)
        merge(a, left, mid, right)


INF = 1000000000
idx = 0
n = int(input())
a = [int(i) for i in input().split()]
merge_sort(a,0,len(a))
print(idx)






Measured memory_bytes: 27472
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

def factorization(n):
    #arr = []
    #arr = defaultdict(int)
    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])
            arr[i] += cnt

    if temp!=1:
        #arr.append([temp, 1])
        arr[temp] += 1

    if arr==[]:
        #arr.append([n, 1])
        arr[n] += 1

    return arr

N =ii()
arr = defaultdict(int)

for i in range(1, N+1):
    factorization(i)

cnt = [0]*100

for key, value in arr.items():
    cnt[1] += 1
    cnt[value+1] += -1

cnt = list(accumulate(cnt))

ans = 0
#print(arr)
#print(cnt)
if cnt[4] > 1:
    #ans += cnt[4] * (cnt[2]-1) * (cnt[2]-2) // 2
    #ans += (cnt[2]-1) * (cnt[2]-2) // 2
    #ans = cnt[2] * (cnt[2]-1) // 2
    #ans += (cnt[2]-2)
    #ans += cnt[4] * (cnt[4]-1) // 2 * (cnt[2]-cnt[4])
    #ans += cnt[4] * (cnt[4]-1) * (cnt[4]-2) // 6
    ans += cnt[4] * (cnt[4]-1) // 2 * (cnt[2]-2)

if cnt[24]:
    #ans += (cnt[2]-1)
    #ans += cnt[24] * (cnt[24]-1) // 2 + cnt[24] * (cnt[2] - cnt[24])
    ans += cnt[24] * (cnt[2] - 1)
if cnt[14]:
    #ans += (cnt[4]-1)
    #ans += cnt[14] * (cnt[14]-1) // 2 + cnt[14] * (cnt[4] - cnt[14])
    ans += cnt[14] * (cnt[4] - 1)
if cnt[74]:
    ans += cnt[74]

print(ans)

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

int main()
{
 	 string x;
  	cin >> x;
  	int n;
  	n = x.length();
    if (x[n-1] == 's')
    {
      x[n] = 'e';
      x[n+1] = 's';
    }
    else
    {
      x[n] = 's';
    }
  int y;
  y = 0;
  while ( x[y]!=0)
  {
   	cout << x[y];
    y++;
  }
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n)  FOR(i,0,n)

int cmp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}
int main() {
	int n, a[100000];
	scanf("%d",&n);
	REP(i,n) scanf("%d",&a[i]);
	qsort(a, n, sizeof(int), cmp);
	int now = a[0], sum = 0, ans = 0;
	REP(i,n) {
		if(a[i] == now) {
			sum++;
		} else {
			if(sum < now) ans += sum;
			if(sum > now) ans += sum - now;
			sum = 1;
		}
		now = a[i];
	}
	if(sum < now) ans += sum;
	if(sum > now) ans += sum - now;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

class UnionFind {
  vector<int> par, rank, potential;
public:
  UnionFind(int n) {
    par.resize(n, -1);
    rank.resize(n, 0);
    potential.resize(n, 0);
  }
  int root(int x) {
    if (par[x] < 0)
      return x;
    int r = root(par[x]);
    potential[x] += potential[par[x]];
    return par[x] = r;
  }
  int size(int x) {
    return -par[root(x)];
  }
  int weight(int x) {
    root(x);
    return potential[x];
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y, int w = 0) {
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if (x == y) {
      return false;
    }
    if (rank[x] < rank[y]) {
      swap(x, y);
      w = -w;
    }
    if (rank[x] == rank[y])
      rank[x]++;
    par[x] += par[y];
    par[y] = x;
    potential[y] = w;
    return true;
  }
  int diff(int x, int y) {
    return weight(y) - weight(x);
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> k(n);
  vector<vector<int>> l(n);
  rep(i, n) {
    cin >> k[i];
    l[i].resize(k[i]);
    rep(j, k[i]) {
      cin >> l[i][j];
      l[i][j]--;
    }
  }
  UnionFind uf(n);
  vector<int> idx(m, -1);
  rep(i, n) {
    rep(j, k[i]) {
      if (idx[l[i][j]] < 0)
        idx[l[i][j]] = i;
      else
        uf.unite(i, idx[l[i][j]]);
    }
  }
  if (uf.size(0) == n)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 7680
import java.util.*;

public class Main {
    public static void main(String args[]) {
        int N, T;
        int min = 9999;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        T = scanner.nextInt();
        for (int i = 1; i <= N; i++) {
            int c = scanner.nextInt();
            int t = scanner.nextInt();
            if (t <= T) {
                if (c < min) {
                    min = c;
                }
            }
        }
        if (min == 9999) {
            System.out.println("TLE");
        } else {
            System.out.println(min);
        }
    }
}

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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define FORR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
	int n; cin >> n;
	cout << n << ":";

	int t = n, checked = 1;
	for( int i = 2; i * i <= n; i++ ) {
		while( t % i == 0 ) {
			cout << " " << i;
			t /= i;
		}
	}
	if( t != 1 ) cout << " " << t;
	cout << endl;
	
}




Measured memory_bytes: 3096
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c;
    
    scanf("%d %d %d",&a,&b,&c);
    
    if( a==b+c || b==a+c || c==a+b ){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

const int MOD = 1e9 + 7;

ll powmod(ll a, int p) {
	ll r = 1;
	while (p > 0) {
		if (p&1) r = (r * a) % MOD;
		a = (a * a) % MOD;
		p /= 2;
	}
	return r;
}

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int x, y;
	scanf("%d%d", &x, &y);

	if ((2*y - x) % 3 != 0 || (2*x - y) % 3 != 0) {
		puts("0");
		return 0;
	}
	int a = (2*y - x) / 3;
	int b = (2*x - y) / 3;
	if (a < 0 || b < 0) {
		puts("0");
		return 0;
	}

	ll n = 1, m = 1;
	for (int i = 0; i < a; i++) {
		n = (n * (a + b - i)) % MOD;
		m = (m * (i+1)) % MOD;
	}

	m = powmod(m, MOD - 2);
	ll answer = (n * m) % MOD;
	printf("%lld\n", answer);
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a,b;
    char s[10];

    scanf("%d%d", &a, &b);
    scanf("%s", s);

    int x = a+b+1;
    for (int i = 0; i < x; i++){
        if ((i < a && '0' <= s[i] && s[i] <= '9') ||
            (i > a && '0' <= s[i] && s[i] <= '9') ||
            (i == a && '-' == s[i])){}
        else {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 128
//By Zank100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define din(t) long long t;cin>>t;
#define in(t) cin>>t;

int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	din(l);
	double a=1,f=(a/3),b=2,g=b/3,p;
	if(l==1)p=(a/3)*(a/3)*(a/3);
	else if(l==2)p=(b/3)*(b/3)*(b/3);
	else if(l%3==0)p=(l/3)*(l/3)*(l/3);
	else{
	    ll x=l%3;
	    if(x==1)p=(l/3+f)*(l/3+f)*(l/3+f);
	    else p=(l/3+g)*(l/3+g)*(l/3+g);
	}
	printf("%lf \n",p);
	return 0;
}


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

using namespace std;
#define ll long long int
ll countDivisors(ll n)
{
    ll cnt = 0;
    for (ll i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            // If divisors are equal,
            // count only one
            if (n / i == i)
                cnt++;

            else // Otherwise count both
                cnt = cnt + 2;
        }
    }
    return cnt-1;
}
int main()
{
    ll n;
    cin >> n;
    if(n==2){
        cout << 1 << endl;
        return 0;
    }
    ll ans1 = countDivisors(n-1);
    ll cnt = 0;
    for(ll i = 2;i*i<=n;i++){
        if (n%i == 0)
        {
            // If divisors are equal, print only one
            if (n/i == i) {
                ll x = n, y = i;
                while(x%y==0){
                    x = x/y;
                }
                if(x%y==1) cnt++;
            }

            else {
                ll x = n, y = i;
                while(x%y==0){
                    x = x/y;
                }
                if(x%y==1) cnt++;
                x = n, y = n/i;
                while(x%y==0){
                    x = x/y;
                }
                if(x%y==1) cnt++;
            }
        }
    }

    cout << cnt+ans1+1 << endl;
}


Measured memory_bytes: 256
n = gets.to_i
zoro = 0
n.times {|i|
  d1,d2 = gets.chomp.split(" ").map(&:to_i)
  if d1 == d2 then 
    zoro = zoro + 1
    if zoro == 3 then
      puts "Yes"
      exit
    end
  else
    zoro = 0
  end
}
puts "No"

Measured memory_bytes: 14308
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        string st=std::to_string(i);
        int cnt=0;
        for(int i=0;i<st.size();i++){
            if(st[i]=='3') cnt++;
        }
        if(cnt>=1||i%3==0) cout<<' '<<i;
    }
    cout<<endl;
}


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

int main() {
    int n;
    int temp;
    cin >> n;
    vector<int> a(n + 1, 0);
    for (int i = 0; i < n - 1; i++) {
        cin >> temp;
        a.at(temp)++;
    }
    for (int i = 1; i < n + 1; i++) {
        cout << a.at(i) << endl;
    }
}

Measured memory_bytes: 4052
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Line 
{
	int height;
	int from;
	int to;

	bool operator<( const Line& right ) const {
		return height < right.height;
	}
};

int main() 
{
	int N,M,A;

	while(cin >> N >> M >> A)
	{

		if(N==0 && M==0 && A==0){ break; }

		vector<Line> lines(M);

		vector<int> amida(N+1,0);
		rep(i,amida.size()){amida[i] = i;}

		if(M!=0)
		{
			int H,P,Q;
			rep(i,M)
			{
				cin >> H >> P >> Q;
				lines[i] = {H,P,Q};
			}

			sort(ALL(lines));

			rep(i,M)
			{
				int p = lines[i].from;
				int q = lines[i].to; 
				swap(amida[p], amida[q]);
			}
		}
		cout << amida[A] << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>

int A[30];
using namespace std;
int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0;i < s.length();i++){
		int t = 0;
		for(int j = 0;j <= i;j++){
			A[s[j] - 'a'] = 1;
		}
		for(int j = i + 1;j < s.length();j++){
			if(A[s[j] - 'a']) t++,A[s[j] - 'a'] = 0;
		}
		ans = max(t,ans);
		memset(A,0,sizeof(A));
	}
	cout << ans;
	return 0;
} 

Measured memory_bytes: 256
//****************************//
/**********  main *************/
//****************************//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())


int main() {

	std::cin.tie(0);

	string s ;
	cin >> s;

	string tmp ;
	int i;
	int len =0;
	len = s.size();

	if(len % 2 != 0){
		cout << "No" << endl;
		return 0;
	}

	for(i=0;i<len/2;i++){
		tmp = tmp + "hi";
	}

	(tmp == s) ? (cout << "Yes") :(cout << "No");

    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc131/tasks/abc131_c
#include <bits/stdc++.h>
using namespace std;

long long get_gcd(long long a, long long b){
  if (b>a)
    swap(a, b);
  if (b == 0)
      return a;
  return get_gcd(b, a % b);
}

long long get_lcm(long long a, long long b){
  return a * b / get_gcd(a, b);
}


int main(void){
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  long long C_n = B / C - (A-1) / C;
  long long D_n = B / D - (A-1) / D;
  long long lcm = get_lcm(C, D);
  long long lcm_n = B / lcm - (A-1) / lcm;

  cout << B - (A-1) - (C_n + D_n - lcm_n) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <set>
using namespace std;

struct NODE {
	int id;
	int degree;
	int parent;
	int depth;
	vector<int> child;
};


int main() {
	vector<NODE> node;
	int n;
	int i,j;
	int id,k;
	scanf("%d",&n);
	node.resize(n);
	for(i=0; i<n; ++i) {
		scanf("%d%d",&id,&k);
		node[id].parent=-1; // default
		node[id].depth=0;   // default
		if(0==(node[id].degree=k)) {
			continue;
		}
		node[id].child.resize(k);
		for(j=0; j<k; ++j) {
			scanf("%d",&node[id].child[j]);
		}
	}
	for(i=0; i<n; ++i) {
		if((k=node[i].degree)==0) continue;
		for(j=0; j<k; ++j) {
			node[node[i].child[j]].parent=i;
		}
	}
	for(i=0; i<n; ++i) {
		j=i;
		while(node[j].parent!=-1){
			j=node[j].parent;
			++node[i].depth;
		}
	}
	for(i=0; i<n; ++i) {
		if(node[i].parent==-1) {
			printf("node %d: parent = %d, depth = %d, root, [",i,node[i].parent,node[i].depth);
			for(j=0; j<node[i].degree-1; ++j) {
				printf("%d, ",node[i].child[j]);
			}
			if(node[i].degree!=0) {
				printf("%d",node[i].child[j]);
			}
			printf("]\n");
		} else if(node[i].degree==0) {
			printf("node %d: parent = %d, depth = %d, leaf, [",i,node[i].parent,node[i].depth);
			for(j=0; j<node[i].degree-1; ++j) {
				printf("%d, ",node[i].child[j]);
			}
			if(node[i].degree!=0) {
				printf("%d",node[i].child[j]);
			}
			printf("]\n");
		} else {
			printf("node %d: parent = %d, depth = %d, internal node, [",i,node[i].parent,node[i].depth);
			for(j=0; j<node[i].degree-1; ++j) {
				printf("%d, ",node[i].child[j]);
			}
			if(node[i].degree!=0) {
				printf("%d",node[i].child[j]);
			}
			printf("]\n");
		}
	}
	return 0;
}

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

using namespace std;
typedef pair<int, int> P;

int ar[100000];

bool f = false;

int main() {
	while (1) {
		int n, k;
		cin >> n >> k;
		if (n == 0 && k == 0)break;
		f = false;
		for (int i = 0; i < k; i++) {
			cin >> ar[i];
			if (ar[i] == 0)f = true;
		}

		sort(ar, ar + k);

		vector<P> v;
		int length = 1, before = ar[0];
		if (f)before = ar[1];
		for (int i = (!f ? 1 : 2); i < k; i++) {
			if (ar[i] == ar[i - 1] + 1)length++;
			else {
				v.push_back(P(before, length));
				before = ar[i], length = 1;
			}
		}
		v.push_back(P(before, length));

		if (!f) {
			int ans = 0;
			for (int i = 0; i < v.size(); i++) {
				ans = max(ans, v[i].second);
			}
			cout << ans << endl;
		}
		else {
			int ans = 0;
			if (v.size() == 1) {
				cout << v[0].second + 1 << endl;
				return 0;
			}
			for (int i = 0; i < v.size() - 1; i++) {
				if (v[i].first + v[i].second + 1 == v[i + 1].first) {
					ans = max(ans, v[i].second + v[i + 1].second + 1);
				}
			}
			cout << ans << endl;
		}

	}
	return 0;
}

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

int main() 
{
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    
    int ans = A+B+C;
    int sum = max({A,B,C});
    ans -= sum;

    for (int i = 0; i < K; i++) {
        sum *= 2;
    }
    cout << ans + sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	//AGC ACG GAC AxGC AGxC
	vector<vector<vector<vector<lint>>>> DP(N + 1, vector<vector<vector<lint>>>(5, vector<vector<lint>>(5, vector<lint>(5, 0))));
	//vector<vector<vector<int>>> DP(5, vector<vector<int>>(5, vector<int>(5, 0)));
	DP[0][0][0][0] = 1;

	for (int i = 0; i < N; i++)
	{
		for (int current = 1; current < 5; current++)
		{
			for (int b1 = 0; b1 < 5; b1++)
			{
				for (int b2 = 0; b2 < 5; b2++)
				{
					if (current == 1 && b1 == 2 && b2 == 3)
						continue;
					if (current == 1 && b1 == 3 && b2 == 2)
						continue;
					if (current == 2 && b1 == 1 && b2 == 3)
						continue;

					for (int b3 = 0; b3 < 5; b3++)
					{
						if (current == 1 && b2 == 2 && b3 == 3)
							continue;
						if (current == 1 && b1 == 2 && b3 == 3)
							continue;
						DP[i + 1][current][b1][b2] += DP[i][b1][b2][b3];
						DP[i + 1][current][b1][b2] %= INV;
					}
				}
			}
		}
	}

	int ans = 0;
	for (int current = 0; current < 5; current++)
	{
		for (int b1 = 0; b1 < 5; b1++)
		{
			for (int b2 = 0; b2 < 5; b2++)
			{
				ans += DP[N][current][b1][b2];
				ans %= INV;
			}
		}
	}

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) max_element(x.begin(),x.end())
#define MIN(x) min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//fixed<<setprecision(15);
signed main(){
    /*
    int n,y; cin >> n >> y;
    for(int i=0; i<=y/10000; i++){
        for(int j=0; j<=(y-10000*i)/5000; j++){
            if((i*10000+j*5000+(n-i-j)*1000)==y){
                cout<<i<<' '<<j<<' '<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
    */
   int n; cin >> n;
   set<int> set;
   rep(i,n){
       int temp; cin >> temp;
       set.insert(temp);
   }
   cout<<set.size()<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],b[1000005],sum_bd,sum_sau,i,du;
int main(){
  cin>>n;
  for(i=1;i<=n+1;i++) {cin>>a[i];sum_bd+=a[i];}
  for(i=1;i<=n;i++) cin>>b[i];
  for(i=1;i<=n;i++){
    du=0;
    if(b[i]>=a[i]) {du=b[i]-a[i];a[i]=0;}
    else {a[i]=a[i]-b[i];continue;}
    if(du>=a[i+1]) {a[i+1]=0;continue;}
     else {a[i+1]=a[i+1]-du;}
}
  for(i=1;i<=n+1;i++) sum_sau+=a[i];
 // for(i=1;i<=n+1;i++) cout<<a[i]<<" ";   
  cout<<sum_bd-sum_sau;
  return 0;
}

Measured memory_bytes: 3456
import Data.List

main = interact $ show.s.tail.words

s::[[Char]]->Int
s as = foldl1 (+) $ (map c.f.sort.map sort) as
f::[[Char]]->[Int]
f (_:[]) = 1:[]
f (s:ss)
    | s==head ss = (1+h):hs
    | otherwise = 1:h:hs
    where h:hs = f ss
c::Int->Int
c n = div (n*(n-1)) 2


Measured memory_bytes: 112892
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

now = 100
ans = 0
X = Int()

while now < X:
    now = int(1.01*now)
    ans += 1
print(ans)

Measured memory_bytes: 63616
#include<iostream>
#include<string>
#include <bits/stdc++.h>
#include<vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <math.h>
#include <iomanip>
using namespace std;
using ll = long long;

int main(){
  int x[6],i;
  for(i=1;i<=5;i++){
    cin >> x[i];
    if(x[i] == 0){
      cout << i << endl;
    }
  }

}


Measured memory_bytes: 3652
import java.util.*;

public class Main {
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		while(true)
		{
			String mes = sc.nextLine();
			if(mes.compareTo(".") == 0) break;
			int count = 0;
			boolean check = true;
			char kakko[] = new char[mes.length()];
			for(int i = 0;i < mes.length();i++)
			{
				char s = mes.charAt(i);
				if(s == '(' || s == '[')
				{
						kakko[count] = s;
						count+= 1;
				}
				else if(s == ']' || s == ')')
				{
					if(count == 0)
					{
						check = false;
						break;
					}
					char s1 = kakko[count - 1];
					if(s == ')')
					{
						//kakko[count - 1] = (Character) null;
						count -= 1;
						//System.out.println(s + ":" + s1);
						if(s1 != '(') check = false;
					}
					else
					{
						//kakko[count - 1] = (Character) null;
						count -= 1;
						//System.out.println(s + ":" + s1);
						if(s1 != '[') check = false;
					}
				}
			}
			if(count != 0) check = false;
			if(check == true) System.out.println("yes");
			else System.out.println("no");
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define ull unsigned long long int
#define ll long long
#define vi vector<int>
#define mii map<int,int>
#define all(x) x.begin(),x.end()
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define MOD 1e9+7
#define INF 0x3f3f3f3f
//#define show(x) cerr<<x#<<" "<<x<<"\n";

//typedef tree<pair<int,int>,null_type, 
//less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("O3")
//uncoment for large int requirement

//using boost::multiprecision::cpp_int;
//using namespace _gnu_pbds;
using namespace std;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main()
{
ll n;
cin>>n;
string s;
map<string,int> u;
u["AC"]=0;
u["WA"]=0;
u["TLE"]=0;
u["RE"]=0;
for(int  i = 0 ;i<n ; i++)
cin>>s,u[s]++;

cout<<"AC"<<" x "<<u["AC"]<<endl;
cout<<"WA"<<" x "<<u["WA"]<<endl;
cout<<"TLE"<<" x "<<u["TLE"]<<endl;
cout<<"RE"<<" x "<<u["RE"]<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string str;
  int N, K;
  cin>>N>>K;
  cin>>str;

  str[K-1] = tolower(str[K-1]);
  cout<<str<<endl;
  

  return 0;
}


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

public class Main {
    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;
        }
    }

    static FastReader sc = new FastReader();
    static final double E = 0.000000001;
    static final long MOD = (long) (1e9 + 7);
    static final long MAX = (long) 1e9;

    public static void main(String[] args) throws IOException {
        int n = sc.nextInt();
        int[] arr = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            arr[sc.nextInt()] = i;
        }
        for (int i = 0; i <arr.length ; i++) {
            if(arr[i]!=0)
                System.out.print(arr[i] + " ");
        }


    }


}


Measured memory_bytes: 43784
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const ll INF = 0x3f3f3f3f;

void add(ll &x, ll y)
{
    x+=y;
    if(x>=mod)
    {
        x-=mod;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("A.txt", "r", stdin);
    #endif
    int n, c=0;
    cin >> n;
    for(int i=1;;i++)
    {
        c+=i;
        if(c>=n)
        {
            cout << i;
            break;
        }
    }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, X) = readLine()!!.split(" ").map { it.toLong() }
    val x = readLine()!!.split(" ").map { it.toLong() - X }

    if (x.size == 1) {
        val first = Math.abs(x.first())
        println(first)
        return
    }

    val GCD = x.reduce { acc, i -> gcd(acc, i)  }
    println(Math.abs(GCD))
}



fun gcd(a: Long, b: Long): Long {
    if (b == 0L) return a
    return gcd(b, a % b)
}



Measured memory_bytes: 51748
use std::collections::{BTreeMap, BTreeSet, VecDeque};

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut x: Vec<u64> = vec![];
    let mut y: Vec<u64> = vec![];
    for _ in 0..n {
        x.push(sc.read());
        y.push(sc.read());
    }

    let sx = x
        .iter()
        .cloned()
        .collect::<BTreeSet<_>>()
        .into_iter()
        .enumerate()
        .map(|(i, v)| (v, i))
        .collect::<BTreeMap<_, _>>();
    let sy = y
        .iter()
        .cloned()
        .collect::<BTreeSet<_>>()
        .into_iter()
        .enumerate()
        .map(|(i, v)| (v, i))
        .collect::<BTreeMap<_, _>>();

    let mut graph = vec![vec![]; sx.len() + sy.len()];
    for i in 0..n {
        let x = *sx.get(&x[i]).unwrap();
        let y = *sy.get(&y[i]).unwrap() + sx.len();
        graph[x].push(y);
        graph[y].push(x);
    }

    let mut color = vec![0; sx.len() + sy.len()];
    let mut cur = 1;
    for t in 0..color.len() {
        if color[t] != 0 {
            continue;
        }

        let mut q = VecDeque::new();
        q.push_front(t);
        color[t] = cur;
        while let Some(v) = q.pop_front() {
            for &next in graph[v].iter() {
                if color[next] == 0 {
                    q.push_back(next);
                    color[next] = cur;
                }
            }
        }
        cur += 1;
    }

    let mut count = vec![(0, 0); cur];
    for (i, color) in color.into_iter().enumerate() {
        if i < sx.len() {
            count[color].0 += 1;
        } else {
            count[color].1 += 1;
        }
    }

    let mut all = 0;
    for (x, y) in count.into_iter() {
        all += x * y;
    }
    println!("{}", all - n);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 16636
#include <bits/stdc++.h>
 
using namespace std;
#define int long long
const int MAX = 2001;
const int MOD = 1000000007;
 
 

 
signed main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int ans[n],al=0,ax=0;
    for(int i=0;i<n;i++)ax+=a[i];
    ax/=2;
    for(int i=0;i<n;i+=2)al+=a[i];
    for(int i=0;i<n;i++){
        ans[(i*2)%n]=al-ax;
        al-=a[(i*2)%n];
        al+=a[(i*2+1)%n];
    }
    for(int i=0;i<n;i++){
        cout<<ans[i]*2<<' ';
    }

    return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
        FastIO
        string s[3];
       	for(int i=0;i<3;i++)
       	{
       		cin>>s[i];
       		s[i][0]=(char)s[i][0]-'a'+'A';
       	}
       	cout<<s[0][0]<<s[1][0]<<s[2][0];
       	return 0;
       }

Measured memory_bytes: 256