akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};

/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/

int main(){
    int H,W; cin >> H >> W;
    char a[1010][1010];
    queue<pair<int,int> > que;
    int dist[1010][1010];

    for (int i = 0; i <= 1000; i++){
        for (int j = 0; j <= 1000; j++){
            dist[i][j] = MM;
        }
    }    

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            cin >> a[i][j];
            if (a[i][j] == '#'){
                que.push({i,j});
                dist[i][j] = 0;
            }
        }
    }
    while (que.size()){
        pi p = que.front();
        que.pop();
        for (int i = 0; i < 4; i++){
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if (dist[ny][nx] == MM && 0 <= ny && ny < H && 0 <= nx && nx < W){
                dist[ny][nx] = min(dist[ny][nx], dist[p.first][p.second]+1);
                que.push({ny,nx});
            }
        }
    }
    int mx = 0;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            //cout << dist[i][j] << " ";
            mx = max(mx, dist[i][j]);
        }
        //cout << endl;
    }
    cout << mx << endl;
}

Measured memory_bytes: 13328
# ABC 147 C

N=int(input())
A=[[] for _ in [0]*N]
for i in range(N):
    a=int(input())
    for _ in [0]*a:
        A[i].append(tuple(map(int,input().split())))

res=0
for n in range(1<<(N)):
    check=[-1]+[(n>>j)&1 for j in range(N)]
    cnt=0
    j=0
    for j in range(N):
        if check[j+1]==1:
            cnt+=1
            #syouziki
            for x,y in A[j]:
                if check[x] == 1-y:
                    check[0]=1
                if check[0]>0:
                    break
        if check[0]>0:
            break
    if check[0]>0:
        continue
    res=max(res,cnt)
print(res)

Measured memory_bytes: 74704
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int m,d,ans;
	string w[7]={"Monday","Tuesday","Wednesday",
	               "Thursday","Friday","Saturday","Sunday"};
	while(1){
		cin>>m>>d;
		if(m==0&&d==0) break;
		if(m==1||m==4||m==7){
			//start:Thursday
			ans=d%7;
			if(ans<5){
				cout<<w[3+ans-1]<<endl;
			}
			else if(ans==6){
				cout<<w[1]<<endl;
			}
			else cout<<w[2]<<endl;
		}
		if(m==2||m==8){
			//start:Sunday
			ans=d%7;
			if(ans==1) cout<<w[6]<<endl;
			else if(ans==0) cout<<w[5]<<endl;
			else cout<<w[ans-2]<<endl;
		}
		if(m==3||m==11){
			//start:Monday
			ans=d%7;
			if(ans==0) cout<<w[6]<<endl;
			else cout<<w[ans-1]<<endl;
		}
		if(m==6){
			//start:Tuesday
			ans=d%7;
			if(ans!=0){
				cout<<w[ans]<<endl;
			}
			else{
				cout<<w[6]<<endl;
			}
		}
		if(m==10){
			//start:friday
			ans=d%7;
			if(ans<4){
				cout<<w[4+ans-1]<<endl;
			}
			else{
				cout<<w[ans-4]<<endl;
			}
		}
		if(m==5){
			//Saturday
			ans=d%7;
			if(ans==0) cout<<w[4]<<endl;
			else if(ans<3){
				cout<<w[5+ans-1]<<endl;
			}
			else{
				cout<<w[ans-3]<<endl;
			}
		}
		if(m==9||m==12){
			//start:Wednesday
			ans=d%7;
			if(ans==0) cout<<w[1]<<endl;
			else if(ans<6){
				cout<<w[2+ans-1]<<endl;
			}
			else{
				cout<<w[0]<<endl;
			}
		}
	}
}

Measured memory_bytes: 1196
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
int main()
{
    fast;
    ll n, k;
    cin>>n>>k;
    ll a[n+1];
    for(ll i=1;i<n+1;i++)
    {
        cin>>a[i];
    }
    ll dp[n+1];
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(a[1]-a[2]);
    for(ll i=3;i<=n;i++)
    {
        ll mi=100000000000000;
        for(ll j=1;j<=min(i-1,k);j++)
        {
        mi=min(mi,(dp[i-j]+abs(a[i]-a[i-j])));
        }
        dp[i]=mi;
       // cout<<dp[i]<<endl;
    }
    cout<<dp[n];
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	vector<int>x(n);
	vector<int>b(n);

	rep(i, n) {
		cin >> x[i];
		b[i] = x[i];
	}
	sort(b.begin(),b.end());

	vector<int>a(n);
	for (int i = 0; i < n; ++i) {
		if (x[i] <= b[n / 2 - 1]) {
			a[i] = b[n / 2];
		}
		else {
			a[i] = b[n / 2 - 1];
		}
	}
	rep(i, n)cout << a[i] << endl;
}

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

using namespace std;
typedef long long ll;

int main() {
  map<int, int> m;
  for (int i = 0; i < 4; ++i) {
    int n;
    cin >> n;
    m[n]++;
  }

  if (m[1] == 1 && m[7] == 1 && m[9] == 1 && m[4] == 1) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}




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

int main(){
	int a, b, d, r;
	double f;
	cin >> a >> b;
	d = a / b;
	r = a % b;
	f = (double) a / b;
	cout << d << " " << r << " ";
	cout << fixed << f << endl;

	
	
}




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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int a,b;
    cin>>a>>b;

    repa(i,1,1001){
        if(i*8/100==a && i/10==b){
            cout<<i<<"\n";
            return 0;
        }
    }

    cout<<-1<<"\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.size() % 2 != 0) {
    cout << "No";
    return 0;
  }
  for (int i = 0; i < (int) (s.size()); i += 2) {
    if (s[i] != 'h' || s[i+1] != 'i') {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}


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

int main(){
	string s, a;
	cin>>s>>a;
	s+=a;
	int sq = stoi(s);

	int sqr = sqrt(sq);
	if(sqr*sqr == sq){
		cout<<"Yes";
	}
	else
		cout<<"No";
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			String str = scanner.next();

			for (int i = 0; i < n; i++) {
				StringBuilder builder = new StringBuilder();
				int count = 1;
				for (int j = 1; j < str.length(); j++) {
					if (str.charAt(j) == str.charAt(j - 1))
						count++;
					else {
						builder.append(count);
						builder.append(str.charAt(j - 1));
						count = 1;
					}
				}
				builder.append(count).append(str.charAt(str.length() - 1));
				str = builder.toString();
			}
			System.out.println(str);
		}
	}
}

Measured memory_bytes: 28880
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := n * 2

	ans := 1 << 60
	ans = min(ans, a)
	ans = min(ans, a-1)

	for i := 1; i*i <= a; i++ {
		if a%i == 0 {
			b := a / i
			g := gcd(i, b)
			debug(i, b, g)
			if g != 1 {
				continue
			}
			x, y := 0, 0
			extgcd(b, i, &x, &y)
			if x != 0 && y != 0 {
				ans = min(ans, min(abs(b*x), abs(i*y)))
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

func factorize(n int) map[int]int {
	res := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			res[i]++
			n /= i
		}
	}
	if n != 1 {
		res[n] = 1
	}
	return res
}

func extgcd(a, b int, x, y *int) int {
	if b == 0 {
		*x, *y = 1, 0
		return a
	}
	d := extgcd(b, a%b, y, x)
	*y -= a / b * (*x)
	return d
}

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}


Measured memory_bytes: 2176
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef pair<int,int> P;
main(){
  while(1){
    int n,m;
    int sum[111]={};
    P p[111];
    scanf("%d %d",&n,&m);
    if(!n && !m) break;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	int ox;
	scanf("%d",&ox);
	sum[j]+=ox;
      }
    }
    for(int i=0;i<m;i++){
      p[i].first = sum[i];
      p[i].second = -(i+1);
    }

    sort(p,p+m);
    for(int i=m-1;i>-1;i--){
      printf("%d",-p[i].second);
      if(i>0) printf(" ");
      else printf("\n");
    }
  }
}

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

using namespace std;

#define MAX 25

int main()
{
    int H, W;
    while (cin >> W >> H, W) {
        vector<vector<int>> a(H, vector<int>(W));
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cin >> a[i][j];
            }
        }
        int dp[MAX][MAX] = {{}};
        for (int i = 0; i < W; i++) {
            dp[0][i] = (a[0][i] == 0);
        }

        for (int i = 0; i < H - 1; i++) {
            for (int j = 0; j < W; j++) {
                if (dp[i][j] <= 0 || a[i][j] == 1) continue;
                if (a[i][j] == 2) {
                    int ni = min(i + 2, H - 1);
                    if (i + 2 < H && a[i+2][j] == 1) continue;
                    dp[ni][j] += dp[i][j];
                } else {
                    for (int k = -1; k <= 1; k++) {
                        int ni = i + 1;
                        int nj = j + k;
                        if (nj < 0 || nj >= W) continue;
                        if (a[ni][nj] == 1) continue;
                        if (a[ni][nj] == 2 && j != nj) continue;
                        dp[ni][nj] += dp[i][j];
                    }
                }
            }
        }
        int res = 0;
        for (int i = 0; i < W; i++) {
            res += dp[H-1][i];
        }
        cout << res << endl;
    }
    return 0;
}

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

const int mod = 1000000007;

char N[10101];
int D,P[10101]; long long U[10001][101];

int main()
{
	scanf ("%s %d",N,&D);
	U[0][0] = 1;
	for (int i=1;i<=10000;i++){
		for (int j=0;j<D;j++) for (int x=0;x<10;x++){
			long long &u = U[i][(j+x)%D];
			u = (u + U[i-1][j]) % mod;
		}
	}

	int L = 0;
	while (N[L]) L++;

	for (int i=0;i<L;i++) P[i] = (N[i] - '0') % D;
	for (int i=1;i<L;i++) P[i] = (P[i-1] + P[i]) % D;

	long long ans = (P[L-1] == 0);
	for (int i=0;i<L;i++){
		for (int j=0;j<N[i]-'0';j++){
			for (int k=0;k<D;k++){
				int d = (j + k) % D;
				if (i) d = (d + P[i-1]) % D;
				if (d == 0) ans = (ans + U[L-1-i][k]) % mod;
			}
		}
	}
	ans = (ans + mod - 1) % mod;

	printf ("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8064
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline

def main():
    s = str(input())
    abc = 'abcdefghijklmmopqrstuvwxyz'
    usable = []
    for a in list(abc):
        if a not in s:
            usable.append(a)
    if len(usable) > 0:
        print(s.strip() + usable[0])
        exit()
    if s == list(abc)[::-1]:
        print(-1)
        exit()
    for i in (range(len(s)-1))[::-1]:
        if s[i] < s[i+1]:
            for j in range(i+1, len(s))[::-1]:
                if s[i] < s[j]:
                    print(s[:i]+s[j])
                    exit()
    print(-1)


def divide_list(l, args):
    result = []
    pre = 0
    for i, a in enumerate(args):
        if i != 0:
            pre = args[i-1]
        result.append(l[pre:a])
        if i == len(args) - 1:
            result.append(l[a:])
    return result

def divide_two(n):
    c = 0
    while True:
        if c >= 2:
            break
        if n % 2 != 0:
            break
        n //= 2
        c += 1
    return c

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63980
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;
vector<int>fen(200005,0);
void modify(int j,int val){
      for(;j<fen.size();j+=j&-j){
            fen[j]=max(fen[j],val);
      }
}
int query(int j){
      int val=0;
      for(;j>0;j-=j&-j)val=max(val,fen[j]);
      return val;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      vector<int>H(n),A(n);
      for(int i=0;i<n;i++)cin>>H[i];
      for(int i=0;i<n;i++)cin>>A[i];
      for(int i=0;i<n;i++){
            modify(H[i],query(H[i]-1)+A[i]);
      }
      int mx=0;
      for(int i=0;i<fen.size();i++)mx=max(mx,fen[i]);
      cout<<mx;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define PI 3.141592653589793
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

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

ll gcd(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) { //階乗
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) { //にぶたんgreater
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll wari=1LL;
	while(n/wari) {
		digit++;
		wari*=10;
	}
	return digit;
}

bool IsPrime(ll num) { //素数判定
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

vector<ll> Divisor(ll x) { // 約数列挙
	vector<ll> result;
	ll i=1LL;
	for( ; i*i<x; i++) {
		if(x%i) continue;
		result.push_back(i);
		result.push_back(x/i);
	}
	if(i*i==x&&x%i==0)
		result.push_back(i);
	
	sort(result.begin(),result.end());
	return result;
}

vector<llpair> PrimeFact(ll x) { // 素因数分解 {素因数,指数}
	vector<llpair> result;
	ll ex=0LL;
	if(x%2==0) {
		while(x%2==0) {
			x/=2;
			ex++;
		}
		result.push_back({2,ex});
	}

	for(ll i=3LL; i*i<=x; i+=2) {
		if(x%i) continue;

		ex=0LL;
		while(x%i==0) {
			x/=i;
			ex++;
		}
		result.push_back({i,ex});
	}

	if(x!=1) result.push_back({x,1});

	return result;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}

int main() {
	string S; cin>>S;
	int L=0, R=S.length()-1;

	int result=0;
	while(R-L>0) {
		if(S[L]==S[R]) {
			L++; R--;
		}
		else if(S[L]=='x') {
			L++;
			result++;
		}
		else if(S[R]=='x') {
			R--;
			result++;
		}
		else {
			cout<<-1<<endl;
			return 0;
		}
	}

	cout<<result<<endl;
}


Measured memory_bytes: 512
a = input()
b = input()
sgns = ['>', '<', '==']
str_sgns = ['GREATER', 'LESS', 'EQUAL']
tDict = {sgn:str_sgn for sgn, str_sgn in zip(sgns, str_sgns)}
for sgn, str_sgn in tDict.items():
    f = a + sgn + b
    if eval(f):
        print(str_sgn)
        exit()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    ll n,m,ans=0;
    cin>>n>>m;
    P tmp;
    vector<P> pa(m);
    for(ll i=0;i<m;i++){
        ll l,r;
        cin>>l>>r;
        pa[i]={l,r};
    }
    ll L=pa[0].first,R=pa[0].second;
    for(int i=1;i<m;i++){
       L=max(L,pa[i].first);
       R=min(R,pa[i].second);
     }
     if(R-L+1>=0) cout<<R-L+1<<endl;
     else cout<<0<<endl;
     return 0;
}


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

int main(){
    string S;
    cin >> S;
    bool ans = false;
    if (S[0] != S[1])ans = true;
    if (S[1] != S[2])ans = true;
    if (S[2] != S[0])ans = true;
    if (ans)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){

  int N; cin >> N;

  vector<string> SS;
  string s; cin >> s;
  SS.push_back(s);

  bool flag = true;

  for(int i = 1;i <=N-1;i++){
    cin >> s;
    SS.push_back(s);
    if(SS[i][0] != SS[i-1][SS[i-1].size()-1])flag = false;
    for(int j = 0;j < i;j++){
      if(SS[i] == SS[j])flag = false;
    }
  }

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

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double v[n];
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v,v+n);
    double t=v[0];
    for(int i=1;i<n;i++){
        t+=v[i];
        t/=2.0;
        //cout<<t<<endl;
    }
    cout<<t;
    return 0;
}


Measured memory_bytes: 256
N, Q = [int(x) for x in input().split()]
S = input()
lr = [[int(x)-1 for x in input().split()] for _ in range(Q)]
lst = [0] * N
for i in range(N-1):
    lst[i+1] = lst[i] + (S[i] == 'A' and S[i+1] == 'C')
for l, r in lr:
    print(lst[r]-lst[l])


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

 using namespace std;

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

   cin >> N >> M >> C;

   vector<int> B(M + 1);
   for (int i = 1; i <= M; i++) cin >> B.at(i);

   vector<vector<int>> A(N + 1, vector<int>(M + 1));

   for (int i = 1; i <= N; i++) {
     for (int j = 1; j <= M; j++) {
       cin >> A.at(i).at(j);
     }
   }

   int ans = 0;
   for (int i = 1; i <= N; i++) {
     int sum = C;
     for (int j = 1; j <= M; j++) {
       sum += A.at(i).at(j) * B.at(j);
     }
     if (sum > 0) ans++;
   }

   cout << ans << endl;
}


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

#define LLONG_MAX 0x3f3f3f3f3f3f3f3f

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(M);
	vector<int> b(M);
	vector<long long> c(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> a[i] >> b[i] >> c[i];
		--a[i];
		--b[i];
	}
	
	long long d1, d2;
	
	vector<long long> d(N, -LLONG_MAX);
	d[0] = 0LL;

	for (int i = 0; i < 2 * N; ++i)
	{
		for (int j = 0; j < M; ++j)
		{
			d[b[j]] = max(d[b[j]], d[a[j]] + c[j]);
		}
		if (i == N - 1)
			d1 = d[N - 1];
		if (i == 2 * N - 1)
			d2 = d[N - 1];
	}
	
	if (d1 != d2)
	{
		cout << "inf" << endl;
	}
	else {
		cout << d1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct node {
	int key;
	struct node *prev, *next;
};

struct node *head;

void *init()
{
	head = (struct node *)malloc(sizeof(*head));
	head->prev = head;
	head->next = head;
}

struct node *list_search(int key)
{
	struct node *cur = head->next;
	
	if (cur == head)
		return;
	
	while (cur != head && cur->key != key) {
		cur = cur->next;
	}
	
	return cur;
}

void insert(int x)
{
	struct node *n = (struct node *)malloc(sizeof(*n));
	n->key = x;
	
	n->next = head->next;
	n->prev = head;
	head->next->prev = n;
	head->next = n;
}

void delete(struct node *t)
{
	if (t == head)
		return;
	
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void delete_first()
{
	delete(head->next);
}

void delete_last()
{
	delete(head->prev);
}

void walk_list(struct node *head)
{
	struct node *cur = head->next;
	int flag = 0;
	
	if (cur == head)
		return;
	
	while (cur != head) {
		if (flag) printf(" "); 
		printf("%d", cur->key);
		cur = cur->next;
		flag = 1;
	}
	printf("\n");
}

int main(int argc, char *argv[]) 
{	
	int cc, key;
	char cmd_type[32];
	
	init();
	
	scanf("%d", &cc);
	
	while (cc-- > 0) {
		scanf("%s %d", cmd_type, &key);
		
		if (!strcmp("insert", cmd_type)) {
			insert(key);
		} else if (!strcmp("delete", cmd_type)) {
			delete(list_search(key));
		} else if (!strcmp("deleteFirst", cmd_type)) {
			delete_first();
		} else if (!strcmp("deleteLast", cmd_type)) {
			delete_last();
		}
	}
	
	walk_list(head);
	
	return 0;
}


Measured memory_bytes: 32960
#include <cstdio>
#include <algorithm>

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

using namespace std;

const int INF=1000000010;
const int X=INF;

int main(){
	for(int n;scanf("%d",&n),n;){
		int a[1000];
		rep(i,n){
			char s[32]; scanf("%s",s);
			if(s[0]=='x') a[i]=X;
			else sscanf(s,"%d",a+i);
		}

		bool cont=false;
		rep(i,n-1) if(a[i]==X && a[i+1]==X) cont=true;
		if(cont){ puts("none"); continue; }

		int l=-INF,r=INF;
		bool bad=false;
		rep(i,n){
			if(a[i]==X){
				if(i%2==0){
					if(0<=i-1 && i-1<n) r=min(r,a[i-1]-1);
					if(0<=i+1 && i+1<n) r=min(r,a[i+1]-1);
				}
				else{
					if(0<=i-1 && i-1<n) l=max(l,a[i-1]+1);
					if(0<=i+1 && i+1<n) l=max(l,a[i+1]+1);
				}
			}
			else{
				if(i%2==0){
					if(0<=i-1 && i-1<n && a[i-1]!=X && a[i-1]<=a[i]) bad=true;
					if(0<=i+1 && i+1<n && a[i+1]!=X && a[i+1]<=a[i]) bad=true;
				}
				else{
					if(0<=i-1 && i-1<n && a[i-1]!=X && a[i-1]>=a[i]) bad=true;
					if(0<=i+1 && i+1<n && a[i+1]!=X && a[i+1]>=a[i]) bad=true;
				}
			}
		}

		if(bad || l>r) puts("none");
		else if(l<r) puts("ambiguous");
		else printf("%d\n",l);
	}

	return 0;
}

Measured memory_bytes: 1052
console.log((args=>{
  const [[N,K],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>0|v));
  let ng = 0, ok = 1e9;
  while ( ok - ng > 1 ) {
    const m = (ok+ng)>>>1;
    let k = 0;
    for ( let i = 0; i < N; i++ ) {
      k += Math.floor((A[i]-1)/m);
    }
    if ( k > K ) ng = m;
    else ok = m;
  }
  return ok;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 50212
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if (min(a, b) < c&&max(a, b) > c){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
        string s;
        cin >> s;
        int judge = 0;
        int length = s.length();
        while(length > 0){
                if(s[length - 1] == 'F')
                        judge++;
                if(s[length - 1] == 'C' && judge >= 1){
                        cout << "Yes" << endl;
                        return 0;
                        break;
                }
                length--;
        }
        cout << "No" << endl;
}

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

using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int md = 1e9 + 7;

int main(){

	int d,t,s;
	cin >> d >> t >> s;
	cout << (s*t>=d ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3540
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		String result = "YES";
		int count = 0;
		int tmp1 = 0;
		int tmp2 = 0;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			if (p[i] != i + 1) {
				count++;
				if (count == 1) {
					tmp1 = i;
				}
				if (count == 2) {
					tmp2 = i;
				}
			}
		}
		if (count > 2) {
			result = "NO";
		}
		if (count == 2) {
			int tmp = p[tmp1];
			p[tmp1] = p[tmp2];
			p[tmp2] = tmp;
		}
		for (int i = 0; i < n; i++) {
			if (p[i] != i + 1) {
				result = "NO";
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

int main() {
    int ans = 0;
    int n;
    cin >> n;
    vector<vector<P>> v(n);
    rep(i,n){
        int a;
        cin >> a;
        rep(j,a){
            int x,y;
            cin >> x >> y;
            x--;
            v[i].push_back(make_pair(x,y));
        }
    }
    for(int bit=0;bit<(1<<n);bit++){
        bool flag = true;
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                for(auto j : v[i]){
                    if(!((j.second==1&&(bit&(1<<j.first)))||(j.second==0&&!(bit&(1<<j.first))))) flag = false;
                }
            }
        }
        if(flag) ans = max(ans,__builtin_popcount(bit));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    int d, n;
    cin >> d >> n;
    
    int ans = 1;
    for(int i = 0; i < d; i++){
        ans *= 100;
    }
    cout << ans * (n == 100 ? 101 : n) << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;

public class ABC168B {
	private static void Main(string[] args) {
		var k = ReadInt();
		var s = ReadStr();

		var answer = (s.Length > k) ? (s.Substring(0, k) + "...") : s;
		Console.WriteLine(answer);
	}

	private static string ReadStr() => Console.ReadLine().Trim();
	private static int ReadInt() => int.Parse(Console.ReadLine().Trim());
}

Measured memory_bytes: 27392
#include<stdio.h>
#include<stdlib.h>

typedef struct directedGraph{
  int *vertex;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void freeGraph(graph *g){
  free(g->vertex);
  free(g->next);
  free(g->start);
  free(g);
  return;
}

void addEdge(graph *g,const int from,const int to){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct splaNode{
  int v;
  int d;
  int c;
} node;

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  graph *g=newGraph(n,2*m);
  while(m--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    addEdge(g,a,b);
    addEdge(g,b,a);
  }
  int q;
  scanf("%d",&q);
  node *s=(node *)calloc(q,sizeof(node));
  int i;
  for(i=0;i<q;i++){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    s[i]=(node){v-1,d,c};
  }
  int *ans=(int *)calloc(n,sizeof(int));
  int *rad=(int *)calloc(n,sizeof(int));
  for(i=0;i<n;i++) rad[i]=-1;
  node *que=(node *)calloc(n,sizeof(node));
  for(i=q-1;i>=0;i--){
    if(rad[s[i].v]>=s[i].d) continue;
    rad[s[i].v]=s[i].d;
    int front=0;
    int last=0;
    que[last++]=s[i];
    while(front<last){
      const node t=que[front++];
      if(ans[t.v]==0) ans[t.v]=t.c;
      if(t.d==0) continue;
      for(int p=g->start[t.v];p!=-1;p=g->next[p]){
	int u=g->vertex[p];
	if(rad[u]>=t.d-1) continue;
	rad[u]=t.d-1;
	que[last++]=(node){u,t.d-1,t.c};
      }
    }
  }
  for(i=0;i<n;i++) printf("%d\n",ans[i]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 5632
N, M, X = map(int, input().split())
C = []
A = []
for _ in range(N):
    c, *a = map(int, input().split())
    C.append(c)
    A.append(a)
ans = 10**18
for s in range(1<<N):
    an = 0
    L = [0] * M
    for i, (c, a) in enumerate(zip(C, A)):
        if s>>i&1:
            an += c
            for j, a_ in enumerate(a):
                L[j] += a_
    if all(l >= X for l in L):
        if an < ans:
            ans = an
if ans == 10**18:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9216
#include <stdio.h>

int main(void){
  int X,Y;
  scanf("%d %d",&X,&Y);

  int Z = Y - (2*X);
  int A = Z / 2;
  int B = X - A;
  if((A*4)+(B*2)==Y && A>=0 && B >=0){
    printf("%s\n","Yes");
  }else{
    printf("%s\n","No");
  }
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

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 dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int cn) {
    int H, W, K;
    cin>>H>>W>>K;
    int idx=1;
    string cake;
    vector<vector<int>> ans(H,vector<int>(W,-1));
    vector<int> horyu;
    for (int i = 0; i < H; ++i) {
        cin>>cake;
        int last = -1;
        for (int j = 0; j<W; ++j){
            if(cake[j]=='#') last=j;
        }
        if (last==-1) continue;
        for (int j = 0; j < W; ++j) {
            ans[i][j] = idx;
            if (cake[j]=='#'&&j<last) {
                idx++;
            }
        }
        idx++;
    }

    //上から
    for (int i = 1; i < H; ++i) {
        if(ans[i][0]>=0) continue;
        for (int j = 0; j < W; ++j) {
            ans[i][j]=ans[i-1][j];
        }
    }

    //下から
    for (int i = H-2; i >= 0; --i) {
        if(ans[i][0]>=0) continue;
        for (int j = 0; j < W; ++j) {
            ans[i][j]=ans[i+1][j];
        }
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }
}


#define SINGLE
int main() {
#ifdef SINGLE
    solve(1);
#else
    int N;
    cin>>N;
    for(int i=0;i<N;++i){
        solve(i);
    }
#endif
    return 0;
}


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

int main(){
	string s;
	cin>>s;
	bool yes=true;
	if(s.size()%2==1){
		yes=false;
	}else{
		for(int i=0;i<s.size();i+=2){
			if("hi"!=s.substr(i,2)){
				yes=false;
				break;
			}
		}
	}
	if(yes)cout<<"Yes\n"s;
	else cout<<"No\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#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 revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, K, ans = 0; cin >> N >> K;
    rep (i, 0, N) {
        int in; cin >> in;
        if (K <= in) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t L;
  scanf("%zu", &L);
  std::vector<intmax_t> A(L);
  for (auto& ai: A) {
    scanf("%jd", &ai);
  }

  intmax_t INF = 1e15;
  std::vector<std::vector<intmax_t>> dp(L+1, std::vector<intmax_t>(6, INF));

  dp[0][0] = 0;
  for (size_t i = 1; i <= L; ++i) {
    {
      // unstarted
      dp[i][0] = std::min(dp[i][0], dp[i-1][0] + (A[i-1]));
    }
    {
      // starts from left
      dp[i][1] = std::min(dp[i][1], dp[i-1][0] + (1 - A[i-1] % 2));
      dp[i][1] = std::min(dp[i][1], dp[i-1][1] + (1 - A[i-1] % 2));
      dp[i][1] = std::min(dp[i][1], dp[i-1][2] + (1 - A[i-1] % 2));
    }
    {
      // starts from right
      int a = (A[i-1]? A[i-1]%2 : 2);
      dp[i][2] = std::min(dp[i][2], dp[i-1][0] + (a));
      dp[i][2] = std::min(dp[i][2], dp[i-1][2] + (a));
    }
    {
      // ends to right
      int a = (1 - A[i-1] % 2);
      dp[i][3] = std::min(dp[i][3], dp[i-1][1] + (a));
      dp[i][3] = std::min(dp[i][3], dp[i-1][2] + (a));
      // dp[i][3] = std::min(dp[i][3], dp[i-1][3] + (A[i-1]));
    }
    {
      // ends to left
      int a = (A[i-1]? A[i-1]%2 : 2);
      dp[i][4] = std::min(dp[i][4], dp[i-1][1] + (a));
      dp[i][4] = std::min(dp[i][4], dp[i-1][2] + (a));
      dp[i][4] = std::min(dp[i][4], dp[i-1][3] + (a));
      dp[i][4] = std::min(dp[i][4], dp[i-1][4] + (a));
      // dp[i][4] = std::min(dp[i][4], dp[i-1][4] + (A[i-1]));
    }
    {
      // ended
      dp[i][5] = std::min(dp[i][5], dp[i-1][0]);
      dp[i][5] = std::min(dp[i][5], dp[i-1][3] + A[i-1]);
      dp[i][5] = std::min(dp[i][5], dp[i-1][4] + A[i-1]);
      dp[i][5] = std::min(dp[i][5], dp[i-1][5] + A[i-1]);
    }
  }

  for (size_t j = 0; j < dp[0].size(); ++j)
    for (size_t i = 0; i <= L; ++i)
      fprintf(stderr, "%jd%c", dp[i][j], i<L? ' ':'\n');

  printf("%jd\n", *std::min_element(dp[L].begin(), dp[L].end()));
}


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

int main(){
	long int n=0,m=0,l=0;
	long int i=0,j=0,k=0;

	cin >> n >> m >> l;
	long int A[n+1][m+1];
	long int B[m+1][l+1];
	long int C[n+1][l+1];
	// ?????????
	for(i=0;i<=n;i++){
		for(j=0;j<=m;j++){
			A[i][j]=0;
		}
	}
	for(i=0;i<=m;i++){
		for(j=0;j<=l;j++){
			B[i][j]=0;
		}
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=l;j++){
			C[i][j]=0;
		}
	}

	// ????????????
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			cin >> A[i][j];
		}
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=l;j++){
			cin >> B[i][j];
		}
	}

	// ????????????
	for(i=1;i<=n;i++){
		for(j=1;j<=l;j++){
			for(k=1;k<=m;k++){
				C[i][j] += A[i][k]*B[k][j];
			}
		}
	}
	

	for(i=1;i<=n;i++){
		for(j=1;j<=l;j++){
			if(j==l){
				cout << C[i][j];
			}else{
				cout << C[i][j] << " ";
			}
		}
		cout << endl;
	}

return 0;
}

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

using namespace std;


#define MAXN 100001
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p[MAXN];
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
  }
  for (int i = 1; i <= n; ++i) {
    if (p[i]==i) {
      ans++;
      if (i<n) swap(p[i], p[i+1]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
int main(){
    
int a,b,c,d;
int e,f;
std::cin >> a >> b >> c >> d;

    e = std::abs(a-b);
    f = std::abs(b-c);
    
    if(e <= d && f <= d){
            std::cout << "Yes" << std::endl;
    }
    else if(abs(a-c)<=d){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string S; cin >> S;
    ll K; cin >> K;
    ll n = 0;
    ll t = 5000000000000000;
    REP(i, S.length())
    {
        n += (ll)pow((S[i] - '0'), t);
        if(n >= K || n < 0)
        {
            cout << S[i] << endl;
            return;
        }
    }
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 512
//Lunlun Number

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

vector<int>a;

void dfs(string s){
    if(s.size()>10)return;
    if(s[s.size()-1]>'0'&&s[s.size()-1]<'9'){
        rep(i,-1,2){
            string t = s;
            t.pb(s[s.size()-1]+i);
            a.pb(stoll(t));
            dfs(t);
        }
    }else if(s[s.size()-1]=='0'){
        rep(i,0,2){
            string t = s;
            t.pb(s[s.size()-1]+i);
            a.pb(stoll(t));
            dfs(t);
        }
    }else if(s[s.size()-1]=='9'){
        rep(i,-1,1){
            string t = s;
            t.pb(s[s.size()-1]+i);
            a.pb(stoll(t));
            dfs(t);
        }
    }
}

signed main (){
    rep(i,1,10){
        a.pb(i);
        dfs(to_string(i));
    }
    sort(range(a));
    int k;cin>>k;
    cout<<a[k-1]<<nnn;
    return 0;
}

Measured memory_bytes: 11552
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int dp[110][110];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n, m;
  cin >> n >> m;
  string s[n];
  fi(0, n) {
    cin >> s[i];
  }
  fi(0, n)
    fj(0, m)
      dp[i][j] = INF;

  dp[0][0] = s[0][0] == '.' ? 0 : 1;
  fi(0, n)
  fj(0, m) {
    if(i > 0) {
      chmin(dp[i][j], dp[i - 1][j] + (s[i][j] == '#' && s[i - 1][j] == '.'));
    }
    if(j > 0) {
      chmin(dp[i][j], dp[i][j - 1] + (s[i][j] == '#' && s[i][j - 1] == '.'));
    }
  }
  ans = dp[n - 1][m - 1];
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = [a[0],b[0],c[0]]
e = [a[1],b[1],c[1]]
f = [a[2],b[2],c[2]]
g = [a[0],b[1],c[2]]
h = [a[2],b[1],c[0]]

n = int(input())

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

for l in [a,b,c,d,e,f,g,h]:
    if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
        print("Yes")
        break
else:
        print("No")

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

int main() {
    double r;

    while(cin>>r) {
        if(r == 0.0) break;
        for(int i=1; i<=10000000; ++i) {
            int tmp = i*M_PI;
            if(fabs((double)tmp/i - M_PI) <= r) {
                cout<<tmp<<"/"<<i<<endl;
                break;
            }
            if(fabs((double)(tmp+1)/i - M_PI) <= r) {
                cout<<tmp+1<<"/"<<i<<endl;
                break;
            }
        }
    }
}

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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(ll i=(a);i<(b);i++)
#define fore(i,a,b) for(ll i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

bool DEBUG = 0;
const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	
	int cnt[10005]{};
	fore(i,1,200) fore(j,1,200) fore(k,1,200){
		if(i*i+j*j+k*k+i*j+ j*k + k*i<10005){
			cnt[i*i+j*j+k*k+i*j+ j*k + k*i]++;
		}
	}
	
	fore(i,1,n) cout<<cnt[i]<<'\n';
	
	return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    string s ;
    int i , n  ;
    int no ,so , ea ,we;
     no = so = we = ea = 0;
    cin >> s;
    n = s.size();
    for(i=0;i<n;i++)
    {
        if(s[i] == 'E')
            ea++;
        else if(s[i] == 'N')
            no++;
        else if(s[i] == 'W')
            we++;
        else so++;
    }
    bool f = true;
    if(ea && !we || !ea && we)
        f = false;
    if(no && !so || !no && so)
        f = false;
    if(!f) cout << "No";
    else cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

struct Point {
	int d;
	vll coords;
	Point(int dim, vll& coordinates):d(dim),coords(coordinates){}
};

ll diam_l1(int dim, vector<Point>& pts){
	ll ans = 0;
	for (int mask = 1; mask < (1 << dim); mask++) {

		auto get_val = [&](Point p) {
			ll val = 0;
			int basis = mask;
			rep(i, dim) {
				int dig = basis % 2;
				basis /= 2;
				val += p.coords[i]*(dig == 1 ? 1 : -1);
			}
			return val;
		};

		auto cmp = [&](Point p, Point q){
			return get_val(p) <= get_val(q);
		};

		Point maxp = *max_element(all(pts), cmp);
		Point minp = *min_element(all(pts), cmp);
		ans = max(ans, get_val(maxp) - get_val(minp));
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vector<Point> pts = vector<Point>();
	rep(i, n) {
		int x, y; cin >> x >> y;
		vll coords = {x, y};
		pts.pb(Point(2, coords));
	}
	cout << diam_l1(2, pts);
}

Measured memory_bytes: 15732