akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Theater
{
    class Program
    {
        static void Main(string[] args)
        {

            int intNum = int.Parse(Console.ReadLine());

            int intSum = 0;

            for (int i = 0; i < intNum; i++) {
                string[] strInp = Console.ReadLine().Split(' ');
                intSum = intSum + int.Parse(strInp[1]) - int.Parse(strInp[0]) + 1;
            }

            Console.WriteLine(intSum);

            // for debug
            return;
        }
    }
}


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

int main(){ 
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        double temp = i * 1.08;
        if((int)temp == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
} 

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18
const long MOD = 1000000007;

typedef std::pair<long, long> P;

long n;
std::map<P, long> mp;
std::map<P, P> mp2;

long power(long a, long b, const long MOD){
    a %= MOD;
	if(b == 0){
		return 1l;
	}else if(b % 2 == 1){
		return a * power(a, b-1, MOD) % MOD;
	}else{
		long r = power(a, b/2, MOD);
		return r * r % MOD;
	}
}
long gcd(long num1, long num2){
    if(num1 < 0){
        num1 = -num1;
    }
    if(num2 < 0){
        num2 = -num2;
    }
	if(num2 > num1){
		std::swap(num1, num2);
	}
	if(num2 == 0){
		return num1;
	}else{
		return gcd(num2, num1 % num2);
	}
}

P modify(P vec){
    long a = vec.first;
    long b = vec.second;
    if(a == 0){
        if(b != 0){
            return P(0, 1);
        }else{
            return P(0, 0);
        }
    }else if(b == 0){
        return P(1, 0);
    }
    long g = gcd(a, b);
    a /= g;
    b /= g;
    if(b == 0){
        if(a < 0){
            a = -a;
        }
    }else if(b < 0){
        a = -a;
        b = -b;
    }
    return P(a, b);
}

bool is_quad(P v){
    if(v == P(0, 0)){
        return true;
    }
    if(v.first >= 0 && v.second > 0){
        return true;
    }
    return false;
}

P vertical(P v){
    return modify(P(v.second, -v.first));
}

long mod(long x, long m){
    return (x % m + m) % m;
}

int main(){

    scanf("%ld", &n);

    for(int i = 0; i < n; i++){
        long a, b;
        scanf("%ld%ld", &a, &b);
        mp[modify(P(a, b))]++;
    }
    /*
    for(auto it = mp.begin(); it != mp.end(); it++){
        printf("(%ld, %ld), %ld\n", it->first.first, it->first.second, it->second);
    }
    //*/
    for(auto it = mp.begin(); it != mp.end(); it++){
        P v = it->first;
        long cnt = it->second;
        if(is_quad(v)){
            mp2[v].first = cnt;
        }else{
            mp2[vertical(v)].second = cnt;
        }
    }
    /*
    for(auto it = mp2.begin(); it != mp2.end(); it++){
        P a = it->first;
        P b = it->second;
        printf("(%ld, %ld), %ld %ld\n", a.first, a.second, b.first, b.second);
    }
    //*/
    long ans = 1;
    long zero = 0;
    for(auto it = mp2.begin(); it != mp2.end(); it++){
        if(P(0, 0) == it->first){
            zero = it->second.first;
            //printf("zero %ld\n", zero);
            continue;
        }
        long x = it->second.first;
        long y = it->second.second;
        long res = (power(2, x, MOD) + power(2, y, MOD) - 1) % MOD;
        if(res < 0){
            res += MOD;
        }
        //printf("  %ld\n", res);
        ans *= res;
        ans %= MOD;
    }
    printf("%ld\n", mod(ans - 1 + zero, MOD));
}


Measured memory_bytes: 31856
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int64_t Q,H,S,D,N; cin>>Q>>H>>S>>D>>N;
    
    int64_t sP=min(4*Q,min(2*H,S)),ans=0;
    ans+=min(2*sP,D)*(N/2);
    if(N%2) ans+=sP;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    n=s.size();
    string key="keyence";
    for (int i = 0; i < n; i++)
    {
        for(int j=i;j<n;j++){
            string temp=s.substr(0,i)+s.substr(j,n);
            //cout<<temp<<"\n";
            if(key==temp)return YES,0;
        }
    }
    NO;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

class Main {
	public static void main(String[] args)
	{
		FastScanner in =new FastScanner();
		int n=in.nextInt();
		long W=in.nextLong();
		long[] w=new long[n];
		int[] v=new int[n];
		int nsum=0;
		for(int i=0;i<n;i++)
		{
			w[i]=in.nextLong();
			v[i]=in.nextInt();
			nsum+=v[i];
		}
		long[] dp=new long[nsum+1];
		Arrays.fill(dp,(long)1e18+5);
		dp[0]=0;
		for(int i=0;i<n;i++)
		{
			for(int j=nsum;j>=0;j--)
			{
				if(j-v[i]>=0)
					dp[j]=Math.min(dp[j], dp[j-v[i]]+w[i]);
			}
		}
//		System.out.println(Arrays.toString(dp));
		long max=0;
		for(int i=0;i<nsum+1;i++) {
			if(dp[i]<=W)
			max=Math.max(max, (long)i);
		}
		System.out.println(max);
	}

static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 33692
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;


ll sumleft[200010];
ll sumright[200010];

bool isOK(ll* a,ll index, ll key) {
	if (a[index] >= key) return true;
	else return false;
}


ll binary_search(ll* a,ll key,ll l,ll r) {
	ll left = l - 1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)r + 1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(a,mid, key)) right = mid;
		else left = mid;
	}

	return right;
}

int main(void) {
	ll n;
	cin >> n;
	vector<ll>a(n);
	for (ll i = 0;i < n;i++) cin >> a[i];
	for (ll i = 0;i < n;i++)sumleft[i + 1] = sumleft[i] + a[i];
	for (ll i = 0;i < n;i++)sumright[i + 1] = sumright[i] + a[n - 1 - i];
	ll ans = 10000000000000000;
	for (ll j = 2;j <= n - 2;j++) {
		ll ma = 0, mi = 10000000000000000;
		ll p = sumleft[j];
		ll i = binary_search(sumleft, p / 2, 1, j - 1);
		ll k = binary_search(sumright, (sumleft[n] - sumleft[j]) / 2, 1, n - j - 1);
		k = n - k + 1;
		for (ll x = i - 1;x <= i+1;x++) {
			for (ll y = k-1;y <= k+1;y++) {
				if ((1 <= x) && (x < j) && (j < y) && (y < n)) {
					ll ma = 0, mi = 10000000000000000;
					//cout << x << " " << j << " " << y << endl;
					//cout << sumleft[x] << " " << sumleft[j] - sumleft[x] << " "<<sumleft[y] - sumleft[j]<<" "<< sumleft[n] - sumleft[y] << endl;
					ma = max(ma, max(sumleft[x], sumleft[j] - sumleft[x]));
					ma = max(ma, max(sumleft[y] - sumleft[j], sumleft[n] - sumleft[y]));
					mi = min(mi, min(sumleft[x], sumleft[j] - sumleft[x]));
					mi = min(mi, min(sumleft[y] - sumleft[j], sumleft[n] - sumleft[y]));
					ans = min(ans, ma - mi);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;

#define mod 1000000007

int main()
{
    int h, w;
    cin >> h >> w;
    char a[10][10];
    int maxtesu[10][10];
    int sharpnum = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
            maxtesu[i][j] = -1;
            if(a[i][j] == '#') sharpnum++;
        }
    }
    int dx[2] = {1, 0}, dy[2] = {0, 1};
    queue<pair<int, int> > qu;
    qu.push(make_pair(0, 0));
    maxtesu[0][0] = 0;
    while(!qu.empty()){
        int x = (qu.front()).first;
        int y = (qu.front()).second;
        // cout << x << " " << y << " " << maxtesu[x][y] << endl;
        qu.pop();
        for(int i = 0; i < 2; i++){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx >= h || ny >= w || a[nx][ny] == '.') continue;
            if(maxtesu[nx][ny] < maxtesu[x][y] + 1){
                qu.push(make_pair(nx, ny));
                maxtesu[nx][ny] = maxtesu[x][y] + 1;
            }
        }
    }
    if(maxtesu[h - 1][w - 1] == sharpnum - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    string s;
    cin >> s;
    string t = s.substr(0,3);
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int num = 1;
    for(int i = 0;i<n;i++){
      int n1 = num * 2;
      int n2 = num + k;
      if(n1 < n2){
        num = n1;
      }else{
        num = n2;
      }
    }
    System.out.println(num);
  }
}


Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n;
    cin >> n;
    vector<ll> l(n);
    cin >> l;
    sort(l.begin(), l.end());
    int ans = 0;
    rep(i, n) repr(j, i + 1, n) repr(k, j + 1, n) {
        if (l[i] == l[j] || l[j] == l[k] || l[i] == l[k]) continue;

        if (l[i] + l[j] > l[k]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
	vector<int> a(5);
	for(int i=0; i<5; ++i){
		cin >> a[i];
		a[i] = max(a[i], 40);
	}
	cout << (accumulate(a.begin(), a.end(), 0) / 5) << endl;
	return 0;
}

Measured memory_bytes: 1192
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint H;
	cin >> H;

	lint now = 1, ans = 0;

	while (H) {
		ans += now;
		now *= 2;
		H /= 2;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
typedef long long ll;
const ll MAX=510000;
const ll mod = 1e9 + 7;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L,G;
ll ans;
string S,T;
ll y[101010];
ll a[201010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main(){
    cin>>A>>B>>C;
    cout<<max((ll)0,C-(A-B))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define BE(x) (x).begin(), (x).end()

int main() {
    int n, a;
    cin >> n;
    bool f = false;
    if (n & 1) f = true;
    vector<int> b;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (f) {
            if (i & 1) b.push_back(a);
            else b.insert(b.begin(),a);
        }
        else {
            if (i & 1) b.insert(b.begin(),a);
            else b.push_back(a);
        }
    }
    for (int i = 0; i < n; i++) {
        if (i == n-1) printf("%d\n", b[i]);
        else printf("%d ", b[i]);
    }
}

Measured memory_bytes: 4264
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    a = LI()
    s = 0
    for i in a:
        s ^= (i%2)
    if s:
        print("NO")
    else:
        print("YES")
    return

#B
def B():
    n = I()

    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 62320
#include<iostream>
#include<string>
using namespace std;
int main(){
int a,b; cin>>a>>b;
if(a>b && b!=1){
    cout<<"Alice";
}
else if(b>a && a!=1){
    cout<<"Bob";
}
else if(a == 1 && b!=1){
    cout<<"Alice";
}
else if (b ==1 && a!=1){
    cout<<"Bob";
}
else{
    cout<<"Draw";
}
}


Measured memory_bytes: 764
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
d = {0:1}
b = {1:0}
p = 0
for i in range(k):
    d[i + 1] = a[p]
    b[a[p]] = i + 1
    p = a[p] - 1
    if a[p] in b:
        k = (k - b[a[p]]) % (i + 2 - b[a[p]]) + b[a[p]]
        break
print(d[k])

Measured memory_bytes: 39008
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int func(int x) {
	if (x % 2 != 0)return 0;
	return 1 + func(x / 2);
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	ll K;
	cin >> S >> K;

	for (ll i = 0; i < K;i++) {
		if (S[i] != '1') {
			cout << S[i] << endl;
			return 0;
		}
	}
	cout << 1 << endl;
	return 0;
}


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

using namespace std;

#define maxn 100000
#define LL long long

LL gcd(LL a,LL b)
{
    if(!b) return a;
    else
        gcd(b,a%b);
}

LL pre[maxn], suf[maxn];
LL a[maxn];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    pre[0] = a[0];
    suf[n - 1] = a[n - 1];
    for (int i = 1; i < n; i++)
        pre[i] = gcd(pre[i - 1], a[i]);
    for (int i = n - 2; i >= 0; i--)
        suf[i] = gcd(suf[i + 1], a[i]);
    LL best = 1;
    for (int i = 0; i < n - 2; i++)
        best = max(best, gcd(pre[i], suf[i + 2]));
    best = max(best, max(pre[n - 2], suf[1]));
    cout << best;
    return 0;
}


Measured memory_bytes: 2560
#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;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  
  int flag=0;
  rep(i, n){
    if(a[i]%2==0){
      if(a[i]%3!=0 && a[i]%5!=0) flag=1;
    }
  }
  if(flag==1) cout << "DENIED" << endl;
  else cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF MOD
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;


int main() {
    Int n, m, k;
    cin >> n >> m >> k;
    Int a[n];
    Int b[m];
    rep(i,n) {
        cin >> a[i];
    }
    rep(i,m) {
        cin >> b[i];
    }
    vector<Int> sua;
    vector<Int> sub;
    sua.push_back(0);
    sub.push_back(0);

    rep(i,n) {
        sua.push_back(sua.back() + a[i]);
        if (sua.back() > 1000000000) break;
    }
    rep(i,m) {
        sub.push_back(sub.back() + b[i]);
        if (sub.back() > 1000000000) break;
    }
    Int ans = 0;
    rep(i,sua.size()) {
        Int re = k - sua[i];
        if (re < 0) {
            break;
        }
        auto itr = upper_bound(sub.begin(), sub.end(), re);
        Int cnt = i + itr - sub.begin() - 1;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 11112
//10-3 ???????????£???
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    bool flg = true;
    while(flg){
        int n,m;
        cin >> n;
        cin >> m;
        if(n==0 && m==0){
            flg = false;
        }
        else{
            int kankei[501][501] = {};

            for(int i=0; i<m; i++){
                int a,b;
                cin >> a >> b;
                kankei[a][b] = 1;
                kankei[b][a] = 1;
            }

            int friends[501] = {};
            friends[0] = -1;
            friends[1] = -1;
            int ans = 0;
            for(int i=2; i<n+1; i++){
                if(kankei[1][i]==1){
                    if(friends[i]==0){
                        friends[i] = 1;
                        ans++;
                    }
                    for(int l=2; l<n+1; l++){
                        if(kankei[i][l]==1){
                            if(friends[l]==0){
                                friends[l] = 1;
                                ans++;
                            }
                        }
                    }
                }
            }
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4076
#include<bits/stdc++.h>
using namespace std;
long long n,a[200000];
int main()
{
long long beg,end,x,ans=0;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
x=0;end=0;
for(beg=0;beg<n;beg++)
{
for(;(end<n)&&((x&a[end])==0);end++)
x^=a[end];
ans+=(end-beg);
x^=a[beg];
}
cout<<ans;
return 0;
}



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	string s, t;
	cin >> s >> t;
	
	string ss = s + s;
	
	bool res = false;
	rep(i, ss.size()) {
		rep(j, t.size()) {
			if (ss[i] == t[j]) { res = true; ++i;}
			else { res = false; break; }
		}
		if (res) break;
	}
	
	cout << (res ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int a,b,c,k,sum;
   cin>>a>>b>>c>>k;
   int x=(a >= b)?a:b;
   int y=(x >= c)?x:c;
   if (y == a)
    sum=b+c;
   else if (y == b)
    sum=a+c;
   else
    sum=a+b;
   for (int i = 0; i <k; i++)
   {
       y*=2;
   }
   cout<<sum+y<<endl;
    return 0;
}


Measured memory_bytes: 256
w, h, n = list(map(int, input().split()))
left = 0
right = w
lower = 0
upper = h

for i in range(n):
    x, y, a = list(map(int, input().split()))

    if a == 1:
        left = max(left, x)
    elif a == 2:
        right = min(x, right)
    elif a == 3:
        lower = max(lower, y)
    elif a == 4:
        upper = min(y, upper)

if left > right or lower > upper:
    print(0)
else:
    print((right-left)*(upper-lower))

Measured memory_bytes: 9176
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, k; cin >> n >> k;
  vector<lint> acc(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> acc[i];
    acc[i] += acc[i - 1];
  }

  for (int i = k + 1; i <= n; i++) {
    lint r = acc[i] - acc[i - k];
    lint l = acc[i - 1] - acc[i - k - 1];
    if (r > l) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }


  }
  return 0;
}


Measured memory_bytes: 4788
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int count = 0;
        scan.close();

        if(n > 1){
            count += n * (n-1) / 2;
        }
        if(m > 1){
            count += m * (m-1) / 2;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 23252
import java.util.*;

public class Main {
  public static void main(String[] args) {    
	Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    for(int i = 1; i < n + 1; i++) {
      int m = i;
      int sum = 0;
      while(m > 0) {
        sum += m % 10;
        m /= 10;
      }
      if(sum >= a && sum <= b) {
        arr.add(i);
      }
    }
    int ans = 0;
    for(Integer e : arr) {
      ans += e;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define EPS 1e-8
#define MAX_N 500000
#define fir first
#define sec second
using namespace std;
typedef double dnt;
typedef pair<dnt,dnt> pnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, l, r; dnt C, T, V;
pnt que[MAX_N+5], tot, mrg;
pnt operator + (const pnt &x, const pnt &y)
	{return pnt(x.fir+y.fir, x.sec+y.sec);}
pnt operator - (const pnt &x, const pnt &y)
	{return pnt(x.fir-y.fir, x.sec-y.sec);}
dnt operator * (const pnt &x, const pnt &y)
	{return x.fir*y.sec-x.sec*y.fir;}
int main() {
	read(n), read(C), read(T), read(V);
	printf("%.7lf\n", T);
	tot = que[r] = pnt(V, T*V);
	for (int i = 1; i < n; i++) {
		read(T), read(V); dnt lft = V;
		while (que[l].fir < lft-EPS)
			lft -= que[l].fir, tot = tot-que[l++];
		tot = tot-que[l];
		que[l].sec /= que[l].fir;
		que[l].fir -= lft;
		que[l].sec *= que[l].fir;
		tot = tot+que[l];
		mrg = pnt(V, T*V);
		while (l <= r && que[r]*mrg < -EPS)
			mrg = mrg+que[r--];
		tot = tot+pnt(V, T*V), que[++r] = mrg;
		printf("%.7lf\n", tot.sec/tot.fir);
	}
	return 0;
}


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

int main(void){
  string st;
  int n,ans=0;
  
  cin >> n >> st;
  for (int i=0; i<n-1; i++){
    if (st[i]!=st[i+1]){
      ans++;
      i++;
    }
  }
  cout << ans << endl;
    
  return 0;
}



Measured memory_bytes: 3312
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

int main() {
    double x;
    scanf("%lf", &x);
    double l = x / 3;
    printf("%.9lf\n", l * l * l);
}


Measured memory_bytes: 128
N=int(input())
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(key=lambda x:x[1])
#print(task)
for i in range(N):
    time=time+task[i][0]
    if not(time<=task[i][1]):
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")

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

int main() {
  int N, G, Y;
  string S;
  cin >> N;
  G = 0;
  Y = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "G") {
      G++;
    } else if (S == "Y") {
      Y++;
    } else {
      continue;
    }
  }
  
  if ((G == 0 && Y != 0)||(G != 0 && Y == 0)) {
    cout << "Three" << endl;
  } else if (G != 0 && Y != 0) {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    s = ns()
    t = ns()
    n = len(s)
    print(sum(1 for i in range(n) if s[i] != t[i]))
    return

solve()


Measured memory_bytes: 9356
str = raw_input()
countN = str.count("N")
countS = str.count("S")
firstPair = False
if (countN == countS) or (countN * countS != 0):
    firstPair = True

countE = str.count("E")
countW = str.count("W")
secondPair = False
if (countE == countW) or (countE * countW != 0):
    secondPair = True

if (firstPair * secondPair == 1):
    print "Yes"
else:
    print "No"


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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N,X;
map<ll,ll> mp;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>X>>N;
rep(i,N){
   ll p;
	cin>>p;
	mp[p]++;
}
if(!mp[X]){
	cout<<X<<endl;
	exit(0);
}
ll low=0;
for(ll i=X-1; i>=0; i--){
	if(!mp[i]){
		low=i;
		break;
	}
}
ll high=101;
for(ll i=X+1;i<=101; i++){
	if(!mp[i]){
		high=i;
		break;
	}
}
if(abs(X-low)==abs(X-high)){
	cout<<low<<endl;
}else{
	cout<<(abs(X-low)<abs(X-high)?low:high)<<endl;
}

}
	

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt", "r", stdin)
#define op1 freopen("C:\\acm\\Cproj\\in.txt","r",stdin);
#define pr freopen("C:\\acm\\Cproj\\out.txt","w",stdout)
#define pr2 freopen("C:\\acm\\Cproj\\std.txt","w",stdout)
#define pii pair<int,int>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
template <class T>
void read(T &val) { T x = 0; T bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int maxn = 1e6 + 11;
const int mod=1e9+7;
int n,m,x,y,t;
char s[maxn];

int main(){
    scanf("%s",s);
    int len = strlen(s),ans = 0;
    fo(i,0,len-1) ans+=s[i]-'0';
    if(ans%9) puts("No");
    else puts("Yes");
    return 0;
}

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

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

    string y = s.substr(0, 4);
    string m = s.substr(5, 2);
    string d = s.substr(8, 2);
    int yy = atoi(y.c_str());
    int mm = atoi(m.c_str());
    int dd = atoi(d.c_str());
    if(yy<2019){
        cout << "Heisei" << endl;
    }else if(yy>2019){
        cout << "TBD" << endl;
    }else{
        if(mm<=4){
            cout << "Heisei" << endl;
        }else{
            cout << "TBD" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for l in range(A+1):
  for m in range(B+1):
    for n in range(C+1):
      x = l * 500 + m * 100 + n * 50
      if x == X:
        counter += 1
print(counter)

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll as(n);
  rep (i, n) cin >> as[i];

  vll dp(n, 0);
  dp[0] = 1000;

  rep(i, n){
    if(i > 0) dp[i] = dp[i-1];
    rep(j, i){
      ll tmp = (dp[j]/as[j])*as[i] + dp[j]%as[j];
      chmax(dp[i], tmp);
    }
  }

  ll ans = dp.back();
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <math.h>
int main(){

  double S, h, C, L;
  int a, b;
  
  scanf("%d %d %lf",&a,&b,&C);
  
  C=M_PI/180*C;
  
  S = a*b*sin(C)/2;
  L = a+b+sqrt(a*a+b*b-2*a*b*cos(C));
  h = b*sin(C);
  
  printf("%lf\n",S);
  printf("%lf\n",L);
  printf("%lf\n",h);
  return 0;
}


Measured memory_bytes: 2112
/*
    Created by Ezio112
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define inf ll(10e16)
#define mod ll(10e8+7)
#define ff first
#define ss second
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        string s,t;
        cin>>s>>t;
        bool flag=true;
        if(s.size()==t.size()-1)
        {
            for(ll i=0;i<s.size();++i)
            {
                if(s[i]!=t[i])
                {
                    flag=false;
                    break;
                }
            }
        }
        else flag=false;
        if(flag)
        cout<<"Yes";
        else cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3652
n = list(map(int, input().split()))
n = n[0]
s = list(map(str, input().split()))
s = s[0]

ans = 0
maxim=0
for i in range(n):
    if(s[i] == 'I'):
        ans += 1
    else:
        ans-=1
    if(ans>maxim):
        maxim = ans



print(maxim)


Measured memory_bytes: 3060
import math

while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    #print(s)
    #print(sum(s))
    mean_s = sum(s)/n
    sum_ss = 0
    for i in range(n):
        ss = (s[i]-mean_s)**2
        sum_ss += ss
    print(math.sqrt(sum_ss/n))


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

int main() {
  int N, M, Q; 
  
  cin >> N >> M >> Q;
  
  int s[510][510]={0};
  
  for (int i = 0; i < M; i++) {
    int L, R; 
    cin >> L >> R;
    
    s[L][R]++;
  }
  
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      s[i][j] += s[i][j-1];
    }
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      s[i][j] += s[i-1][j];
    }
  }
  
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    cout << s[l-1][l-1] + s[r][r] - s[l-1][r] - s[r][l-1]  << endl;
  }
  
}


Measured memory_bytes: 1920
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));


        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.out.println("Memory increased:" + (usedMemoryAfter - usedMemoryBefore) / 1000000);
        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    public static class Task {
        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int n = sc.nextInt();
            int x = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
            }
            Arrays.sort(arr);
            int cnt = 0;
            int v = x;
            long sum = 0;
            for (int i = 0; i < n; i++) {
                if (x >= arr[i]) {
                    x -= arr[i];
                    cnt++;
                }
                sum += arr[i];
            }
            if (v > sum) {
                pw.println(n - 1);
                return;
            }
            pw.println(cnt);

        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b) / 2 << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;

bool ok(string str)
{
    // cout << str << endl;
    int n = str.length();
    for (int i = 0; i < n / 2; i++)
        if (str[i] != str[n - i - 1])
            return false;

    return true;
}

int main()
{
    char ip[111];
    scanf("%s", ip);

    string inp(ip);
    int n = strlen(ip);
    if (ok(inp) && ok(inp.substr(0, (n - 1) / 2)) &&
        ok(inp.substr((n + 3) / 2 - 1, n)))
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 256
// abc104_b
#include <cctype>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int cnt=0;
  string s;
  bool a_flag=false,c_flag=false;
  cin>>s;
  if (s[0] != 'A') {
    cout<<"WA"<<endl;
    return 0;
  }
  for (int i = 1, s_size = (int)s.size(); i < s_size; ++i) {
    if (isupper(s[i])) {
      if (i == 1 || i == s_size - 1 || s[i] != 'C') {
        cout<<"WA"<<endl;
        return 0;
      }
      cnt++;
    }
  }
  if (cnt != 1) {
    cout<<"WA"<<endl;
    return 0;
  }
  cout<<"AC"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  int m[N][N];
  rep(i, N) rep(j, N) cin >> m[i][j];
  ll sum = 0;
  rep(i, N) {
    rep(j, N) {
      sum += min(m[i][j], m[j][i]);
    }
  }

  cout << sum / 2 << endl;
  
  return 0;
}

Measured memory_bytes: 3220
#include <cstdio>
#include <climits>
#include <algorithm>

using namespace std;

int a, L;
int ans_j, ans_ai, ans_i_j;

int A[22];
int N[6];

int get_greatest() {
    sort(&N[0], &N[L]);
    int r = 0;
    for (int i = L - 1; i >= 0; i--) {
        r *= 10;
        r += N[i];
    }
    //printf("greatest: %d\n", r);
    return r;
}

int get_least() {
    sort(&N[0], &N[L]);
    int r = 0;
    for (int i = 0; i < L; i++) {
        r *= 10;
        r += N[i];
    }
    //printf("least   : %d\n", r);
    return r;
}

void solve() {
    A[0] = a;
    for (int i = 0; i <= 20; i++) {
        int b = A[i];
        for (int j = 0; j < L; j++) {
            N[j] = b % 10;
            b /= 10;
        }
        A[i + 1] = get_greatest() - get_least();
    }
    int ans_i = INT_MAX;
    for (int j = 0; j <= 20; j++) {
        for (int i = j + 1; i <= 20; i++) {
            if (A[i] == A[j]) {
                if (ans_i > i) {
                    ans_i = i;
                    ans_j = j;
                    ans_ai = A[i];
                    ans_i_j = i - j;
                }
            }
        }
    }
}

int main() {
    for (;;) {
        scanf("%d%d", &a, &L);
        if (!a && !L) { break; }
        solve();
        printf("%d %d %d\n", ans_j, ans_ai, ans_i_j);
    }
    return 0;
}

Measured memory_bytes: 1044
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <functional>
#include <string>
#include <stack>
#include <queue>
#include <map>

typedef long long ll;
ll mod = 1e9 + 7;
  
using namespace std;

int main()
{
	int n,k;
    string s;
	cin >> n >> s >> k;

    char c = s.at(k - 1);
 
    for(int i = 0; i < s.size(); i++)
    {
        if(s.at(i) == c)
            cout << c;
        else
        {
            cout << '*';
        }
    }
    cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

  long long A;
  long long B;
  
  cin >> A >> B;
  
  long long num5 = 9999900000;
  
  long long num = A;
  long long num2 = B;
  
  while(true){
    if(A > B){
      A = A - B;
    }
    else if(A < B){
      B = B - A;
    }
    else{
      break;
    }
  }
  
  long long num3 = num * num2;
  
  long long num4 = num3 / A;
    
  cout << num4 << endl;
  
}


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

int main() {
	int N, M;
	cin >> N >> M;
	int i, j;
	vector<int> X;
	for (i = 0; i < M; i++) {
		int x;
		cin >> x;
		X.push_back(x);
	}
	sort(X.begin(), X.end());
	if (N >= M) {
		cout << 0;
	}
	else {
		vector<int> gap;
		vector<int> gap_copy;
		for (i = 0; i < M - 1; i++) {
			gap.push_back(X.at(i + 1) - X.at(i));
			gap_copy.push_back(gap.at(i));
		}
		sort(gap.begin(), gap.end());
		reverse(gap.begin(), gap.end());
		int G = 0;
		for (i = 0; i < N - 1; i++) {
			G += gap.at(i);
		}
		cout << X.at(M - 1) - X.at(0) - G;
	}
	
}

Measured memory_bytes: 1912