akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"os"
)

func main() {
	var yes string = "YES"
	var no string = "NO"

	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)

	if a == 5 && b == 5 && c == 7 {
		fmt.Println(yes)
		os.Exit(0)
	}
	if a == 5 && b == 7 && c == 5 {
		fmt.Println(yes)
		os.Exit(0)
	}
	if a == 7 && b == 5 && c == 5 {
		fmt.Println(yes)
		os.Exit(0)
	}
	fmt.Println(no)
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
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--)

int H, W;
int C[500][500];

int count()
{
	rep(y, 0, H) rep(x, 0, W)
	{
		if (C[y][x] != '.') continue;

		int c[26];
		rep(i, 0, 26) c[i] = 0;

		if (y != H - 1) rep(yy, y + 1, H) if (C[yy][x] != '.') 
		{
			c[C[yy][x] - 'A']++;
			break;
		}
		if (y != 0) rrep(yy, y - 1, 0) if (C[yy][x] != '.')
		{
			c[C[yy][x] - 'A']++;
			break;
		}
		if (x != W - 1) rep(xx, x + 1, W) if (C[y][xx] != '.')
		{
			c[C[y][xx] - 'A']++;
			break;
		}
		if (x != 0) rrep(xx, x - 1, 0) if (C[y][xx] != '.')
		{
			c[C[y][xx] - 'A']++;
			break;
		}

		int ret = 0;
		rep(i, 0, 26) if (c[i] == 2) ret += 2;
		if (ret > 0)
		{
			rep(yy, 0, H) rep(xx, 0, W)
			{
				int cc = C[yy][xx] - 'A';
				if (c[cc] == 2) C[yy][xx] = '.';
			}

			return ret;
		}
	}

	return 0;
}

int main()
{
	cin >> H >> W;

	rep(y, 0, H)
	{
		string s; cin >> s;
		rep(x, 0, W) C[y][x] = s[x];
	}

	int ans = 0;
	while (1)
	{
		int d = count();
		if (!d) break;
		ans += d;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4196
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n; std::cin >> n;
  std::multiset<int, std::greater<int>> set;
  for (size_t i = 0; i < n; i++) {
    int x; std::cin >> x;
    set.insert(x);
  }
  int ret = 0;
  while (!set.empty()) {
    int x = *set.begin(); set.erase(set.begin());
    int y = std::pow(2, (int)std::log2(x) + 1) - x;
    auto it = set.find(y);
    if (it != set.end()) {
      ret++;
      set.erase(it);
    }
  }
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 9856
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	n2 := n << 1
	ll := make([]int, n2)
	for i := 0; i < n2; i++ {
		ll[i] = getNextInt(scanner)
	}
	sort.Ints(ll)
	ans := 0
	for i := 0; i < n; i++ {
		ans += ll[i<<1]
	}

	fmt.Println(ans)
	writer.Flush()
}


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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

const LL mod = 1000000007;

int main()
{
    LL x;
    cin >> x;

    cout << 2*(x/11)+(x%11!=0)+(x%11>6) << endl;
}

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

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int a[2][n];
	for(int i=0;i<n;i++){
		cin >> a[0][i];
	}
	for(int i=0;i<n;i++){
		cin >> a[1][i];
	}
	// keisan
	int s[2][n];
	s[0][0] = a[0][0];
	s[1][0] = a[1][0];
	for(int i=1;i<n;i++){
		s[0][i] = s[0][i-1] + a[0][i];
		s[1][i] = s[1][i-1] + a[1][i];
	}
	int max = a[0][0] + s[1][n-1];
	for(int i=1;i<n;i++){
		if(s[0][i]+s[1][n-1]-s[1][i-1] > max){
			max = s[0][i] + s[1][n-1] - s[1][i-1];
		}
	}
	cout << max;
}

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

using namespace std;
using ll = long long;


int main()
{
    int a, b, c, k;cin >> a >> b >> c >> k;
    if(a + b >= k) {
        cout << min(a, k) << endl;
    } else {
        cout << a - (k - (a + b)) << endl;
    }
}

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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  int tmp, cnt = 0, ans = 0;
  cin >> tmp;

  for (int i = 0; i < N - 1; i++) {
    int H;
    cin >> H;
    if (H <= tmp) cnt++;
    else cnt = 0;
    if (cnt > ans) ans = cnt;
    tmp = H;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int n, m;
  int lb, ub;
  cin >> n >> m;
  lb = 1;
  ub = n;

  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    lb = max(l, lb);
    ub = min(r, ub);
  }
  cout << max(0, ub - lb + 1) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  ll n = s.length();
  ll ans = 1 + (n-1)*n/2;
  unordered_map<char,ll> mp;
  rep(i,n) {
    mp[s[i]]++;
  }
  for (auto&& p : mp) {
    ll cnt = p.second;
    if (cnt >= 2) ans -= cnt*(cnt-1)/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,ans=0,cnt=1;
    scanf("%lld",&n);
    while(n){
        ans+=cnt;
        n/=2;
        cnt*=2;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i,score[5],sum = 0,ave;
	for(i = 0;i < 5;i++){
		scanf("%d",&score[i]);
		if(score[i] < 40){
			sum += 40;
		}else{
		sum += score[i];
		}
	}
	ave = sum / 5;
	printf("%d\n",ave);
	return 0;
}

Measured memory_bytes: 600
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		HashMap<Integer, String> map = new HashMap<>();
		for (int i = 0; i < N; i++) {
			map.put(i, sc.next());
		}

		boolean ans = true;
		HashMap<Integer, String> past = new HashMap<>();
		String next = "";

		for (int i = 0; i < N; i++) {
			if (past.containsValue(map.get(i))) {
				ans = false;
				break;
			}
			past.put(i, map.get(i));
			if (i != 0) {
				if (!next.equals(map.get(i).substring(0, 1))) {
					ans = false;
					break;
				}
			}
			next = map.get(i).substring(map.get(i).length()-1, map.get(i).length());
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 24788
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R' && i < n - 1 && s[i + 1] == s[i]) ans++;
		else if (s[i] == 'L' && i && s[i - 1] == s[i]) ans++;
	}
	ans = min(n - 1, ans + k * 2);
	cout << ans;
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 512
import glob
import math


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\169\\D'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    alph = []

    def rec(self, result, now, max, N):

        if now == N:
            res = ""
            for i in result:
                res += self.alph[i]
            print(res)
            return

        if now == 0:
            result[0] = 0
            self.rec(result, now+1, 0, N)
            return

        for i in range(0, max+2):
            if i == N:
                return
            result[now] = i
            if i > max:
                self.rec(result, now+1, i, N)
            else:
                self.rec(result, now+1, max, N)

    def resolve(self):

        count = 0

        N = int(self.input_data())
        # 現実的に割れるかの確認をすれば十分な最大値
        n = int(math.sqrt(N))

        result = 0
        now = 2
        while now <= N:
            count = 0
            while True:
                if N % now == 0:
                    N = int(N / now)
                    count += 1
                else:
                    break
            for i in range(1,10000):
                if i <= count:
                    result += 1
                    count -= i
                else:
                    break

            now += 1

            if now > n:
                result += 1
                break



        print(str(result))

solver = Solver(REL_PATH)
solver.exec_resolve()


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

using namespace std;

#define whole(xs) (xs).begin(), (xs).end()

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os << "]";
    }
    template<class T> istream& operator>>(istream& is, vector<T>& vs) {
        for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
        return is;
    }

    int N;
    vector<int> A;
    void input() {
        cin >> N;
        A.resize(N); cin >> A;
    }

    const int INF = 1<<28;

    int cost(int x, int y) {
        int ret = 0;
        int c = 0;
        for (int i = 0; ; i++) {
            if (x == 0 && y == 0 && c == 0) break;
            int xi = x % 10; x /= 10;
            int yi = y % 10; y /= 10;
            ret += xi * yi + c;
            if (xi + yi + c >= 10) c = 1;
            else c = 0;
        }
        return ret;
    }

    void solve() {

        vector<int> sum(N + 1, 0);
        for (int i = 0; i < N; i++) {
            sum[i + 1] = sum[i] + A[i];
        }

        vector< vector<int> > dp[2];
        for (int i = 0; i < 2; i++) dp[i] = vector< vector<int> >(N, vector<int>(N + 1, INF));

        for (int i = 0; i + 1 <= N; i++) {
            dp[0][i][i + 1] = 0;
        }

        for (int k = 2; k <= N; k++) {
            dp[1] = dp[0];
            for (int i = 0; i + k <= N; i++) {
                for (int j = 1; j < k; j++) {
                    //cerr << k << " " << i << " " << j<< endl;
                    dp[0][i][i + k] = 
                        min (
                            dp[0][i][i + k], 
                            dp[1][i][i + j] + dp[1][i + j][i + k] + cost(sum[i + j] - sum[i], sum[i + k] - sum[i + j])
                        );
                }
            }
        }
        //cout << dp[0] << endl;
        cout << dp[0][0][N] << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}
 

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

#define pb push_back

using namespace std;

typedef long long ll;

const int maxn=1e3+10;

char ch[110][110];

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=1 ; i<=n ; i++)
        for(int j=1 ; j<=m ; j++)
            cin>>ch[i][j];
    for(int i=1 ; i<=2*n ; i++)
    {
        for(int j=1 ; j<=m ; j++)
            cout<<ch[(i+1)/2][j];
        if(i<2*n)
            cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let mut v = vec![0; k];
    for i in 1..=n {
        v[i % k] += 1;
    }

    let mut ans: i64 = v[0] * v[0] * v[0];
    if k % 2 == 0 {
        ans += v[k / 2] * v[k / 2] * v[k / 2];
    }

    println!("{}", ans);
}


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

int main() {
  int x, y;
  cin >> x >> y;
  if (x > y) {
    if (x<0)
      cout << (abs(y) - abs(x)) + 2 << endl;
    else if (x==0)
      cout << abs(y) + 1 << endl;
    else if (x>0&&y<0)
      cout << abs(x+y) + 1 << endl;
    else if (x>0&&y==0)
      cout << x+1 << endl;
    else if (x>0&&y>0)
      cout << (x-y) + 2 << endl;
  }
  else if (x < y) {
    if (x<0&&y==0) 
      cout << abs(x) << endl;
    else if (x<0&&y<0)
      cout << abs(x) - abs(y) << endl;
    else if (x<0&&y>0)
      cout << abs(x+y) + 1 << endl;
    else if (x==0)
      cout << y << endl;
    else if (x>0)
      cout << y-x << endl;
  }
  return 0;
}
     
    
      
      


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

#define REP(i,n) for(decltype(n) i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(c) ((int)((c).size()))
#define st first
#define nd second
#define pb push_back

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

void solve(){
    int N;
    int time=0, x=0, y=0, t, a, b;
    cin>>N;
    while(N--){
        cin>>t>>a>>b;
        int dist = abs(a-x) + abs(b-y);
        if(dist > t - time || dist%2 != (t-time)%2){
            cout<<"No";
            return;
        }
        time = t;
        x = a;
        y = b;
    }
    cout<<"Yes";
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
void main() {
	rs.count!(i => i == '2').writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

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

    int ans=-1;

    for(int i=50000;i>=1;i--){
        if(int(i*1.08)==N){ans = i;}
    }

    if(ans!=-1) cout << ans << endl;
    else cout << ":(" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
string a,mix,in;
cin>>a;
int sum=0;

while(1){
    cin>>in;
    if(in=="END_OF_TEXT")break;
    for(int i=0;i<in.size();i++){
        in[i] = tolower( in[i] );
    }
    if(in==a)sum++;
}

cout<<sum<<endl;

}




Measured memory_bytes: 3164
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define vi vector < ll  int >
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007
    using namespace std;

    #define MAXN 1000005
    int spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }


    vector<int> gf(int x)
    {
        vector<int> ret;
        while (x != 1)
        {
            ret.push_back(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }
    int BIT[100050];
    void upd(int x) { ++x;  while(x<=MAXN)  {  BIT[x]++;  x+=(x&-x);  } }
    int cal(int x) {  ++x;  int res=0;  while(x>0)  {  res+=BIT[x];  x-=(x&-x);  } return res; }

    ll mod=hell;
    ll pr( ll x , ll y)
    {
        ll ans=1;
        if(y==0) return ans;
        while(y>1)
        {
            if(y&1) ans*=x;
            x*=x;
            y/=2;
            x%=mod;
            ans%=mod;
        }
        ans*=x;
        ans%=mod;
        return ans;
    }
    ll inv(ll n)
    {
        return pr(n,mod-2);
    }
    ll stoi(string s)
    {
        int n=s.size();
        ll k=0; int i;
        rep(i,0,n)
        {
            k+=s[i]-'0';
            k*=10;
        }
        return k/10;
    }
    string to_string(ll n)
    {  if(!n) return "0";
        string s=""; int a,b;
        while(n>0)
        {
            b=n%10;
            s+=(b+'0');
            n/=10;
        }
        reverse(all(s));
        return s;
    }
  ll invvf[1000500],fact[1000500];
  void pre()
  {
      ll i,j,n=1000050;
      fact[0]=1; fact[1]=1;
      rep(i,2,n) {fact[i]=fact[i-1]*i; fact[i]%=hell;}
      invvf[1]=1; invvf[0]=1;
      rep(i,2,n)
      {
          invvf[i]=inv(fact[i]);
      }

  }
 ll ncr(ll n , ll r)
 {
     ll y=fact[n];
     y*=invvf[r];
     y%=hell;
     y*=invvf[n-r];
     y%=hell;
     return y;
 }


int phi(int n) {
    int result = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}
    void solve()
    {
    long long  i,j=0,r=200,p,q,k=0,d,y=0,n,h=100000000000000,flag=0,m=0,a=hell,b=hell,id,h1,h2,a1,b1,a2,w,x,u,f,l,c=0,e,ans=0;
      cin>>n>>m;
     n*=500;
     if(n>=m) cout<<"Yes";
     else cout<<"No";

    }
    signed main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
        //sieve();
        //pre();
        //cin>>t;
        while(t--)
        solve();
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b;
  if((a+b)%2==0){
    cout<<(a+b)/2<<endl;
  }else{
    c=(a+b)/2;
    cout<<c+1<<endl;
  }
  
  
}

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

int main() {
    string S;
    cin >> S;
    int N = S.length();
    int c = 0;
    int c2 = 0;

    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            if (S.at(i) == '0') {
                c++;
            } else {
                c2++;
            }
        } else {
            if (S.at(i) == '0') {
                c2++;
            } else {
                c++;
            }
        }
    }

    cout << min(c, c2) << endl;
}

Measured memory_bytes: 512
n=int(input())
lst=list(map(int,input().split()))
lst.sort(reverse=True)
Alice=0
Bob=0
for i in range(n):
  if i%2==0:
    Alice+=lst[0]
    del lst[0]
  else:
    Bob+=lst[0]
    del lst[0]
print(Alice-Bob)

Measured memory_bytes: 3060
#include<cstdio>
#define M 200005
int A[M];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	int mx1=0,mx2=0;
	for(int i=1;i<=n;i++){
		if(A[i]>mx1){
			mx2=mx1;
			mx1=A[i];
		}else if(A[i]>mx2){
			mx2=A[i];
		}
	}
	for(int i=1;i<=n;i++){
		if(mx1==A[i])printf("%d\n",mx2);
		else printf("%d\n",mx1);
	}
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string s;
    cin>>s;
    int n=s.size();
    deque<char> v;
    rep(i,n) {
        char x=s[i];
        if(x=='B') {
            if(v.size()==0) continue;
            v.pop_back();
            continue;
        }
        v.pb(x);
    }
    rep(i,v.size()) cout<<v[i];
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
        String x=sc.next();

if(x.equals("ABC")){
    System.out.println("ARC");
}
        if(x.equals("ARC")){
            System.out.println("ABC");
        }


    }
}

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

int main() {
    int n;cin>>n;
    int ans = 0;
    for(int i=n;i>0;--i){
        string tmp = to_string(i);
        if(tmp.size()%2==1)++ans;
    }
    cout<<ans<<endl;
	return 0;
}

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

int main(void){
    ll n;
    cin >> n;
    ll ans = n*(n-1)/2;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int c[3][3],i,j;
  bool ans=true;
  for (i=0;i<3;i++){
    for (j=0;j<3;j++){
      scanf("%d",&c[i][j]);
    }
  }
  for (i=0;i<2;i++){
    if (c[i][0]-c[i+1][0]!=c[i][1]-c[i+1][1]||c[i][1]-c[i+1][1]!=c[i][2]-c[i+1][2]){
      ans=false;
      break;
    }
  }
  if (!ans){
    printf("No\n");
    return 0;
  }
  for (i=0;i<2;i++){
    if (c[0][i]-c[0][i+1]!=c[1][i]-c[1][i+1]||c[1][i]-c[1][i+1]!=c[2][i]-c[2][i+1]){
      ans=false;
      break;
    }
  }
  printf("%s\n",(ans)? "Yes":"No");
  return 0;
}

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

#define _   int v, int tl, int tr, int l, int r
#define tm  (tl + tr >> 1)
#define sol v+v, tl, tm, l, r
#define sag v+v+1, tm+1, tr, l, r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 1 << 18;

pp mx[N], mx2[N];

signed main(){
    int n;
    cin >> n;
	for(int i=0; i<(1 << n); i++){
        scanf("%d", &mx[i].st);
        mx[i].nd = i;
    }

    for(int i=0; i<(1 << n); i++)
    	for(int j=0; j<n; j++){
            if((i & (1 << j)) == 0){
                int t = i | (1 << j);
                if(mx[i].nd != mx[t].nd){	
                	if(mx[t].st < mx[i].st){
                        mx2[t] = mx[t];
                        mx[t] = mx[i];
                    }
                    else mx2[t] = max(mx2[t] , mx[i]);
                }
                mx2[t] = max(mx2[t] , mx2[i]);
    		}
        }
    
    int ans = 0;
    for(int i=1; i<(1 << n); i++){
        ans = max(ans , mx[i].st + mx2[i].st);
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 7168
#include <cmath>
#include<iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
using namespace std;
 
int main(){    
  int N;
  cin >> N;

  if((N+1)%27 == 0 || (N+14)%27 == 0){
    cout << ":(" << endl; 
  }
  else{
    int N2 = (ceil)(N*100.0/108.0);
    cout << N2 << endl;
  }
}

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

using namespace std;

class SegTree {
public:
	enum { N = 8192 };
	SegTree() : val(2*N-1), idx(2*N-1) {}
	void init(){
		for(int i=0;i<val.size();i++){
			val[i] = idx[i] = 0;
		}
	}
	void setVal(int v, int i){
		int t = i + N - 1;
		val[t] = v;
		idx[t] = i;
		while(t){
			t = (t-1)/2;
			if(val[t] < v){
				val[t] = v;
				idx[t] = i;
			}
		}
	}
	pair<int, int> get(int l, int r, int p=0, int a=0, int b=N){
		if(b <= l || r <= a) return make_pair(-1, -1);
		if(l <= a && b <= r) return make_pair(val[p], idx[p]);
		return max(get(l, r, 2*p+1, a, (a+b)/2), get(l, r, 2*p+2, (a+b)/2, b));
	}
private:
	vector<int> val;
	vector<int> idx;
};

long long cost[5001][5001];
SegTree seg;

void update(int l, int r){
	if(l >= r) return;
	pair<int, int> p = seg.get(l, r);
	cost[l][p.second] += p.first;
	cost[l][r] -= p.first;
	cost[p.second+1][p.second] -= p.first;
	cost[p.second+1][r] += p.first;
	update(l, p.second);
	update(p.second+1, r);
}

int main(){
	std::ios_base::sync_with_stdio(false);
	int N, M;
	long long A[5000];
	static long long B[5000][200];
	while(cin >> N >> M){
		for(int i=0;i<=N;i++){
			for(int j=0;j<N;j++) cost[i][j] = 0;
		}
		A[0] = 0;
		for(int i=1;i<N;i++) cin >> A[i];
		for(int i=1;i<N;i++) A[i] += A[i-1];
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++) cin >> B[i][j];
		}
		for(int i=0;i<M;i++){
			seg.init();
			for(int j=0;j<N;j++) seg.setVal((int)B[j][i], j);
			update(0, N);
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++) cost[i][j+1] += cost[i][j];
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++) cost[j+1][i] += cost[j][i];
		}
		long long res = 0;
		for(int i=0;i<N;i++){
			for(int j=i;j<N;j++){
				res = max(res, cost[i][j] - A[j] + A[i]);
			}
		}
		cout << res << endl;
	}
}


Measured memory_bytes: 203648
#include<bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define pb push_back
using namespace std;

const int N = (1<<20);



inline void test_case(){
        int n;
        cin >> n;
        double d = 2/(2*tan(3.14159265359/n/2));
        //cout << d << endl;
        printf("%.10f\n",sqrt(1+d*d));
}

int main(){
        ios::sync_with_stdio(0); //cin.tie(0); cout.tie(0);
        int n;
        cin >> n;
        int dig = n%10;
        if(dig==3){
             cout << "bon" <<endl;
        } else
        if(dig ==0 || dig ==1 || dig == 6 || dig == 8){
                cout << "pon" << endl;
        } else {
                cout<<"hon"<<endl;
        }
}


Measured memory_bytes: 3640
#include<stdio.h>
#define NIL -1

typedef struct{
  int parent,sibling,leftgaki,rightgaki,degree;
}Node;

Node tree[100001];
int count=0,count3=0; //再帰関数、子供表示用
int count2[100001];
int n;
int retdepth(int id){ //再帰で根っこまでの長さを計る
  if (tree[id].parent==NIL){
    return count/2;
  } else {
    count++;
    return retdepth(tree[id].parent);
  }
}

void retheight(int id,int countid,int startdepth,int depth){ //逆に葉っぱまでの長さを返す
  int i,newcountid;
  for (i=1;i<n;i++){
    if (count2[i]==0){
      newcountid=i;
      break;
    }
  }
  //printf("->tree[%d]search. countid=%d, newcountid=%d, left=%d,right=%d.height=%d\n",id,countid,newcountid,tree[id].leftgaki,tree[id].rightgaki,count2[countid]);
  if (tree[id].leftgaki!=NIL && tree[id].rightgaki!=NIL){
    count2[countid]++;
    count2[newcountid]=depth-startdepth+1;
    retheight(tree[id].leftgaki,countid,startdepth,depth+1);
    retheight(tree[id].rightgaki,newcountid,startdepth,depth+1);
  } else if (tree[id].leftgaki!=NIL){
    count2[countid]++;
    retheight(tree[id].leftgaki,countid,startdepth,depth+1);
  } else if (tree[id].rightgaki!=NIL){
    count2[countid]++;
    retheight(tree[id].rightgaki,countid,startdepth,depth+1);
  } else {
    count3=countid;
  }

}

int returnheight(int id,int depth){
  int i,ret=0;
  for (i=0;i<n;i++){
    count2[i]=0;
  }
  retheight(id,0,depth,depth);
  for(i=0;i<count3+1;i++){
    if(ret<count2[i]){
      ret = count2[i];
    }
  }
  return ret;

}


int main(){
  int i,j,nownode,deg,leftgaki,rightgaki;

  scanf("%d",&n);
  for (i=0;i<n;i++){
    tree[i].parent=tree[i].degree=tree[i].sibling=tree[i].leftgaki=tree[i].rightgaki=NIL;
    //NILで初期化を行う
  }

  for (i=0; i<n; i++){
    scanf("%d%d%d",&nownode,&leftgaki,&rightgaki);
    count=0;
    if (leftgaki!=-1){
      tree[leftgaki].parent=nownode;
      tree[leftgaki].sibling=rightgaki;
      tree[nownode].leftgaki=leftgaki;
      count++;
    }
    if (rightgaki!=-1){
      tree[rightgaki].parent=nownode;
      tree[rightgaki].sibling=leftgaki;
      tree[nownode].rightgaki=rightgaki;
      count++;
    }
    tree[nownode].degree=count;
  }

  //---------------------
  //表示部分
  
  for(i=0; i<n; i++){
    count=count3=0;
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,tree[i].parent,tree[i].sibling,tree[i].degree,retdepth(i),returnheight(i,retdepth(i)));
    if(tree[i].parent == NIL){
      printf("root\n");
    } else if(tree[i].leftgaki == NIL && tree[i].rightgaki == NIL){
      printf("leaf\n");
    } else {
      printf("internal node\n");
    }
  }
  
  return 0;
}

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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> height(n);
    for (int i = 0; i < n; ++i) 
        cin >> height[i];
    vector<int> dp(n, INT_MAX/2);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) 
        for (int j = i+1; j <= i+k; ++j) 
            if (j < n) dp[j] = min(dp[j], dp[i] + abs(height[i] - height[j]));    
    cout << dp[n-1] << '\n';
}

Measured memory_bytes: 1024
import math 
a, b, x =map(int, input().split())

nokori = a*a*b-x

if nokori <= x:
    c = nokori /a /a *2
    ans = math.degrees(math.atan2(c,a))
else:
    c = x/a/b*2
    ans =math.degrees(math.atan2(b,c))
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define MOD 1000000007
#define DEBUG 0
#define LLIMAX 9223372036854775807
#define INF 1e16;
#define REP(i,n) for(int i=0;i<n;i++)
 
bool isJudge(lli a,lli b,lli num,vector<lli> *h){
	if(DEBUG)cout<<num<<endl;
	vector<lli> calc(h->size());
	REP(i,h->size())calc[i] = h->at(i);

	REP(i,h->size())calc[i]-=(b*num);
	lli c = a-b;
	lli cnt=0;
	REP(i,h->size()){
		if(calc[i]<=0)continue;
		cnt += ((calc[i]/c) + (calc[i]%c!=0));
	}
	return cnt <= num;
}
 
int main(){

	lli n,a,b;
	cin>>n>>a>>b;
	lli c = a-b;

	vector<lli> h(n);
	REP(i,n)cin>>h[i];
 
	sort(h.begin(),h.end());

	/*二分探索で解く*/
	lli big   = 1e9;
	lli small = 0;
	lli middle = (big+small)/2;
	while(big>small+1){
		middle = (big+small)/2;
		if(isJudge(a,b,middle,&h)){
			if(DEBUG)cout<<"true"<<endl;
			big = middle;
		}
		else {
			if(DEBUG)cout<<"false"<<endl;
			small = middle;
		}
	}
	cout<<big<<endl;

	return 0;
 
}

Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    H,A=mis()
    print(math.ceil(H/A))


main()


Measured memory_bytes: 5684
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<ll> al(26,1);
	for(int i = 0; i < s.size(); i++){
		al[s[i]-'a']++;
	}
	ll ans=1;
	for(int i = 0; i < 26; i++){
		ans *= al[i];
		ans %= mod;
	}
	cout << ans-1 << endl;

	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
 
int main()
{
	int i,cnt=0;
	char s[4];
	scanf("%s",s);
	for(i=0;i<3;i++)
	{
		if(s[i]=='1')
		{
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
import numpy as np

inputData = input().split()
N, K, Q = [int(x) for x in inputData]
points = np.array([K]*N)

for i in range(Q):
    A = int(input())
    points[A-1] += 1
points -= Q
for j in range(N):
    if points[j] > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 20528
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
using namespace std;
int main(){
	string s;
	vector<char> v;
	cin>>s;
	for(int i=0;i<s.size();++i){
		if(s[i]=='B'){
			if(!v.empty())
				v.pop_back();
		}
		else
			v.pb(s[i]);
	}
	for(int i=0;i<v.size();++i)
		cout<<v[i];
	cout<<endl;
}

Measured memory_bytes: 256
N = int(input())

l = [chr(i) for i in range(97, 97+26)]
#print(l)

ans = []

while True:
    ans.append(l[int(N%26) -1])
    #print(N)
    if N <= 26:
        break
    if not N%26:
        N -= 1
        N = int(N//26)
    else:
        N = int(N//26)



ans.reverse()
print("".join(ans))

Measured memory_bytes: 9192
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let solver = {
        let n: usize = scan(tokens);
        let m: usize = scan(tokens);
        let (a, b): (Vec<usize>, Vec<usize>) = {
            let mut ab: Vec<(usize, usize)> = rep(n, || (scan(tokens), scan(tokens)));
            ab.sort();
            ab.into_iter().unzip()
        };
        let mut edges = vec![Vec::new(); n + 1];
        for j in 1..m + 1 {
            let (l, r): (usize, usize) = (scan(tokens), scan(tokens));
            let (l, r) = (binsearch(l, &a), binsearch(r + 1, &a));
            if l < r {
                edges[l].push((r, j));
                edges[r].push((l, j));
            }
        }
        let mut odd = Vec::with_capacity(n + 1);
        odd.push(0 != b[0]);
        for i in 1..n {
            odd.push(b[i - 1] != b[i]);
        }
        odd.push(b[n - 1] != 0);
        Solver {
            n: n + 1,
            edges: edges,
            odd: odd,
            visited: vec![false; n + 1],
            to_cut: Vec::new(),
        }
    };
    if let Some(edges) = solver.solve() {
        println!("{}", edges.len());
        if !edges.is_empty() {
            print!("{}", edges[0]);
            for &j in &edges[1..] {
                print!(" {}", j);
            }
        }
        println!("");
    } else {
        println!("-1");
    }
}

struct Solver {
    n: usize,
    odd: Vec<bool>,
    edges: Vec<Vec<(usize, usize)>>,
    visited: Vec<bool>,
    to_cut: Vec<usize>,
}

impl Solver {
    fn solve(mut self) -> Option<Vec<usize>> {
        for i in 0..self.n {
            if self.visit(i) % 2 == 1 {
                return None;
            }
        }
        self.to_cut.sort();
        Some(self.to_cut)
    }
    fn visit(&mut self, i: usize) -> usize {
        if self.visited[i] {
            return 0;
        }
        self.visited[i] = true;
        let mut cnt = 0;
        if self.odd[i] {
            cnt += 1;
        }
        for (i1, j) in self.edges[i].clone() {
            let tmp = self.visit(i1);
            if tmp % 2 == 1 {
                self.to_cut.push(j)
            }
            cnt += tmp;
        }
        cnt
    }
}

fn binsearch(x: usize, a: &[usize]) -> usize {
    if a.len() == 0 || x <= a[0] {
        return 0;
    }
    let mut i = 0;
    let mut j = a.len();
    while i + 1 < j {
        let k = (i + j) / 2;
        if a[k] < x {
            i = k;
        } else {
            j = k;
        }
    }
    j
}


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

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

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))

/* 値を入れ替える関数 */
void swap (LL *x, LL *y) {
  LL temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
LL partition (LL array[], LL left, LL right, LL A[]) {
  LL i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); swap(&A[i], &A[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新
  swap(&A[pivot], &A[j]);

  return j;
}

/* クイックソート */
void quick_sort (LL array[], LL left, LL right, LL A[]) {
  LL pivot;

  if (left < right) {
      pivot = partition(array, left, right, A);
      quick_sort(array, left, pivot-1, A);   // pivotを境に再帰的にクイックソート
      quick_sort(array, pivot+1, right, A);
  }
}
int main()
{
    LL N;
    scanf("%lld", &N);
    LL A[N], B[N], num_works = 0;

    for(int i = 0;i < N; i++) scanf("%lld %lld", &A[i], &B[i]);

    quick_sort(B, 0, N-1, A);   
    for(int i = 0;i < N; i++){
        num_works += A[i];
        if(num_works > B[i]) {printf("No \n");return 0;}
    }
    printf("Yes \n");
    
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main(){
  int H,W;
  while(cin >>H>>W && !(H==0 && W==0)){
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(i==0 || j==0 || i==H-1 ||j==W-1)cout <<"#";
      else cout<<".";}
    cout<<endl;}

  cout<<endl;}
  return 0;
  }

Measured memory_bytes: 1152
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else if(a == b){
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {
            //10の18乗より、2の5兆-1乗の方が大きい。
            //そのため、1が入ってこなければ、最初に指定された数字がK番目の文字となる。
            //頭に「1」が入っていて、その数字より下のK番目が指定された場合は「1」となる。
            //
            // Ex: 
            //  111222 
            //  3
            //  Ans:1
            //
            // Ex: 
            //  111222 
            //  4
            //  Ans:2
            // 答えが「1」になる条件(以下全てを満たす)
            // ・文字列Sの最初に出てくる「1」以外の文字が出てくるのがが101番目以下
            // ・Kが100以下(1～100)
            // ・K < 文字列Sの最初に「1」以外が出てきた場所

            string S = Console.ReadLine();
            string K = Console.ReadLine();

            for (var cnt = 0; cnt < long.Parse(K) ; cnt++)
            {
                string diff = S[cnt].ToString();
                if (diff != "1")
                {
                    Console.WriteLine(diff);
                    return;
                }
            }

            Console.WriteLine("1");
        }

        
    }
}


Measured memory_bytes: 13140
using System;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string ans = "";
        for(int i = 0; i < s.Length; i++)
        {
            if (i == 4) ans += " ";
            ans += s[i];
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 2648
import sys
from collections import defaultdict, deque

input = sys.stdin.readline


def main():
    N = int(input())
    f_inf = float('inf')
    # DP テーブルを初期化　(最小化問題なので INF に初期化)
    MAX_N = 110000
    dp = [[]] * N
    for i in range(N):
        a, b, c = map(int, input().split())
        if i == 0:
            dp[i] = [a, b, c]
        else:
            dp[i] = [max(dp[i-1][1], dp[i-1][2]) + a, max(dp[i-1][0], dp[i-1][2]) + b, max(dp[i-1][0], dp[i-1][1]) + c]
    print(max(dp[N-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 23028
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n+1],i,k;
  for(i=0;i<=n;i++){
    a[i]=0;
  }
  for(i=1;i<n;i++){
    scanf("%d",&k);
    a[k]++;
  }
  for(i=1;i<=n;i++){
  printf("%d\n",a[i]);
  }
  return 0;
}


Measured memory_bytes: 2504
#include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long ll;
const ll INF=1e9+7;

ll max(ll a,ll b){
	if(a>b)return a;
	return b;
}

int main(){
	int n;
	cin>>n;
	int f[n][5][2],p[n][11];
	rep(i,n){
		rep(j,5){
			rep(k,2){
				cin>>f[i][j][k];
			}
		}
	}
	rep(i,n){
		rep(j,11){
			cin>>p[i][j];
		}
	}
	ll ans=-INF;
	loop(i,1,1<<10){
		int hmt[n];
		fill(hmt,hmt+n,0);
		rep(k,n){
			rep(j,10){
				int dow=j/2,time=j%2,josino=i&(1<<j);
				if(f[k][dow][time]&&josino)hmt[k]++;
			}
		}
		ll sum=0;
		rep(k,n){
			sum+=p[k][hmt[k]];
		}
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else if (a == b) {
			System.out.println("a == b");
		}
	}
}


Measured memory_bytes: 17292
n = int(input())
a = list(map(int,input().split()))

flag = False
doit = 0
while flag == False:
    counter = 0
    for x in a:
        if x % 2 == 1:
            flag = True
        else:
            a[counter] = x / 2
            counter += 1
    doit += 1
print(doit - 1)

Measured memory_bytes: 9128
N = int(input())
zahyo = [tuple(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        height_set = set(hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in zahyo if hi > 0)
        if len(height_set) == 1:
            H = max(height_set)
            if all(set(hi == max(H - abs(xi-cx) - abs(yi-cy), 0) for xi, yi, hi in zahyo if hi == 0)):
                print(cx, cy, max(height_set))
                exit()

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
    int n,t,R[200000],j,i;
    scanf("%d",&n);
    for(t=0;t<n;t++){
        scanf("%d",&R[t]);
    }
    
    int min=R[0];
    int max=R[1]-R[0];
    
    for(i=1;i<n;i++){
        if(max<(R[i]-min)) max=R[i]-min;
        if(min>R[i]) min=R[i];
    }
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 2492
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair < int , int > pii;
#define mpr make_pair
#define FS first
#define SC second
#define PB push_back
template < typename T > void UMAX(T &a,T b){a=(a>b?a:b);}
template < typename T > void UMIN(T &a,T b){a=(a<b?a:b);}
LL readint(){
	char c=getchar();
	LL ret=0ll;
	bool neg=0;
	while(!(c>='0' && c<='9')){
		if(c=='-') neg=1;
		c=getchar();
	}
	while(c>='0' && c<='9'){
		ret=ret*10ll+(LL)(c-'0');
		c=getchar();
	}
	return neg?-ret:ret;
}
void putint(LL v){
	if(v<0){
		putchar('-');
		v=-v;
	}
	if(!v){
		putchar('0');
		return;
	}
	if(v>=10ll) putint(v/10ll);
	putchar('0'+(v%10ll));
}
const int MOD=998244353;
int powM(int V,int T=MOD-2){
	int R=1;
	while(T){
		if(T&1) R=(LL)R*V%MOD;
		T>>=1;
		V=(LL)V*V%MOD;
	}
	return R;
}
int n,m,p[200005],cv[200005];
struct BIT{
	int a[200005];
	void add(int p,int v){
		++p;
		while(p<=n){
			a[p]+=v;
			if(a[p]>=MOD) a[p]-=MOD;
			p+=p&-p;
		}
	}
	int sum(int p){
		++p;
		int r=0;
		while(p){
			r+=a[p];
			if(r>=MOD) r-=MOD;
			p-=p&-p;
		}
		return r;
	}
}CNT,SUM;
int main(){
	int i,j,k;
	n=readint();m=readint();
	for(i=0;i<n;++i) p[i]=n-readint();
	for(i=0;i<m;++i) cv[i]=0;
	for(i=m;i<n;++i) cv[i]=i-m+1;
	int c=0,p1=0,p2=0,ss=0,invm=(1+MOD-powM(m))%MOD,om=powM(invm),ci=1,cp=1;
	for(i=0;i<n;++i){
		if(i && cv[i]>cv[i-1]) ci=(LL)ci*invm%MOD,cp=(LL)cp*om%MOD;
		c+=CNT.sum(p[i]);
		if(c>=MOD) c-=MOD;
		CNT.add(p[i],1);
		p1+=(LL)SUM.sum(p[i])*ci%MOD;
		if(p1>=MOD) p1-=MOD;
		SUM.add(p[i],cp);
		p2+=(LL)ss*ci%MOD;
		if(p2>=MOD) p2-=MOD;
		ss+=cp;
		if(ss>=MOD) ss-=MOD;
	}
//	printf("p2=%d p1=%d c=%d\n",p2,p1,c);
	int inv2=(MOD+1)/2;
	int res=((LL)inv2*p2+c-p1+MOD)%MOD;
	printf("%d\n",res);
	return 0;
}
/*
 * 代码框架
 * 1. 开数组记录每个位置的最小覆盖标号 
 * 2. 预处理K的逆
 * 3. 开两个BIT分别维护个数和总和，得到逆序对的总个数c和总概率p1。
 * 4. 计算全局总概率p2，答案等于p2/2+c-p1
*/

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

int main(void){

    long long N, M;

    scanf("%lld%lld", &N, &M);

    long long ans;

    if(N == M){
        ans = 2;
        for(int i = 1; i <= N; i++){
            ans = (ans * i) % 1000000007;
        }
        for(int i = 1; i <= M; i++){
            ans = (ans * i) % 1000000007;
        }
    }else if(N == M + 1 || N == M - 1){
        ans = 1;
        for(int i = 1; i <= N; i++){
            ans = (ans * i) % 1000000007;
        }
        for(int i = 1; i <= M; i++){
            ans = (ans * i) % 1000000007;
        }
    }else{
        ans = 0;
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int mx,mi;
	int n;
	string str;
	cin >> n;
	while(n--){
		mx=0,mi=99999999+1;
		vector<char> data(8);
		for(int i=0; i<8; ++i){
			cin >> data[i];
		}
		sort(data.begin(),data.end());
		do{
			str.clear();
			for(size_t i=0; i<data.size(); ++i){
				str += data[i];
			}
			mx = max(atoi(str.c_str()),mx);
			mi = min(atoi(str.c_str()),mi);
		}while(next_permutation(data.begin(), data.end()));
		cout << mx-mi << endl;
	}
	return 0;
}

Measured memory_bytes: 0