akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

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

int main(){
    char judge;
    cin>>judge;
    if(judge=='A'){
        cout<<'T'<<endl;
    }
    else if(judge=='G'){
        cout<<'C'<<endl;
    }
    else if(judge=='T'){
        cout<<'A'<<endl;
    }
    else {
        cout<<'G'<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma push_macro("long")
#undef long
#ifdef _WIN32
inline unsigned int __builtin_ctz(unsigned int x) { unsigned long r; _BitScanForward(&r, x); return r; }
inline unsigned int __builtin_clz(unsigned int x) { unsigned long r; _BitScanReverse(&r, x); return 31 - r; }
inline unsigned int __builtin_ffs(unsigned int x) { unsigned long r; return _BitScanForward(&r, x) ? r + 1 : 0; }
inline unsigned int __builtin_popcount(unsigned int x) { return __popcnt(x); }
#endif // _WIN32
#pragma pop_macro("long")
#endif // _MSC_VER
/*---------------------------------------------------------------------------------------------------
????????????????????????????????? ??§?????§  
??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!
???????????? ??? ?´_???`??????/??? ???i     
?????????????????????????????? ???  |???|     
????????? /?????? /??£??£??£??£/??????|  
??? ???_(__??????/???    ???/ .| .|????????????  
??? ????????????/????????????/??????u??????  
---------------------------------------------------------------------------------------------------*/
 


int M, X[20], Y[20];
int dp1[1 << 16];
vector<pair<int, int>> dp2[1 << 16];
int dp3[1 << 16];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> M;
    rep(i, 0, M) cin >> X[i] >> Y[i];

    dp1[0] = 1;
    rep(a, 0, M) rep(b, a + 1, M) {
        int msk = (1 << a) + (1 << b);
        dp1[msk] = 1;
        dp2[msk].push_back({X[b] - X[a], Y[b] - Y[a]});
    }

    rep(msk, 0, 1 << M) {
        if (__builtin_popcount(msk) % 2 == 1) continue;
        if (__builtin_popcount(msk) <= 3) continue;
        rep(a, 0, M) if (msk & (1 << a)) rep(b, a + 1, M) if (msk & (1 << b)) {
            int nmsk = msk - (1 << a) - (1 << b);
            if (!dp1[nmsk]) continue;
            
            int dx = X[a] - X[b];
            int dy = Y[a] - Y[b];

            fore(p, dp2[nmsk]) {
                if (dx * p.second == dy * p.first) {
                    dp1[msk] = 1;
                    dp2[msk].push_back(p);
                }
            }
        }
    }

    rep(msk, 0, 1 << M) if(dp1[msk]) {
        int c = __builtin_popcount(msk)/ 2;
        dp3[msk] = c * (c - 1) / 2;
    }

    rep(msk, 0, 1 << M) {
        for (int i = msk; i >= 0; i--) {
            i &= msk;

            dp3[msk] = max(dp3[msk], dp3[i] + dp3[msk - i]);
        }
    }

    int ans = dp3[(1 << M) - 1];
    cout << ans << endl;
}

Measured memory_bytes: 5956
n = int(input())
ans = {}
for i in range(n):
  tmp = input()
  if tmp in ans:
    ans[tmp] += 1
  else:
    ans[tmp] = 1
    
s = []
m = max(ans.values())
for i in ans.keys():
  if ans[i] == m:
    s.append(i)
[print(i) for i in sorted(s)]



Measured memory_bytes: 35096
#!/usr/bin/env python3
n = int(input())
s = input()
c = 0
for i in range(10):
    for j in range(10):
        a = s.find(str(i))
        if a > -1:
            b = s.find(str(j), a + 1)
            if b > -1:
                c += len(set(s[b + 1:]))
print(c)


Measured memory_bytes: 9232
import java.util.Scanner;

//Patrol
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int[] a = new int[101];
			while(true){
				int s = sc.nextInt();
				int t = sc.nextInt();
				if((s|t)==0)break;
				a[s]++;
				a[t]++;
			}
			int o = 0;
			for(int s:a)if(s%2==1)o++;
			System.out.println(o!=2?"NG":a[1]%2==1&&a[2]%2==1?"OK":"NG");
		}
	}
}

Measured memory_bytes: 32204
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>

using namespace std;


int main()
{
	int a = 0;
	int b = 0;

	cin >> a;
	cin >> b;

	if (a*b == 15) {
		cout << "*" << endl;
	}
	else if(a+b == 15){
		cout << "+" << endl;
	}
	else{
		cout << "x" << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000002




int main(){

	int N;
	cin>>N;
	
	long long A,B;
	cin>>A>>B;
	
	vector<int> P(N);
	for(int i=0;i<N;i++)cin>>P[i];
	P.insert(P.begin(),0);
	P.push_back(N+1);
	
	vector<long long> dp(P.size(),Inf);
	dp[0] = 0LL;
	
	for(int i=1;i<P.size();i++){
		long long t = 0LL;
		for(int j=i-1;j>=0;j--){
			if(P[j]>P[i]){
				t += A;
			}
			else{
				dp[i] = min(dp[i],dp[j]+t);
				t += B;
			}
		}
	}
	cout<<dp.back()<<endl;
	return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  string s;
  while (cin >> s && s != "#") {
    int64 w = 0, h = 0;
    REP(i, s.size()) {
      if (s[i] == '/') {
        h++;
        w = 0;
      } else {
        if (s[i] == 'b') w++;
        else w += s[i]-'0';
      }
    }
    vector<vector<int64>> f(h+1, vector<int64>(w, 0));
    h = 0; w = 0;
    REP(i, s.size()) {
      if (s[i] == '/') {
        h++;
        w = 0;
      } else {
        if (s[i] == 'b') {
          f[h][w++] = 1;
        } else {
          w += s[i]-'0';
        }
      }
    }
    int64 a, b, c, d;
    cin >> a >> b >> c >> d; a--; b--; c--; d--;
    f[a][b] = 0;
    f[c][d] = 1;
    string res = "";
    int64 cnt = 0;
    REP(i, f.size()) {
      REP(j, f[i].size()) {
        if (f[i][j] == 1) {
          if (cnt != 0)
            res += (char)('0'+cnt);
          res += 'b';
          cnt = 0;
        } else {
          cnt++;
        }
      }
      if (cnt > 0) res += (char)('0'+cnt);
      cnt = 0;
      if (i < f.size()-1)
        res += '/';
    }
    cout << res << endl;
  }
}


Measured memory_bytes: 3192
def f(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3 * n + 1


s = int(input())

a = []
a.append(s)

i = 1
while True:
    a.append(f(a[i-1]))
    if a[i] in a[:-2]:
        break
    i += 1

print(i + 1)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String... args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    String S = scan.next();    
    System.out.println(S.substring(0,N/2).equals(S.substring(N/2,N)) ? "Yes" : "No");
  }
}

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

using namespace std;

int main(){
    int a,b;
    char op;
    while(1){
        cin >> a >> op >> b;
        if(op=='?'){
            break;
        }
        switch(op){
            case '+':
                cout << a+b << endl;
                break;
            case '-':
                cout << a-b << endl;
                break;
            case '*':
                cout << a*b << endl;
                break;
            case '/':
                cout << a/b << endl;
            default:
                break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long n;
bool check(long long x)
{
	long long m=x-1;
	return (m+1)*(n/m)==n;
}
int main()
{
	scanf("%lld",&n);
	long long ans=0;
	for(long long i=2;i<=sqrt(n);i++)
		if(n%i==0)
		{
			if(check(i)) ans+=i-1;
			if(i*i!=n&&check(n/i)) ans+=n/i-1;
		}
	if(n!=1&&check(n)) ans+=n-1;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3776
N = int(input())
p = list(map(int, input().split()))
cnt = 0

for i in range(1, N - 1):
    if p[i] > p[i -1] and p[i] < p[i + 1]:
        cnt += 1
    elif p[i] < p[i - 1] and p[i] > p[i + 1]:
        cnt += 1

print(cnt)


Measured memory_bytes: 38384
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int H, A;
	cin >> H >> A;

	int ans = H / A;

	if (H % A != 0) {
		ans++;
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, m;
    cin >> n >> m;
    vector<int> pow2(6);
    pow2[0] = 1;
    for(int i = 1; i <= 5; ++i) pow2[i] = pow2[i-1] * 2;
    cout << (100 * (n - m) + 1900 * m) * pow2[m] << endl;
}

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

int main()
{
  int N,M;
  int tmp1,tmp2,ans=0;
  cin >> N>>M;
  vector <int>tenbo(N);
  vector <int>maxh(N);
  for (int i=0;i<N;i++){
    cin >> tenbo.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> tmp1>>tmp2;
    maxh.at(tmp1-1)=max(tenbo.at(tmp2-1),maxh.at(tmp1-1));
    maxh.at(tmp2-1)=max(tenbo.at(tmp1-1),maxh.at(tmp2-1));
  }
  for(int i=0;i<N;i++){
    if(tenbo.at(i)>maxh.at(i))
      ans++;
  }
  cout << ans<<endl;
}

Measured memory_bytes: 4020
#include <bits/stdc++.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map> // ヘッダファイルインクルード

using namespace std;
int main()
{
  long long int N, Q;
  vector<long long int> a_v, b_v, c_v;
  map<int, int> num_m;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    long long int a;
    cin >> a;
    a_v.push_back(a);
    num_m[a]++;
  }
  cin >> Q;
  for (int i = 0; i < Q; i++)
  {
    long long int B, C;
    cin >> B >> C;
    b_v.push_back(B);
    c_v.push_back(C);
  }
  // cout << "dict" << endl;
  // for (auto itr = num_m.begin(); itr != num_m.end(); ++itr)
  // {
  //   std::cout << "key = " << itr->first             // キーを表示
  //             << ", val = " << itr->second << "\n"; // 値を表示
  // }
  long long int sum = 0;
  for (auto itr = num_m.begin(); itr != num_m.end(); ++itr)
  {
    sum += itr->first * itr->second;
  }
  // cout << sum << endl;
  auto num_m_tmp = num_m;
  for (long long int i = 0; i < Q; i++)
  {
    num_m_tmp[c_v[i]] += num_m_tmp[b_v[i]];
    sum -= num_m_tmp[b_v[i]] * b_v[i];
    sum += num_m_tmp[b_v[i]] * c_v[i];
    num_m_tmp[b_v[i]] = 0;
    // for (auto itr = num_m_tmp.begin(); itr != num_m_tmp.end(); ++itr)
    // {
    //   std::cout << "key = " << itr->first             // キーを表示
    //             << ", val = " << itr->second << "\n"; // 値を表示
    // }

    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 12912
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

int N,W;
ll v[110];
ll w[110];

ll dp[110][110000] = {0};

int main()
{
	cin >> N >> W;
	for(int i = 0; i < N; i++) cin >> w[i] >> v[i];

	for(int i = 0; i < N; i++)
	{
		for(int sum_w = 0; sum_w <= W; sum_w++)
		{
			if(sum_w - w[i] >= 0)
			{
				chmax(dp[i + 1][sum_w],dp[i][sum_w - w[i]] + v[i]);
			}
			chmax(dp[i+1][sum_w],dp[i][sum_w]);
		}
	}
	cout << dp[N][W] << endl;
}

Measured memory_bytes: 87424
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/arc081/tasks/arc081_b
# D - Coloring Dominoes
"""
need to consider the case that ticket is not enough to lower everything
"""


def calc(num):
    return num**3


N = gi()
K = gi()

num = N // K
ans = calc(num)

if (K % 2 == 0):
    if N % K >= K // 2:
        num += 1
    ans += calc(num)

print(ans)


Measured memory_bytes: 21772
N = int(input())
P = list(map(int, input().split()))
ans = 1
dp = [0 for i in range(N + 1)]
dp[0] = P[0] # min
for i in range(N - 1):
    if P[i + 1] <= dp[i]:
        ans += 1
        dp[i + 1] = P[i + 1]
    else:
        dp[i + 1] = dp[i]

print(ans)


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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL A[200011];

bool ok(int mid) {
    vector<pair<int, LL> > cur;
    cur.emplace_back(1, A[0]);

    for (int i=1; i<N; i++) {
	if (A[i-1] < A[i]) {
	    LL add = A[i] - A[i-1];
	    if (cur.back().first == 1) cur.back().second += add;
	    else cur.emplace_back(1, add);
	} else {
	    LL sub = A[i-1] - A[i];
	    while (sub > 0) {
		LL g = min(sub, cur.back().second);
		cur.back().second -= g;
		sub -= g;
		if (cur.back().second == 0) cur.pop_back();
	    }

	    int len = 0;
	    if (cur.back().first == mid) {
		len = cur.back().second;
		cur.pop_back();
	    }
	    if (cur.empty()) return false;
	    int val = cur.back().first + 1;
	    cur.back().second--;
	    if (cur.back().second == 0) cur.pop_back();

	    if (cur.back().first == val) cur.back().second++;
	    else cur.emplace_back(val, 1);

	    if (len) cur.emplace_back(1, len);
	}
    }

    return true;
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%lld", A+i);

    int lo = 0, hi = N;

    while (hi - lo > 1) {
	int mid = (lo + hi) / 2;
	(ok(mid)? hi: lo) = mid;
    }
    printf("%d\n", hi);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1792
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  m <- readLn
  replicateM_ m $ do
    fps <- f
    n <- readLn
    solve fps <$> replicateM n f >>= print
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> [[Int]] -> Int
solve [x, y, w, h] = length . filter f
  where
    f [cx, cy] = x <= cx && cx <= x + w && y <= cy && cy <= y + h



Measured memory_bytes: 4208
#include<iostream>

using namespace std;

int main(){
    long long x, y, ans = 0;
    cin >> x >> y;
    long long z, t = 1;
    z = y / x;
    while(z >= t){
        t *= 2;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
import sys


def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:]


if __name__ == '__main__':
    S = [c for c in input()]

    waters, S = func(S)

    rev_S = []
    for s in S[::-1]:
        if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

    new_waters, _ = func(rev_S)
    waters += new_waters[::-1]

print(sum(waters))
print(len(waters), *waters)



Measured memory_bytes: 6684
//
// Created by HDawn on 2020/6/30.
//

#include <bits/stdc++.h>

using namespace std;
int n, T;
int a[10010];
int ans;

void Linear_Search(int key) {
    for (int i = 0; i < n; ++i) {
        if (a[i] == key) {
            ans++;
            return;
        }
    }
}


int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cin >> T;
    int b;
    for (int i = 0; i < T; ++i) {
        cin >> b;
        Linear_Search(b);
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

ifstream fi("CARDGAME.INP");
ofstream fo("CARDGAME.OUT");

#define fi cin
#define fo cout

int A,B,a[5010],b[5010],res;

void xuli()
{
    for (int i=1; i<=B; ++i)
    {
        int t=1;
        for (int j=1; j<=A; ++j)
            if (a[j]==b[i+t-1])
            {
                if (i+t>B) break;
                ++t;
            }
        res=max(res,t-1);
    }
    fo<<res<<'\n';
}

int main()
{
    fi>>A>>B;
    for (int i=1; i<=A; ++i) fi>>a[i];
    for (int i=1; i<=B; ++i) fi>>b[i];
    xuli();
}

Measured memory_bytes: 1264
#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>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,ans;
signed main(){
	int a,b;
	cin>>n>>a>>b;
	if(a/n==b/n && a%n!=0 && b%n!=0)cout<<"NG"<<endl;
	else cout<<"OK"<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int mod=1e9+7;
const int MN=1e5+5;
const ll inf=0x3f3f3f3f3f3f3f3f;
int to[MN<<2],nxt[MN<<2],c[MN<<2],h[MN],cnt;
inline void ins(int s,int t,int w){
	to[++cnt]=t;nxt[cnt]=h[s];c[cnt]=w;h[s]=cnt;
	to[++cnt]=s;nxt[cnt]=h[t];c[cnt]=w;h[t]=cnt;
}
ll disS[MN],disT[MN];
int gS[MN],gT[MN];
typedef pair<ll,int>pli;
priority_queue<pli,vector<pli>,greater<pli> >q;
bool vis[MN];
int n,m,S,T,x[MN<<1],y[MN<<1],W[MN<<1];
inline void Dij(ll* dis,int* g,int s){
	memset(dis,0x3f,sizeof(ll)*(n+1));
	memset(vis,0,sizeof(vis));
	dis[s]=0;g[s]=1;q.push(make_pair(0,s));
	while(!q.empty()){
		static pli v;v=q.top();q.pop();
		if(vis[v.second])continue;vis[v.second]=true;
		for(reg int st,i=h[st=v.second];i;i=nxt[i])
			if(dis[to[i]]>dis[st]+c[i])
				dis[to[i]]=dis[st]+c[i],
				q.push(make_pair(dis[to[i]],to[i])),
				g[to[i]]=g[st];
			else if(dis[to[i]]==dis[st]+c[i])g[to[i]]=(g[to[i]]+g[st])%mod;
	}
}
int main(){
	scanf("%d%d%d%d",&n,&m,&S,&T);
	for(reg int i=1,s,t,w;i<=m;i++)
		scanf("%d%d%d",&s,&t,&w),ins(s,t,w),x[i]=s,y[i]=t,W[i]=w;
	Dij(disS,gS,S);Dij(disT,gT,T);
	reg int ans=1ll*gS[T]*gS[T]%mod;
	for(reg int i=1;i<=n;i++)
		if(disS[i]+disT[i]==disS[T]&&disS[i]==disT[i])
			ans=(ans-1ll*gS[i]*gS[i]%mod*gT[i]%mod*gT[i]%mod+mod)%mod;
	for(reg int i=1;i<=m;i++){
		if(disS[x[i]]>=disS[y[i]])swap(x[i],y[i]);
		if(disS[x[i]]+W[i]!=disS[y[i]])continue;
		if(disT[y[i]]+W[i]!=disT[x[i]])continue;
		if(disS[x[i]]+W[i]+disT[y[i]]!=disS[T])continue;
		if(disS[x[i]]+W[i]<=disT[y[i]])continue;
		if(disT[y[i]]+W[i]<=disS[x[i]])continue;
		ans=(ans-1ll*gS[x[i]]*gS[x[i]]%mod*gT[y[i]]%mod*gT[y[i]]%mod+mod)%mod;
	}printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 12276
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100

void push(int);
int pop(void);

int stack[N];
int top = 0;

main(){
  int a, b;
  char string[N];
 
  while(scanf("%s", string) != EOF){
    if(string[0] == '+'){
      a = pop();
      b = pop(); 
      b += a;
      push(b);
    }
    else if(string[0] == '*'){
      a = pop();
      b = pop();
      b *= a;
      push(b);
    }
    else if(string[0] == '-'){
      a = pop();
      b = pop();
      b -= a;
      push(b);    
    }
    else{
      push(atoi(string));
    }
  }
  printf("%d\n", b);
  return 0;
}

void push(int x){
  stack[++top] = x;
}

int pop(void){
  if(top == 0){
    printf("underflow\n");
  }
  else{
    top--;
    return stack[top+1];
  }
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  	int a,v,b,w,t;
  	cin >> a >> v >> b >> w >> t;
  	int sa,sb;
  	sa = abs(a - b);
  	if(v<=w){
      cout << "NO" << endl;
      return 0;
    }
  	sb = v-w;
 
  	if(sa <= (long long)sb * t){
     	cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
 
  	return 0;
}

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

int main(){
	ll a,b,x; cin >> a >> b >> x;
	cout << b/x +1-(a>0?(a-1)/x+1:0)<< endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

int power(int N, int M) {return M ? power(N * N, M / 2) * (M % 2 ? N : 1) : 1;}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N;
    cin >> N;
    vector<int> A(N);
    REP (i, N) {
        cin >> A[i];
    }
    
    REP(i,N) {
        if (A[i] == 0) {
            p(0);
            return 0;
        }
    }

    ans = 1;

    REP(i,N) {
        if (ans > power(10,18)/A[i]) {
            p(-1);
            return 0;
        }
        else ans *= A[i];
    }
    pa;
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 4000
#include<stdio.h>

#define W 3
#define G 1
#define B 2
#define MAX 101

int tim=1, A[MAX][MAX], col[MAX], d[MAX], f[MAX];

void Vis(int u){
  int i;
  col[u] = G;
  d[u] = tim++ ;

  for(i=1 ; A[u][i]!=0 ; i++){
    
    if(col[A[u][i]] == W)Vis(A[u][i]);
  }
  col[u] = B;
  f[u] = tim++;
}

void DFS(n){
  int i;
  for(i=1 ; i<=n ; i++)col[i] = W;
  
  for(i=1 ; i<=n ; i++)if(col[i] == W)Vis(i);
}

int main(){
  int n, u, k, v, i, j;

  scanf("%d",&n);

  for(i=1 ; i<=n ; i++){
    scanf("%d%d", &u, &k);
    A[u][k+1] = 0;
    for(j=1 ; j<=k ; j++){
      scanf("%d",&v);
      A[u][j] = v;
    }
  }

  DFS(n);

  for(i=1 ; i<=n ; i++)printf("%d %d %d\n", i, d[i], f[i]);

  
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<queue>
using namespace std;
struct Point{int x,y,t;};
int main(){
  int t,n,i,j,k,x,y;
  cin >> t >> n;
  while(t!=0||n!=0){
    
    int m[200][200]={{}};
    int dis[200][200]={{}};
    queue <Point> ps;
    Point p,b;
    for(i=0;i<n;i++){
      cin >> x >> y;
      dis[100+x][100+y]=1;
    }
    cin >> p.x  >> p.y;
    p.x+=100;p.y+=100;
    m[p.x][p.y]=1;
    p.t=0;
    ps.push(p);
    int o=0;
    while(!ps.empty()){
      o++;
      p=ps.front();
      ps.pop();
      if(p.t<t){
	if(m[p.x+1][p.y]+dis[p.x+1][p.y]==0){
	  b.x=p.x+1;b.y=p.y;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
	if(m[p.x][p.y+1]+dis[p.x][p.y+1]==0){
	  b.x=p.x;b.y=p.y+1;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
	if(m[p.x+1][p.y+1]+dis[p.x+1][p.y+1]==0){
	  b.x=p.x+1;b.y=p.y+1;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
	if(m[p.x-1][p.y]+dis[p.x-1][p.y]==0){
	  b.x=p.x-1;b.y=p.y;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
	if(m[p.x][p.y-1]+dis[p.x][p.y-1]==0){
	  b.x=p.x;b.y=p.y-1;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
	if(m[p.x-1][p.y-1]+dis[p.x-1][p.y-1]==0){
	  b.x=p.x-1;b.y=p.y-1;b.t=p.t+1;
	  m[b.x][b.y]=1;
	  ps.push(b);
	}
      }
    }
    cout << o << endl;
    //cout << t << endl;
    cin >> t >> n;
  }
}

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

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var abi = new Pair[N];
            var cdi = new Pair[N];
            for (var i = 0; i < N; i++)
            {
                var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                abi[i] = new Pair { X = ab[0], Y = ab[1] };
            }
            for (var i = 0; i < N; i++)
            {
                var cd = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                cdi[i] = new Pair { X = cd[0], Y = cd[1] };
            }
            abi = abi.OrderByDescending(x => x.Y).ToArray();
            cdi = cdi.OrderBy(x => x.X).ToArray();

            var answer = 0;
            var hash = new HashSet<int>();
            for (var i = 0; i < N; i++)
            {
                for (var j = 0; j < N; j++)
                {
                    if (!hash.Contains(j) && abi[i].X < cdi[j].X && abi[i].Y < cdi[j].Y)
                    {
                        answer++;
                        hash.Add(j);
                        break;
                    }
                }
            }

            Console.WriteLine(answer);
        }

        public class Pair
        {
            public int X { get; set; }
            public int Y { get; set; }
        }
    }
}


Measured memory_bytes: 13524
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
const long long INF = 1000000000;
struct  P{
	long long cost, pos;
};
bool operator <(const P& a, const P& b) { 
	return a.cost < b.cost;
}
bool operator >(const P& a, const P& b) { 
	return a.cost > b.cost;
}
struct A{
	long long to,cost;
};
int main() {
	int n, k;
	while (cin >> n >> k&&n != 0 && k != 0) {
		vector<A> a[101];
		for (int i = 0; i < k; i++) {
			int s;
			cin >> s;
			if (s == 0) {
				long long m, t;
				cin >> m >> t;
				long long b[101];for(int i=1;i<=n;i++)b[i]=INF;
				priority_queue<P,vector<P>,greater<P>>p;
				
				b[m]=0;
				p.push(P{0LL,m});
				while(!p.empty()){
					P r=p.top();p.pop();
					int o=r.pos;
					for(int i=0;i<(int)a[o].size();i++){
						if(b[a[o][i].to]>b[o]+a[o][i].cost){
							b[a[o][i].to]=b[o]+a[o][i].cost;
							p.push(P{b[a[o][i].to],a[o][i].to});
						}
					}
				}
				if (b[t] == INF) cout << -1 << endl;
				else cout << b[t] << endl;
			}
			else {
				int moto, to,cost;
				cin >> moto>>to>> cost;
				A q;
				q.to = to;
				q.cost = cost;
				a[moto].push_back(q);
				q.to = moto;
				a[to].push_back(q);
			}
		}
	}
}

Measured memory_bytes: 3128
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int N,K;
const int MAX_N=100;
int plan[MAX_N+1];
int memo[MAX_N+1][4][4];
int solve(int n,int b1,int b2){
	if(n==N+1) return 1;
	if(memo[n][b1][b2]!=-1) return memo[n][b1][b2];
	if(plan[n]!=0){
		if(b1==b2&&b1==plan[n])
			return 0;
		else 
			return solve(n+1,plan[n],b1)%10000;
	}
	int t=0;
	for(int i=1; i<=3; ++i){
		if(b1==b2&&b1==i) continue;
		t+=solve(n+1,i,b1);
	}
	return memo[n][b1][b2]=t%10000;
}

int main(){
	cin >> N >> K;
	for(int i=0; i<K; ++i){
		int a,b;
		cin >> a >> b;
		plan[a]=b;
	}
	for(int i=0; i<=N; ++i)
		for(int j=0; j<4; ++j)
			for(int k=0; k<4; ++k)
				memo[i][j][k]=-1;
	cout << solve(1,0,0) << "\n";
}

Measured memory_bytes: 1172
#include <stdio.h>

int main(void)
{
  	int	A;
  	int B;
  	int num;
  
  	num = scanf("%d %d", &A, &B);
  	if (num != 2)
      	return (0);
  
  	if (A > 9)
    {
      	printf("-1");
  		return (0);
    }
  	if (B > 9)
    {
      	printf("-1");
      	return (0);
    }
  	printf("%d", A*B);
  	return (0);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] nums = new int[n];
		for(int i = 0; i < n; i++){
			nums[i] = sc.nextInt();
		}
		sc.close();
		int ans = nums[0];
		for(int i = 1; i < n; i++){
			int gcd = computeGCD(ans, nums[i]);
			ans = ans * nums[i] / gcd;
		}
		System.out.println(ans);
	}
	
	private static int computeGCD(int a, int b){
		int big = Math.max(a, b);
		int small = Math.min(a, b);
		int remainder = big % small;
		if(remainder == 0){
			return small;
		}else{
			return computeGCD(small, remainder);
		}
	}

}

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

int main(){
    vector<char> S(3);
    vector<char> T(3);

    for (int i = 0; i < 3; i++)
    {
        cin >> S[i] ;
    }
    
    for (int i = 0; i < 3; i++)
    {
        cin >> T[i] ;
    }

    int c = 0;
    for (int i = 0; i < 3; i++)
    {
        if(S[i]==T[i]){
            c++;
        }
    }

    cout << c << endl;
    


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>

using namespace std;

template <class T>
using vc = vector<T>;

using vi = vector<int>;

vi MakeDeck(){
    auto deck = vi(13);
    iota(deck.begin(), deck.end(), 0);
    return deck;
}

template <class T>
void Remove(vector<T>& v, T x){
    auto itr = v.begin();
    while (itr != v.end()){
        if (*itr == x) {
            itr = v.erase(itr);
        } else ++itr;
    }
}

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

    auto deck_S = MakeDeck();
    auto deck_H = MakeDeck();
    auto deck_C = MakeDeck();
    auto deck_D = MakeDeck();

    int n;
    cin >> n;

    for (auto i = std::size_t(0); i < n; ++i) {
        auto suit = string();
        auto number = 0;
        cin >> suit >> number;

        if (suit == "S") Remove(deck_S, number-1);
        else if (suit == "H") Remove(deck_H, number-1);
        else if (suit == "C") Remove(deck_C, number-1);
        else if (suit == "D") Remove(deck_D, number-1);
    }

    for (const auto& number : deck_S) cout << "S " << number + 1 << "\n";
    for (const auto& number : deck_H) cout << "H " << number + 1 << "\n";
    for (const auto& number : deck_C) cout << "C " << number + 1 << "\n";
    for (const auto& number : deck_D) cout << "D " << number + 1 << "\n";

    return 0;
}



Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
 
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is >> a.first >> a.second; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os << a.first << " "<<a.second; }
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) is >> vc[i]; return is; }
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) os << vc[i] << endl; return os; }
 
#define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)
#define ALL(v) (v).begin(), (v).end()
#define UNQ(s) { sort(ALL(s)); (s).erase( unique( ALL(s)), (s).end());}
#define fr first
#define sc second
 
typedef pair< int , int > Pi;
typedef pair< int , Pi > Pii;
 
typedef long long int64;
const int INF = 1 << 30;

#define MAX_V 302
 
class Dinic{
public:
  struct edge{ // (行き先, 容量, 逆辺のindex) 
    int to, cap, rev;
    edge(int to, int cap, int rev):to(to), cap(cap), rev(rev){};
  };
  vector< edge > info[MAX_V];
  int level[MAX_V]; //sからの距離
  int iter[MAX_V]; //どこまで調べ終わったか
public:
  Dinic(){}
  int add_edge(int from, int to, int cap){
    info[from].push_back( edge( to, cap, info[to].size()));
    info[to].push_back( edge( from, 0, info[from].size() - 1));
    return info[to].size() - 1;
  }
  void bfs(int s){
    memset( level, -1, sizeof level);
    queue< int > que;
    level[s] = 0;
    que.push( s);
    while(!que.empty()){
      int v = que.front(); que.pop();
      for(int i = 0; i < info[v].size(); i++){
        edge& e = info[v][i];
        if(e.cap > 0 && level[e.to] < 0){
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
  }
  int dfs(int v, int t, int f){
    if(v == t) return f;
    for(int& i = iter[v]; i < info[v].size(); i++){
      edge& e = info[v][i];
      if(e.cap > 0 && level[v] < level[e.to]){
        int d = dfs(e.to, t, min( f, e.cap));
        if(d > 0){
          e.cap -= d;
          info[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int max_flow(int s, int t){
    int flow = 0;
    while(true){
      bfs(s);
      if(level[t] < 0) return flow;
      memset( iter, 0, sizeof iter);
      int f;
      while((f = dfs( s, t, INF)) > 0){
        flow += f;
      }
    }
  }
};

int main(){
  int N, M;
  cin >> N >> M;
  Dinic max_flow;
  vector< int > mine(M), index(M);
  for(int i = 0; i < M; ++i){
    int u, v;
    cin >> u >> v;
    --u, --v;
    max_flow.add_edge( u, v, 1);

    mine[i] = u;
    index[i] = max_flow.add_edge( v, u, 1); //逆辺のやつ
  }
  int S, T;
  cin >> S >> T;
  --S, --T;
  int flow = max_flow.max_flow( S, T);
  vector< int > edge;
  for(int i = 0; i < M; i++){
    if(max_flow.info[mine[i]][index[i]].cap > 0){
      edge.push_back(i + 1);
    }
  }
  cout << flow << endl;
  cout << edge.size() << endl;
  cout << edge;
}

Measured memory_bytes: 1328
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include <functional>
#include <queue>
#include <regex>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;


/*vectorの要素を全部確認するやつだよ。


for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}


*/


/*for文でx,yを上下左右確認するやつだよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}
*/

/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}


*/

/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; i++) {
	for (int j = 0; j < w; j++) {

	}
}

*/


int main(void) {

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

	s[k - 1] += 32;

	cout << s << endl;





}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;
#define x first
#define y second
#define mp make_pair
#define REP(i,j,k)  for(int i = (j); i <= (k); ++i)
#define REPD(i,j,k) for(int i = (j); i >= (k); --i)
#define IOS ios::sync_with_stdio(0);cin.tie(0);


const int maxn = 3e5;

int f[maxn];
int find(int x){ return f[x]==x?x:f[x]=find(f[x]); }

void go(int n,int m,int a[])
{
	REP(i,1,n)
		f[i]=i;
	while(m--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(find(x)!=find(y))
			f[find(x)]=find(y);
	}
	REP(i,1,n)
		a[i]=find(i);
}
int a[maxn],b[maxn];
map<pair<int,int>,int> tot;
int init()
{
	int n,m,p;
	if(scanf("%d%d%d",&n,&m,&p)==EOF) return 0;
	go(n,m,a);
	go(n,p,b);
	tot.clear();
	REP(i,1,n)
		if(tot.count(mp(a[i],b[i]))==0)
			tot[mp(a[i],b[i])]=1;
		else ++tot[mp(a[i],b[i])];
	REP(i,1,n)
		if(i==n)
			printf("%d\n",tot[mp(a[i],b[i])]);
		else printf("%d ",tot[mp(a[i],b[i])]);
	return 1;
}

void solve()
{
}

int main()
{
	IOS
	
	while(init())
	solve();
	
	return 0;
}

Measured memory_bytes: 11520
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    long long q, h, s, d, n, price = 0;
    cin >> q >> h >> s >> d >> n;
    n *= 1000;
    vector<pair<long long,char>>a(4);
    a[0] = make_pair(8*q,'q');
    a[1] = make_pair(4*h,'h');
    a[2] = make_pair(2*s,'s');
    a[3] = make_pair(d,'d');
    sort(a.begin(),a.end());
    for(int i=0; i<4; i++){
        if(a[i].second=='q'){
            long long amount = n / 250;
            n %= 250;
            price += amount * (a[i].first/8);
        }
        if(a[i].second=='h'){
            long long amount = n / 500;
            n %= 500;
            price += amount * (a[i].first/4);
        }
        if(a[i].second=='s'){
            long long amount = n / 1000;
            n %= 1000;
            price += amount * (a[i].first/2);
        }
        if(a[i].second=='d'){
            long long amount = n / 2000;
            n %= 2000;
            price += amount * a[i].first;
        }
        if(n==0){
            cout << price << endl;
            return 0;
        }
    }
    return 0;
}

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

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

using ll = long long;

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  if(((B/K)-((A-1)/K)) >=1){
    cout << "OK" << endl;
  }
  else{
    cout<<"NG"<<endl;
  }
}

Measured memory_bytes: 3636
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n;
  cin >> n;
  vector<int> A(n);
  vector<int> dif(n);
  REP(i,n) {
    cin >> A[i];
    if(i>0) dif[i] = A[i]-A[i-1];
  }
  int ans = 0;
  
  int l = 0;
  if(n == 1){cout << 1 << endl; return 0;}
  
  bool plus =((A[1] >= A[0]) ? true : false);
  bool start = false;
  
  FOR(i,1,n-1){
    if(A[i+1] == A[i]) continue;
    if(start){
      plus = (A[i+1] > A[i] ? true : false);
      start = false;
    }
    else{
      if(A[i+1] > A[i]){
	if(!plus){
	  ans++;
	  //continue;
	  start = true;
	}
      }
      if(A[i+1] < A[i]){
	if(plus){
	  ans++;
	  start = true;
	}
      }    
    }
    //cout << "i: " << i << " start: " << start << " plus:" << plus << endl;
  }
  
  cout << ans+1 << endl;
  return 0;
}


  /*
  FOR(i,1,n-1){
    if(A[i+1] == A[i]) continue;
    if(A[i+1] > A[i]){
      if(start){
	plus = true;
      }
      if(!plus){
	ans++;
	start = true;
      }
    }
    if(A[i+1] < A[i]){
      if(start){
	plus = false;
      }
      if(plus){
	ans++;
	start = true;
      }
    }
  }
  */


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;
 
public class Main{
 
	static boolean[][] first;
	static char[][] a;
	static int h;
	static int w;
	static int k;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		h = sc.nextInt();
		w = sc.nextInt();
		k = sc.nextInt();
		a = new char[h][w];
		String s = sc.nextLine();
		first = new boolean[h][w];
		for(int i=0;i<h;i++)Arrays.fill(first[i], false);
		int si=0,sj=0;
		for(int i=0;i<h;i++){
			s = sc.nextLine();
			for(int j=0;j<w;j++){
				a[i][j] = s.charAt(j);
				if(a[i][j] == 'S'){
					si = i;
					sj = j;
				}
			}
		}
		sc.close();
		/*
		for(int i=0;i<k;i++){
			for(int j=0;j<h;j++){
				for(int l=0;l<w;l++){
					if(first[j][l]){
						if(j>0&&a[j-1][l]=='.') first[j-1][l] = true;
						if(j<h-1&&a[j+1][l]=='.') first[j+1][l] = true;
						if(l>0&&a[j][l-1]=='.') first[j][l-1] = true;
						if(l<w-1&&a[j][l+1]=='.') first[j][l+1] = true;
					}
				}
			}
		}
		*/
		dec(si,sj);
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
 
				if(Math.abs(si-i)+Math.abs(sj-j)>k) first[i][j] = false;
			}
		}
		int minscore = Math.min(h, w);
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				//System.out.print(first[i][j]?1:0);
				if(first[i][j]){
					int cx = Math.min(i, h-1-i);
					int cy = Math.min(j, w-1-j);
					int cscore = Math.min(cx, cy);
					minscore = Math.min(cscore, minscore);
				}
			}
			//System.out.println();
		}
		//System.out.println(minscore);
		int ans = 1;
		ans += (minscore+k-1)/k;
		System.out.println(ans);
	}
	public static void dec(int i,int j){
		first[i][j] = true;
		if(i>0&&a[i-1][j]=='.'&&!first[i-1][j]) dec(i-1,j);
		if(i<h-1&&a[i+1][j]=='.'&&!first[i+1][j]) dec(i+1,j);
		if(j>0&&a[i][j-1]=='.'&&!first[i][j-1]) dec(i,j-1);
		if(j<w-1&&a[i][j+1]=='.'&&!first[i][j+1]) dec(i,j+1);
	}
 
}

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

int main() {
  int N;
  cin >> N;
  
  rep(i, N) {
    string s;  
    cin >> s;
    if (s == "Y") { 
      cout << "Four" << endl;
      break;
    }
    else if (i+1 == N) { cout << "Three" << endl; }
  }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)


using namespace std;


int main() {
	int n, m;

	cin >> n >> m;


	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl; 


	return 0;

}

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

int main() {
  int n; std::cin >> n;
  std::vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i]; 
    if (a[i] == 0) {
      std::cout << 0 << std::endl;
      return 0;
    }
  }
  long long ms = 1e18;
  long long m = 1;

  for (int i = 0; i < n; ++i) {

    if (ms / m < a[i]) {
      std::cout << -1 << std::endl;
      return 0;
    }
    m *= a[i];
    
  }

  std::cout << m << std::endl;

  return 0;
}


Measured memory_bytes: 4052