akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second < secondElof.second;
}

int main() {
    int a, b;
    cin >> a >> b;

    int x1 = 100 * (a+7) / 8;
    int x2 = 10 * b;

    int ans = -1;

    int minx = min(x1, x2);
    int maxx = max(x1, x2);

    for(int i = minx; i <= maxx; ++i) {
        int r1 = i*0.08;
        int r2 = i*0.1;
        if (r1 == a and r2 == b) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#define pi 3.141592653589

int main(void) {
	double r;
	
	scanf("%lf",&r);
	
	double x = pi * r *r;
	double y = 2 * pi * r;
	
	printf("%f %f \n", x, y);
	
	return 0;
}

Measured memory_bytes: 648
#include<cstdio>
int n,k;
long long tab[100005], dp[100005];

inline long long mini(long long a, long long b){
	return a<b?a:b;
}
inline long long abs(long long x){
	return x<0?-x:x;
}

int main(){

	scanf("%d %d", &n, &k);
	for(int i=0;i<n;i++){
		scanf("%lld", &tab[i]);
	}
	for(int i=1;i<n;i++){
		dp[i]=dp[i-1]+abs(tab[i]-tab[i-1]);
		for(int d=2;d<=k;d++){
			if(i-d < 0)break;
			dp[i] = mini(dp[i], dp[i-d] + abs(tab[i]-tab[i-d]));
		}
	}
	printf("%lld\n", dp[n-1]);
}


Measured memory_bytes: 1664
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        c: char
    }
    println!("{}", if c.is_lowercase() {"a"} else {"A"});
}


Measured memory_bytes: 2156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            long iX = int.Parse(sS[1]);
            List<long> lstX = new List<long>();
            sS = System.Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < iN; i++) { lstX.Add(long.Parse(sS[i])); }
            lstX.Add(iX);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstX.Sort();
            long iOut = lstX[1] - lstX[0]; ;
            if (lstX.Count > 2)
            {
                for (int i = 2; i < lstX.Count; i++)
                {
                    long iNow = lstX[i] - lstX[i - 1];
                    iOut = Gcd(iOut, iNow);
                }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        // 最小公倍数取得
        private static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }

        // 最大公約数取得
        private static long Gcd(long a, long b)
        {
            if (a < b) { return Gcd(b, a); }
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

}


Measured memory_bytes: 20192
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  while(cin >> n, n) {
    int num[2][n+1];
    memset(num,0,sizeof(num));
    REP(i,2) {
      REP(j,n) {
        int a;
        cin >> a;
        num[i][a]++;
      }
    }
    int w1,h1,w2,h2;            // 1 : OFF ツづ個按づ淞つスツ療アツ／ツ行ツづ個青板　2 : ON ツづ個按づ淞つスツ・ツ・ツ・
    w1=h1=w2=h2=0;
    
    bool update = 1;
    while(update) {
      //printf("%d,%d %d,%d\n",w1,w2,h1,h2);
      update = 0;
      if (num[0][w2]) {         // ツ残ツづィツづーOFF
        h1 += num[0][w2];
        num[0][w2] = 0;
        update = 1;
      }
      if (num[0][n-w1]) {       // ツ残ツづィツづーON
        h2 += num[0][n-w1];
        num[0][n-w1] = 0;
        update = 1;
      }
      if (num[1][h2]) {         // ツ残ツづィツづーOFF
        w1 += num[1][h2];
        num[1][h2] = 0;
        update = 1;
      }
      if (num[1][n-h1]) {       // ツ残ツづィツづーON
        w2 += num[1][n-h1];
        num[1][n-h1] = 0;
        update = 1;
      }
    }

    if (w1+w2==n && h1+h2 == n)  cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 0
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll mod = (ll)1e9+7;

long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
      if (n & 1) res = res * a % mod;
      a = a * a % mod;
      n >>= 1;
  }
  return res;
}

ll inv_mul(ll x, ll y){
 return (x % mod* modpow(y,mod-2))%mod;
}

int main() {
    ll n,k;
    
    // std::cout << mod << std::endl;
    std::cin >> n>>k;
    vector<ll> a(n);
    vector<pair<ll,ll>> c(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if(i<j){
                if(a[i] > a[j]){
                    c[i].second++;
                }
            }else if(i>j){
                if(a[i] > a[j]){
                    c[i].first++;
                }
            }
        }
        // std::cout << a[i]<<" "<<c[i].first <<" "<<c[i].second << std::endl;
    }
    ll result = 0;
    
    for (int i = 0; i < n; i++) {
        // std::cout << i << std::endl;
        result += c[i].second%mod*k %mod *(k+1) %mod /1 %mod;
        result += c[i].first %mod*k %mod *(k-1) %mod /1 %mod;
        result %= mod;
        // std::cout << result << std::endl;
    }
    std::cout << inv_mul(result,2)%mod << std::endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int p[110000];
int q[110000];

int main(){
	int a;
	long long b;scanf("%d%lld",&a,&b);
	int ma=0;
	for(int i=0;i<a;i++){
		scanf("%d%d",p+i,q+i);
		ma=max(ma,p[i]);
	}
	int ret=mod;
	int tmp=0;
	std::sort(q,q+a);
	for(int i=a;i>=0;i--){
		if(i){
			b-=q[i-1];
			tmp++;
		}
		int cost=0;
		if(b>0){
			cost=(b+ma-1)/ma;
		}
		ret=min(ret,tmp+cost);
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 896
n = int(input())

MOD = 1000000007

def mod(n):         
  return n % MOD

def modpow(a, n):   #mod(a**n)を高速で求める
    res = 1  
    digit = len(str(bin(n))) - 2
    for i in range(digit):
      if (n >> i) & 1:
        res *= mod(a)
        res = mod(res)
      a = mod(a**2)
    return mod(res)
  
ans = modpow(10, n)
ans -= 2*modpow(9, n)
ans += modpow(8, n)
print(mod(ans))

Measured memory_bytes: 61952
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
  cin >> N;
  string s;
  int num_P = 0, num_Y = 0, num_G = 0, num_W = 0;
  for (int i = 0; i < N; i++)
  {
  	cin >> s[i];
    if (s[i] == 'Y') num_Y++;

  }
  if (num_Y > 0) cout << "Four" << endl;
  else cout << "Three" << endl;
}

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

using namespace std;

int A[200005];
int A2[200005];
int ans[200005];

int main(int argc, char *argv[])
{
	int N;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> A[i];
		A2[i] = A[i];
	}
	sort(A, A + N);

	int mx = A[N - 1];
	int sx = A[N - 2];

	for (int i = 0; i < N; i++) {
		if (A2[i] != mx) {
			printf("%d\n", mx);
		} else {
			printf("%d\n", sx);
		}
	}

	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
int main() {
    int H,W; cin >> H >> W;
    ll c[10][10];
    for (int i=0; i<10; ++i) for (int j=0; j<10; ++j) cin >> c[i][j];
    for (int k=0; k<10; k++){
        for (int i=0; i<10; i++){
            for (int j=0; j<10; j++){
                chmin(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    ll res = 0;
    for (int i=0; i<H; ++i) for (int j=0; j<W; ++j) {
        int A; cin >> A;
        if (A != -1) res += c[A][1];
    }
    cout << res << endl;
    return 0;
}

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

  int ans = INT_MAX;
  int tmp_ans1 = 0;
  int tmp_ans2 = 0;
  for (int i = 0; i < s.size(); i+=2) {
    if (s[i] != '0') {
      tmp_ans1++;
    } else {
      tmp_ans2++;
    }
    if ((i+1) < s.size()) {
      if (s[i+1] != '1') {
        tmp_ans1++;
      } else {
        tmp_ans2++;
      }
    }
  }
  ans = min(tmp_ans1, tmp_ans2);

  cout << ans << endl;

  return 0;
}


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

int main(){
	long long n,m;
	cin >> n >> m;
	if(n==m&&n==1) cout << 1 << endl;
	else if(n==1&&m!=1) cout << m-2 << endl;
	else if(n!=1&&m==1) cout << n-2 << endl;
	else cout << (n-2)*(m-2) << endl;
	return 0;
} 

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

int main(){
  unsigned long int S;
  std::cin >> S;
  unsigned long int X1, Y1, X2, Y2, X3, Y3;
  X3 = 0;
  Y3 = 0;
  long int XY12, XY21;
  long int limit = 1000000000;
  if(S != limit*limit) {
    XY12 = (S/1000000000)*1000000000 + 1000000000;
    XY21 = 1000000000 - S%1000000000;
    X1 = XY12/1000000000;
    Y2 = XY12/X1;
    X2 = XY21;
    Y1 = 1;
  }
  else {
    X1 = limit;
    Y2 = limit;
    X2 = 0;
    Y1 = 0;
  }
  std::cout << X1 <<" "<< Y1 <<" "
            << X2 <<" "<< Y2 <<" "
            << X3 <<" "<< Y3 << std::endl;
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
struct Point{
    double x,y;
    Point(){}
    Point(double _x,double _y){
        x = _x;
        y = _y;
    }
};
const int maxn = 1010;
Point point[maxn];
int N;
int main(){
    scanf("%d",&N);
    for(int i = 1;i <= N;++i ){
        scanf("%lf%lf",&point[i].x,&point[i].y);
    }
    double ans = 0;
    point[N+1].x = point[1].x;
    point[N+1].y = point[1].y;
    for(int i = 1;i < N+1;++i ){
        ans += (point[i].x*point[i+1].y-point[i].y*point[i+1].x);
    }
    ans /= 2;
    if(ans<0.0){
        ans = -ans;
    }
    printf("%.1f\n",ans);
    return 0;
}




Measured memory_bytes: 3248
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int a[100010];
int cnt[100010];
int ans[100010];
int main(){
	memset(cnt,0,sizeof(cnt));
	memset(ans,0,sizeof(ans));
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i+=2){
		cnt[a[i]]++;
	}
	for(int i=1;i<n;i+=2){
		ans[a[i]]++;
	}
	vector<pair<int,int> > v;
	vector<pair<int,int> > t;
	set<int> s;
	set<int> k;
	for(int i=0;i<n;i+=2){
		if(s.find(a[i])==s.end()){
			v.push_back(make_pair(cnt[a[i]],a[i]));
			s.insert(a[i]);
		}
	}
	sort(v.rbegin(),v.rend());
	for(int i=1;i<n;i+=2){
		if(k.find(a[i])==k.end()){
			t.push_back(make_pair(ans[a[i]],a[i]));
			k.insert(a[i]);
		}
	}
	sort(t.rbegin(),t.rend());
	if(v[0].second==t[0].second){
		if(v.size()==1)v.push_back(make_pair(0,0));
		if(t.size()==1)t.push_back(make_pair(0,0));
		cout<<n-max(v[1].first+t[0].first,v[0].first+t[1].first)<<endl;
	}
	else{ 
		cout<<n-(v[0].first+t[0].first)<<endl; 
	}
	return 0;
} 

Measured memory_bytes: 6904
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e4;
const int inf=1e9;
int main(){
	int N;cin>>N;
	map<string,int> mp;
	string s; int res=0;
	rep(i,0,N){
		cin>>s;
		mp[s]++;
		res=max(res,mp[s]);
	}
	vector<string> v;
	for(pair<string,int> p:mp){
		if(p.second==res) v.push_back(p.first);
	}sort(v.begin(),v.end());
	rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

Measured memory_bytes: 26868
# ABC135
def main():
    n = int(input())
    P = tuple(map(int, input().rstrip().split()))
    dif = []
    for i, j in enumerate(P, start=1):
        if i != j:
            dif += [(i, j)]
    if len(dif) == 0:
        print("YES")
    elif len(dif) != 2:
        print("NO")
    elif dif[0] != dif[1][::-1]:
        print("NO")
    else:
        print("YES")


if __name__ == "__main__":
    main()

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a<c && b>c){
    cout << "Yes";
  }
  else if(a>c && b<c){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  return 0;
}


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

using namespace std;

int main() {
    map<string, int> list {
                           {"SAT", 1}, {"FRI", 2}, {"THU", 3}, {"WED", 4}, {"TUE", 5}, {"MON", 6}, {"SUN", 7}
    };

    string a;
    cin >> a;
    cout << list.at(a);
}


Measured memory_bytes: 256
from bisect import bisect_right
from itertools import accumulate

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort()
    B.sort()
    C.sort()
    B_count = [0] * N
    for i in range(N):
        index = bisect_right(C,B[i])
        if index < N:
            B_count[i] = N - index
    D = [0] + list(accumulate(B_count))
    ans = 0
    for a in A:
        index = bisect_right(B,a)
        ans += D[N] - D[index]

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 106560
#include <stdio.h>

int main()
{
  char s[20];
  int i;
  scanf("%s", &s);

  for(i = 0; i < 20; i++) {
    if(s[i] == ',') {
      s[i] = ' ';
    }
  }
  printf("%s\n", s);
    
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var ab = ReadLine();
            if (ab[0] == ab[2])
                WriteLine("H");
            else
                WriteLine("D");
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 25860
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);
/*======================================================================*/

void solve() {
    int n;
    cin >> n;
    vi a(n), b(n);
    rep(i, 0, n)cin >> a[i] >> b[i];
    sort(all(a)), sort(all(b));
    if(n%2 == 0){
        ll ans = (b[n/2] + b[n/2 - 1]) - (a[n/2] + a[n/2 - 1]) + 1;
        cout << ans;
    }
    else{
        cout << abs(b[n/2] - a[n/2]) + 1;
    }
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 6368
#include <iostream>
#include <cstdlib>
#include <stack>
#define DEBUG false
using namespace std;

struct P {
  unsigned int i; // JèÔµêÌæªÌindex
  int n;          // JèÔµñ
};

bool isDigit( char c ){
  if( '0'<= c && c <= '9' ) return true;
  return false;
}

/* ið®©µÄ¢«A¶ð©½ñ¾¯nð¸ç· */
char parse( string s, unsigned int n ){
  const char *c = s.c_str();
  unsigned int i=0;
  stack<P> st;   // '('ÌÊuðL^
  P p;
  if( DEBUG ) cout << "parse : " << s << " len=" << s.length() << endl;

  while( i<s.length() ){
    if( false && DEBUG ) cout << "while : i="<<i<<" n="<<n<< " s[i]="<<s[i] 
		     << " stack:"<< st.size() << " p.n=" << p.n << endl;
    if( isDigit( s[i] ) ){
      unsigned int num = atoi( c+i );
      if(  DEBUG ) cout << "num=" << num << endl;
      while( isDigit( s[i] ) ) ++i;
      if( s[i]=='(' ){
	i++;  // '(' ÌªðCNg·é
	p.i=i; p.n=num;
	st.push( p ); // JèÔµÌÅÌ¶ðÇÁ
      }else {
	--num;
	//	cout << "n="<<n<<" num="<<num<<endl;
	if( n<num ) return s[i];
	else n-=num;
      }
    }else if( s[i]==')' ){
      p = st.top(); st.pop();
      if( --p.n != 0 ){  st.push( p ); i=p.i; }
      else ++i;
    }else {
      if( n==0 )
	return s[i];
      --n;
      ++i;
    }
  }
  return '0';
}

int main(){
  string s;
  unsigned int n;
  while( cin>>s>>n && (s!="0"|| n ) ){
    if( DEBUG ){
      cout << "\nn=" << n << " in : " << s << endl;
    }
   
    if( DEBUG )
      cout << "answer=";
    cout << parse( s,n ) << endl;
  }

  return 0;
}

Measured memory_bytes: 932
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int K = Integer.valueOf(s.next());
		if(K%2==0) {
			System.out.println(-1);
			return;
		}
		
		int cur = 7;
		int cnt = 1;
		for(int i = 0; i < 100000000; i++) {
			if(cur % K == 0) {
				System.out.println(cnt);
				return;
			}else {
				cur = (cur * 10 + 7) % K;
				cnt++;
			}
		}
		System.out.println(-1);
	}
}

Measured memory_bytes: 36096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long[] a = in.nextLongArray(n);
			long[] b = in.nextLongArray(n);

			long sumA = 0, sumB = 0;
			for (int i = 0; i < n; i++) {
				sumA += a[i];
				sumB += b[i];
			}
			if (sumA > sumB) {
				out.println("No");
				return;
			}
			long sa = sumB - sumA;
			long count1 = 0;
			long count2 = 0;
			for (int i = 0; i < n; i++) {
				if (b[i] > a[i]) {
					count1 += (b[i] - a[i]+1) / 2;
				} else if (a[i] > b[i]) {
					count2 += a[i] - b[i];
				}
			}

			out.println(Math.max(count1,count2) <= sa ? "Yes" : "No");

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 25684
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K,C;
    Scd3(N,K,C);

    static char s[2232133];
    Scs(s);

    int t = 0;
    int lim = 0;
    vi dp(N,-1);
    vi dlim(N+1,INF);
    while( t < N ){
        if( s[t] == 'o' ) dlim[lim] = t, dp[t] = K-lim, lim++, t += C;
        t++;
    }
    if( lim > K ){
        return 0;
    }


    t = K-1;
    RRep(i,N){
        if( dp[i] != -1 ) t--;
        else if( s[i] == 'o' && i+C < dlim[t+1] ) dlim[t] = max( (int)i, dlim[t]);
    }

    t = 0;
    vi ans;
    Rep(i,N){
        // cout << t << "!" << i << endl;
        if( dp[i] != -1 && dlim[t++] == i ) ans.push_back(i);
    }

    for( int aa : ans ){
        printf ("%d\n", aa+1 );
    }

    // Rep(i,N){
    //     printf ("!%d\n", dp[i] );
    // }
    // Rep(i,K){
    //     printf ("?%d\n", dlim[i] );
    // }

    return 0;
}

/*
16 4 3
ooxx
oxoxxx
oxoxx
o
*/


Measured memory_bytes: 4212
import java.util.*;

class Main {
	static int N;
	static long[] a;
	static long[][] is;
	static long[] freq;
	static long[] cum;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		a = new long[N];
		is = new long[2][N];
		freq = new long[N + 1];
		cum = new long[N];
		Arrays.fill(is[0], -1);
		Arrays.fill(is[1], -1);
		Arrays.fill(freq, -1);
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
		}

		int p = 0;
		for (int i = 0; i < N; ++i) {
			if (i == 0 || is[0][p - 1] < a[i]) {
				is[0][p] = a[i];
				is[1][p] = i + 1;
				++p;
			}
		}
		is[0] = Arrays.copyOf(is[0], p);
		is[1] = Arrays.copyOf(is[1], p);
		Arrays.sort(a);
		for (int i = 0; i < N; ++i) {
			cum[i] = (i > 0 ? cum[i - 1] : 0) + a[i];
		}
		for (int i = p - 1; i >= 1; --i) {
			int t = binarySearch(a, is[0][i]);
			int s = binarySearch(a, is[0][i - 1]);
			freq[(int) is[1][i]] = cum[t - 1] - cum[s] - (t - s - 1) * is[0][i - 1] + (N - t) * (is[0][i] - is[0][i - 1]);
		}
		int t = binarySearch(a, is[0][0]);
		freq[(int) is[1][0]] = (t > 0 ? cum[t - 1] : 0) + (N - t) * is[0][0];

		for (int i = 1; i <= N; ++i) {
			System.out.println(Math.max(freq[i], 0));
		}
	}

	// 同じ数字が続いているときは一番後ろを返す。
	static int binarySearch(long[] a, long key) {
		int s = -1;
		int t = a.length;
		while (t - s > 1) {
			int m = (s + t) / 2;
			if (a[m] > key) {
				t = m;
			} else {
				s = m;
			}
		}
		if (a[s] != key)
			s *= -1;
		return s;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

using namespace std;

int main(int argc, char *argv[])
{
  int n;
  cin >> n;

  vector<long> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  long x = 0;
  long y = 0;
  long min = 0;
  x = a[0];
  for (int i = 1; i < n; i++) {
    y += a[i];
  }
  min = abs(x - y);

  long diff = 0;
  for (int i = 1; i < n - 1; i++) {
    x += a[i];
    y -= a[i];
    diff = abs(x - y);
    if (diff < min) {
      min = diff;
    }
  }

  cout << min << endl;

  return 0;
}


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

int main() {
  int n, m;
  cin>>n>>m;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  int sum = 0;
  for (int i=0; i<n; i++) sum += a[i];
  sort(a, a + n);
  reverse(a, a + n);
  if (4 * m * a[m-1] <sum) {
    cout<<"No"<<endl;
  } else {
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    rep(i,2){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    ll ans = 0;
    rep(i,n)
    {
        ll tmp = 0;
        int cur = 0;
        rep(j, n)
        {
            if(i == j){
                tmp += a[0][j];
                tmp += a[1][j];
                cur = 1-cur;
            }else{
                tmp += a[cur][j];
            }
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{

    long long a,b,x,ans =0;
    cin >> a>> b>> x;
    if(a<=b){
        ans = (b/x)-((a/x));

    }if (a%x==0){
    ans ++;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Vsort(a) sort(a.begin(), a.end())
#define rep(i,n) for(int i = 0; i < (n); i++)
#define Srep(i,a,n) for(int i = (a); i < (n); i++)
#define ll long long
#define P pair<int, int>
using namespace std;

int main(){
  string s;
  cin >> s;
  if((s.at(0) == s.at(1)) && (s.at(1) == s.at(2))) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long ll;
using namespace std;
#define INF (1 << 30)
#define INFLL (1LL << 60)
#define rep(i, n) for(int i=0; i<(n); ++i)

int main()
{
	const int ceil = 100000;
	vector<int> isPrime(ceil + 1, 1);
	isPrime[0] = isPrime[1] = 0;
	for (int i = 2; i < ceil + 1; ++i) {
		if (isPrime[i]) {
			for (int k = 2; i * k < ceil + 1; ++k) {
				isPrime[i * k] = 0;
			}
		}
	}
	vector<int> like(ceil + 1, 0), accumLike(ceil + 1, 0);
	for (int i = 2; i < ceil + 1; ++i) {
		if (isPrime[i]) {
			if (isPrime[(i + 1) / 2]) {
				like[i] = 1;
				++accumLike[i];
			}
		}
		accumLike[i] += accumLike[i - 1];
	}

	int Q; cin >> Q;
	vector<int> anss;
	rep(i, Q) {
		int l, r; cin >> l >> r;
		anss.push_back(accumLike[r] - accumLike[l - 1]);
	}
	rep(i, anss.size()) cout << anss[i] << endl;
	return 0;
}


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

int main() {

    int H, W;
    
    do {
        cin >> H >> W;
        if (H == 0 && W == 0) {
            break;
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    } while (1);
        
}


Measured memory_bytes: 3104
ABCD = [int(i) for i in input()]

for op1 in ["+", "-"]:
    for op2 in ["+", "-"]:
        for op3 in ["+", "-"]:
            tmp = 0
            if op1 == "+":
                tmp = ABCD[0] + ABCD[1]
            else:
                tmp = ABCD[0] - ABCD[1]
            if op2 == "+":
                tmp += ABCD[2]
            else:
                tmp -= ABCD[2]
            if op3 == "+":
                tmp += ABCD[3]
            else:
                tmp -= ABCD[3]

            if tmp == 7:
                print(str(ABCD[0])+op1+str(ABCD[1])+op2+str(ABCD[2])+op3+str(ABCD[3])+"=7")
                quit()


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

int point(char c, int R, int S, int P) {
  if(c == 'r') {
    return P;
  } else if(c == 's') {
    return R;
  } else {
    return S;
  }
}
using ll = long long;
int main() {
  int N, K;
  cin >> N >> K;
  int R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;
  vector<int> flag(N + 1, 0);

  ll ans = 0;
  for(int i = 1; i <= N; ++i) {
    auto c = T[i - 1];
    if(i <= K) {
      ans += point(c, R, S, P);
    } else {
      if(c != T[i - K - 1]) {
        ans += point(c, R, S, P);
      } else {
        if(flag[i] > 0) {
          ans += point(c, R, S, P);
        } else {
          if(i + K <= N) {
            flag[i + K] = 1;
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 896
#include<stdio.h>

int abs(int a){
  return a < 0 ? -a : a;
}

int main(){
  int n;
  scanf("%d", &n);
  
  int t[n + 1];
  int x[n + 1];
  int y[n + 1];
  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  for(int i = 1; i <= n; i++){
    scanf("%d %d %d", &t[i], &x[i], &y[i]);
  }
  
  int result = 1;
  for(int i = 1; i <= n; i++){
    int d = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
    if(t[i] - t[i - 1] >= d && (t[i] - t[i - 1]) % 2 == d % 2){
      continue;
    }else{
      result = 0;
      break;
    }
  }
  
  if(result){
    puts("Yes");
  }else{
    puts("No");
  }
  
  return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    ll x, a, b;
    cin >> x >> a >> b;
    if ( a >= b )           cout << "delicious" << endl;
    else if (  b - a <= x ) cout << "safe" << endl;
    else                    cout << "dangerous" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
  long long a,b,c;
  scanf("%lld %lld %lld",&a,&b,&c);
  if (a%2==0||b%2==0||c%2==0) {
    printf("0\n");
  } else {
    if (a*b<=b*c&&a*b<=c*a) {
      printf("%lld\n",a*b);
    } else if (b*c<=c*a) {
      printf("%lld\n",b*c);
    } else {
      printf("%lld\n",c*a);
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define mod 1000000007ll
	#define sz 70000
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n,K;
int val[sz],m;
int L[sz],R[sz];
int pos[sz];

ll dp[111][sz],add[111][sz];

int main()
{
	file();
	read(n,K);
	for (int l=1,r;l<=n;l=r+1)
	{
		int x=n/l;r=n/x;
		val[++m]=x;L[m]=l,R[m]=r;
	}
	rep(i,1,m) 
	{
		int x=val[i];
		int p=lower_bound(L+1,L+m+1,x)-L;
		pos[i]=p-1;
	}
	dp[0][1]=1;
	rep(i,0,K)
	{
		drep(j,m,1) (add[i][j]+=add[i][j+1])%=mod,(dp[i][j]+=(R[j]-L[j]+1)*add[i][j]%mod)%=mod; 
		rep(j,1,m) 
		{
			int p=pos[j];
			(add[i+1][p]+=dp[i][j])%=mod;
			(dp[i+1][p+1]+=dp[i][j]*(val[j]-L[p+1]+1)%mod)%=mod;
		}
	}
	ll ans=0;
	rep(i,1,m) (ans+=dp[K][i])%=mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 116864
# ABC165 A

def main():
    k = int(input())
    a, b = map(int, input().split())

    res = False

    for i in range(a, b+1):
        if i % k == 0:
            print('OK')
            res = True
            break
    
    if res == False:
        print('NG')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
int L, N;


long keisan(long x[], int z[]){
    long y[N + 1];
    y[0] = x[0];
    for(int i = 1; i < N; i++){
        y[i] = x[i] - x[i-1];
    }
    y[N] = L - x[N-1];

    long len1 = 0;
    for(int i = 0; i < N + 1; i++){
        len1 += y[i] * z[i];
    }

    long ans = len1;
    for(int i = 1; i < N / 2 + 1; i++){
        len1 += x[i + (N - i + 1)/2 - 1] - 2 * x[i - 1] - L + x[N - ((N - i + 1)/2)];
        if(len1 > ans)
            ans = len1;
    }
    return ans;
}

void keisan2(int z[]){
    for(int i = 0; i < N / 2 + 1; i++){
        z[i] = N - i * 2;
    }
    for(int i = 0; i < (N - 1) / 2 + 1; i++){
        z[N - i] = N -1 - i * 2;
    }
}


int main() {
    cin >> L >> N;
    long X[N];
    for(int i = 0; i < N; i++){
        cin >> X[i];
    }

    int Z[N + 1];
    keisan2(Z);
    long ans = keisan(X, Z);

    //ここから逆

    long X1[N];
    for(int i = 0; i < N; i++){
        X1[i] = L - X[N - i -1];
    }
    long ans2 = keisan(X1, Z);
    if(ans2 > ans)
        ans = ans2;

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

Measured memory_bytes: 5760
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define FINOUT freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define FOR(i, a, b) for (int i = a; i < (b); ++i)
#define FORd(i, a, b) for(int i = (b) - 1; i >= a; --i)
#define trav(a, x) for(auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define endl '\n'
const int MOD = 1000000007;

int main(){
    IOS;
    // FINOUT;
    int T = 1;
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t = s;
    int cnt = 0;
    sort(all(t));
    FOR(i, 0, n) if(s[i] ^ t[i]) cnt++;
    cout << cnt / 2;
    return 0;
}

Measured memory_bytes: 3876
S = input()

cand = set({
    "KIHBR",
    "KIHBRA",
    "KIHBAR",
    "KIHBARA",
    "KIHABR",
    "KIHABRA",
    "KIHABAR",
    "KIHABARA",
    "AKIHBR",
    "AKIHBRA",
    "AKIHBAR",
    "AKIHBARA",
    "AKIHABR",
    "AKIHABRA",
    "AKIHABAR",
    "AKIHABARA",
})

if S in cand:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38384
import Data.List
main = do
    getLine
    s <- getLine
    let wbs = scanr (\c (w,b) -> if c == '.' then (w+1,b) else (w,b+1)) (0,0) s
        b = snd $ head wbs
    print . minimum $ map (\(wi,bi) -> wi + (b-bi)) wbs

Measured memory_bytes: 53628
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vint a(n);
	int cnt = 0;
	rep(i, n) {
		cin >> a[i];
		cnt += a[i];
	}
	int m;
	cin >> m;
	vint b(m);
	int x, y;
	rep(i, m) {
		cin >> x >> y;
		b[i] = cnt - (a[x - 1] - y);
	}
	rep(i, m) {
		cout << b[i] << endl;
	}
	return 0;
}


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

int compare(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int main(void){
  char s[110] = {};
  char t[110] = {};

  scanf("%s %s", s, t);
  int ls = strlen(s), lt = strlen(t);

  for(int i = 0; i < ls; i++){
    for(int j = 0; j < lt; j++){

      if(s[i] < t[j]){
        printf("Yes\n");
        return 0;
      }

    }
  }

  if(ls >= lt){
    printf("No\n");
  }else{
    for(int i = 0; i < ls; i++){
      int flag = 0;
      for(int j = 0; j < lt; j++){
        if(s[i] == t[j]){
          flag = 1;
          t[j] = 0;
          break;
        }
      }
      if(flag == 0){
        printf("No\n");
        return 0;
      }
    }
    printf("Yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class Main {
    public static void main(String[] args) {
        MyReader mr = new MyReader();
        int h = mr.nextInt();
        int a = mr.nextInt();

        int res = h/a;
        if(h%a != 0)res++;

        System.out.println(res);

    }

    static class MyReader {
        BufferedReader br;
        StringTokenizer st;

        MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String res = "";
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return res;
        }

        int[] nextIntArray(int n) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }

            return arr;
        }

        long[] nextLongArray(int n) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }

            return arr;
        }

        String[] nextStringArray(int n) {
            String res = "";
            try {
                res = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }

            String[] arr = res.split(" ");
            return arr;
        }
    }

    static void swap(int[] arr, int i, int j) {
        int A = arr[i];
        arr[i] = arr[j];
        arr[j] = A;
    }

}




Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=4e3+10;
	//------------------FIXED------------------
	const int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int b[N];
	void main()
	{
		//ll n=qread(),m=qread();write(h/2*w+(h%2)*(w+1)/2);
		write(a[qread()-1]);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    fast;
    int x,y,x1,y1;
    cin >> x >> y >> x1 >> y1;
    int up = y1 - y;
    int r = x1 - x;
    string ans = "";
    fore(i,0,up)
        ans += 'U';

    fore(i,0,r)
        ans += 'R';

    fore(i,0,up)
        ans += 'D';
    r++;
    fore(i,0,r)
        ans += 'L';
    up++;

    // 2da


    fore(i,0,up)
        ans += 'U';

    fore(i,0,r)
        ans += 'R';
    ans += "DR";

    fore(i,0,up)
        ans += 'D';
    
    fore(i,0,r)
        ans += 'L';
    ans += "U";
    cout << ans << "\n";    
    return 0;
}

Measured memory_bytes: 256