akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long k = in.nextLong();
            long a = in.nextLong();
            long b = in.nextLong();

            if (a >= k) {
                out.println(1);
                return;
            }

            if (a - b <= 0) {
                out.println(-1);
                return;
            }

            k -= a;
            long d = a - b;

            out.println(1 + 2 * ((k + (d - 1)) / d));
        }

    }

    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 long nextLong() {
            return Long.parseLong(nextString());
        }

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

    }
}



Measured memory_bytes: 22996
# ABC144C - Walk on Multiplication Table
def div_pairs_sum(x: int) -> set:
    divs = set()
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            divs.add(i + x // i)
    return divs


def main():
    N = int(input())
    ans = min(div_pairs_sum(N)) - 2
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
import java.util.*;

public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] num = new int[n];
        int[] num2 = new int[n];
        int b1, b2;
        
        for(int i=0; i<n; i++){
        	num[i] = Integer.parseInt(sc.next());
        	num2[i] = num[i];
        }
        
        Arrays.sort(num2);
        b1 = num2[n/2 - 1];
        b2 = num2[n/2];
        
        for(int i=0; i<n; i++){
        	if(num[i] <= b1){
        		System.out.println(b2);
        	}else{
        		System.out.println(b1);
        	}
        }
        sc.close();
    }
}
	
	

Measured memory_bytes: 92304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e17;
const int mod = 1e9 + 7;

signed main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> treasure(M);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        int temp = 0;
        for (int j = 0; j < b; j++) {
            int c;
            cin >> c;
            temp |= (1<<(c-1));
        }
        treasure[i].first = a;
        treasure[i].second = temp;
    }
    vector<int> dp(1<<N + 5, inf);
    dp[0] = 0;
    for (int i = 0; i <= (1<<N); i++) {
        for (int j = 0; j < M; j++) {
            if (dp[i] != inf) dp[i | treasure[j].second] = min(dp[i | treasure[j].second], dp[i] + treasure[j].first);
        }
    }
    int temp = dp[(1<<N) - 1];
    cout << (temp == inf ? -1 : temp) << endl;
}


Measured memory_bytes: 1280
x={}
("a".."z").each{|c| x[c]=0}
while line=gets
  line.chars {|c|
    c=c.downcase
    if x[c]
      x[c]=x[c]+1
    else
      x[c]=1
    end
  }
end
("a".."z").each{|c|
  puts "#{c} : #{x[c]}"
}

Measured memory_bytes: 6096
n = int(input())
a = [int(x) for x in input().split()]
b = [0]*n

k = 0
for i in range(n-1, -1, -2):
  b[k] = a[i]
  k += 1
for i in range(n%2, n, 2):
  b[k] = a[i]
  k += 1

print(*b)  

Measured memory_bytes: 26020
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>

using namespace std;


int main() {
	int a,b;
	cin >> a >> b;
	int dis = b - a;
	int Height = dis * (dis + 1) / 2;
	cout << Height - b << endl;
	return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())

ba = a
bb = b
bc = c
ans = 0
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break

    if a==b==c:
        ans=-1
        break
    ta = a//2
    tb = b//2
    tc = c//2
    a = tb+tc
    b = ta+tc
    c = ta+tb
    ans += 1

    # if a == ba and b == bb and c == bc:
    #     ans = -1
    #     break

print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  	int A[100];
  	int N;
  	cin >> N;
  	for(int i = 0; i < N; i++) {
      	cin >> A[i];
    }
  	int k;
  	int l = 0;
  	for(int i = 0; i < N; i++) {
		for(int j = i; j < N; j++) {
			if(A[i] == A[j])
              	k++;
        }
    if(k >= 2) l++;
    k = 0;
    }
    N -= l;
  	cout << N << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
  }

  vector<set<int>> S(n);
  rep(j, n) S[j].emplace(j);
  vector<int> idx(n);
  rep(j, n) idx[j] = j;

  ll cnt =
    (ll)n * (n - 1) / 2;    // take care not to be overflow
  vector<ll> ans;
  ans.push_back(cnt);

  reverse(all(a));
  reverse(all(b));

  rep(i, m - 1) {
    int aj = idx[a[i]], bj = idx[b[i]];

    if(aj == bj) {
      ans.push_back(cnt);
      continue;
    }

    ll sza = (ll)S[aj].size(), szb = (ll)S[bj].size();
    cnt -= sza * szb;
    ans.push_back(cnt);

    if(sza < szb) swap(aj, bj);
    for(auto x : S[bj]) {
      S[aj].emplace(x);
      idx[x] = aj;
    }
    S[bj].clear();
  }

  reverse(all(ans));
  rep(i, m) printf("%lld\n", ans[i]);
  return 0;
}


Measured memory_bytes: 14196
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

int h,w;
int dp[1500][1500];

int main(){
	cin>>h>>w;
	REP(i,h)REP(j,w)cin>>dp[i][j];
	REP(i,h)REP(j,w){
		if(i==0||j==0){
			dp[i][j]=(dp[i][j]==1?0:1);
			continue;
		}
		if(dp[i][j]==0) dp[i][j]=min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]))+1;
		else dp[i][j]=0;
	}
	int res=0 ;
	REP(i,h)REP(j,w)res=max(res,dp[i][j]);
	cout<<res*res<<endl;
	return 0;
}

Measured memory_bytes: 11284
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int w, h, n;
  readf("%s %s %s\n", &w, &h, &n);
  auto f = new bool[][](w, h);
  foreach (_; 0..n) {
    int x, y, a;
    readf("%s %s %s\n", &x, &y, &a);
    if (a == 1) {
      foreach (i; 0..x) {
        f[i][] = true;
      }
    } else if (a == 2) {
      foreach (i; x..w) {
        f[i][] = true;
      }
    } else if (a == 3) {
      foreach (i; 0..y) {
        foreach (j; 0..w) {
          f[j][i] = true;
        } 
      }
    } else {
      foreach (i; y..h) {
        foreach (j; 0..w) {
          f[j][i] = true;
        } 
      }
    }
  }

  int res;
  foreach (i; 0..w) {
    foreach (j; 0..h) {
      if (!f[i][j]) res++;
    }
  }
  res.writeln;
}


Measured memory_bytes: 256
x, y, *_ = map(int, input().split())
p = [(int(i), 1) for i in input().split()]
q = [(int(i), 2) for i in input().split()]
r = [(int(i), 0) for i in input().split()]
s = sorted(p + q + r, reverse=True)

i = 0
a, b, c = 0, 0, 0
cnt = 0
while a + b + c < x + y:
    d, e = s[i]
    if e == 1 and a < x:
        cnt += d
        a += 1
    elif e == 2 and b < y:
        cnt += d
        b += 1
    elif e == 0:
        cnt += d
        c += 1
    i += 1
print(cnt)

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

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0

for i in range(n):
    m1 = a1[:i+1]
    m2 = a2[i:]
    a = sum(m1)+sum(m2)
    ans = max(ans,a)

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int dig(int x){
    int ans = 0;
    while(x!=0){
        ans++;
        x /= 10;
    }
    return ans;
}
int main(){
    long long n ;
    cin >> n;
    int ans = 1000000000;
    for(int i=1; i<=sqrt(n); i++){
        if((n%i)==0){
            int a = i;
            int b = n/i;
            int x = max(dig(a), dig(b));
            ans = min(ans, x);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
S=input()
#偶数回
#左右からfor
N=len(S)
odd=0
even=0
ans=[0]*N
for i in range(N-1):
    if i%2==0 and S[i]=="R":
        even+=1
    if i%2!=0 and S[i]=="R":
        odd+=1

    if S[i]=="R" and S[i+1]=="L":
        if i%2==0:
            ans[i]+=even
            ans[i+1]+=odd
        else:
            ans[i]+=odd
            ans[i+1]+=even
        odd=0
        even=0
odd=0
even=0
for i in range(N-1,0,-1):
    if i%2==0 and S[i]=="L":
        even+=1
    if i%2!=0 and S[i]=="L":
        odd+=1
    if S[i]=="L" and S[i-1]=="R":
        if i%2==0:
            ans[i]+=even
            ans[i-1]+=odd
        else:
            ans[i]+=odd
            ans[i-1]+=even
        odd=0
        even=0
print(*ans)

Measured memory_bytes: 6400
fun main(args: Array<String>) {
    val A = readLine()!!.toInt()
    val B = readLine()!!.toInt()
    val C = readLine()!!.toInt()
    val X = readLine()!!.toInt()

    var x = 0
    for (a in 0..A) {
        for (b in 0..B) {
            for (c in 0..C) {
                if (a * 500 + b * 100 + c * 50 == X) {
                    x++
                }
            }
        }
    }
    println(x)
}



Measured memory_bytes: 31604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanner cin = new Scanner();
            int N = cin.nextInt();
            int K = cin.nextInt();
            var pasta = new int[N + 1];
            for (int i = 0; i < K; i++)
            {
                int a = cin.nextInt();
                int b = cin.nextInt();
                pasta[a] = b;
            }

            int[,,] dp = new int[4,4,N + 1];
            dp[0,0,0] = 1;
            for (int i = 1; i < N + 1; i++)
            {
                if (pasta[i] == 0)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        if (j == 0 && i > 2) continue; 
                        for (int k = 0; k < 4; k++)
                        {
                            if (k == 0 && i > 2) continue; 
                            for (int l = 1; l < 4; l++) {
                                if (j == k && k == l) continue;
                                dp[k, l, i] += dp[j, k, i - 1];
                                dp[k, l, i] %= 10000;
			                }
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < 4; j++)
                    {
                        if (j == 0 && i > 2) continue; 
                        for (int k = 0; k < 4; k++)
                        {
                            if (k == 0 && i > 2) continue; 
                            int l = pasta[i];
                            if (j == k && k == l) continue;
                            dp[k, l, i] += dp[j, k, i - 1];
                            dp[k, l, i] %= 10000;
                        }
                    }
                }
            }

            int ans = 0;
            for (int j = 0; j < 4; j++)
            {
                for (int k = 0; k < 4; k++)
                {
                    ans += dp[j, k, N];
                }
            }

            Console.WriteLine(ans % 10000);

        }
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        do
        {
            s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
        } while ((s.Length == 1 && s[0] == "") || s.Length == 0);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Measured memory_bytes: 5660
from numpy import*;n,M=map(int,input().split())
l=n*3+1
d=zeros((l,n*5),int64)
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+roll(d[k],-1)*j+roll(d[j],1))%M
print(sum(d[-1][:l])%M)


Measured memory_bytes: 481464
n = int(input())
t = list(map(int,input().split()))
a = list(map(int,input().split()))
k = [-1 for i in range(n)]
now = 0
if t[-1] != a[0]:
    print(0)
    exit()
for i in range(n):
    if t[i] > now:
        k[i] = t[i]
        now = t[i]

now = 0
for i in reversed(range(n)):
    if k[i] == -1:
        if a[i] > now:
            k[i] = a[i]
            now = a[i]
    if k[i] != -1:
        if a[i] > now:
            now = a[i]
        if k[i] > now:
            print(0)
            exit()

ans = 1
l = 0
cou = 0
mod = 10**9 + 7
for i in range(n):
    if k[i] != -1 and l == 0:
        l = k[i]
    elif k[i] != -1 and l != 0:
        ans *= pow(min(l,k[i]),cou,mod)
        ans %= mod
        l = k[i]
        cou = 0
    elif k[i] == -1:
        cou += 1
print(ans)

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

#define ll long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);


int main()
{
    ll n,k,x,y;
    cin >> n >> k >> x >> y;
    if(n<=k) cout << n*x << endl;
    else 
    {
        cout << k*x + (n-k)*y << endl;
    }
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[110][10010]={0};
int main(){
	int n,W;
	cin>>n>>W;
	vector<int>v(n),w(n);
	rep(i,n)cin>>v[i]>>w[i];
//	vector<vector<int> >dp(n+1,vector<int>(w+1));
	rep(i,110)rep(j,10010)dp[i][j]=-1;
	dp[0][0]=0;
	rep(i,n){
		rep(j,W+1)if(dp[i][j]>=0){
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			if(j+w[i]<=W)dp[i][j+w[i]]=max(dp[i][j+w[i]],dp[i][j]+v[i]);
		}
	}
	int out=0;
	rep(i,W+1)out=max(out,dp[n][i]);
	cout<<out<<endl;
}

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

int main(){
  int N;
  cin >> N;
  int count = 0;
  int c;  
  for(int i=1;i<=N;i+=2){
    c=0;
    for(int j=1;j<=i;j++){
      if(i%j == 0) c++;
    }
    if(c==8) count++;
    
  }
  cout << count << endl;
}


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

int main()
{
  int N;
  int res=0;
  priority_queue<int> pq;
  cin >> N;

  rep(i,N) {
      int d;
      cin >> d;
      pq.push(d);
  }

  int levelL, levelR;
  for(int i=1;i<=N/2;i++){
    levelR = pq.top();
    pq.pop();
  }

  levelL = pq.top();
  res = levelR-levelL;
  
  cout << res << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>

using namespace std;
#define INF 2e9 + 9
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}


vector<vector<int>> to;
vector<int> flag;
vector<int> c;

Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};



int main(void) {
    Int s;
    cin >> s;
    set<Int> a;
    a.insert(s);
    Int cnt = 2;
    while(true){
        if (s % 2 == 0) s /= 2; else s = 3 * s + 1;
        if (a.find(s) != a.end()) break;
        cnt++;
        a.insert(s);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(int n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
ll combination(ll n, ll r)
{
	if (r * 2 > n)
		r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i)
	{
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}
vector<int> divisor(int n)
{
	vector<int> value;
	FOR(i, 1, pow(n, 0.5) + 1)
	{
		if (i <= sqrt(n))
		{
			if (n % i == 0)
			{
				value.push_back(i);
				if (i * i != n)
				{
					value.push_back(n / i);
				}
			}
		}
	}
	return value;
}
int main()
{
	int a, b;
	cin >> a >> b;
	if(a+b==15){
		cout<<"+"<<endl;
	}else if(a*b==15){
		cout<<"*"<<endl;
	}else{
		cout<<"x"<<endl;
	}
}

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

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = (int) s.size();
    vector<int> cnt(26, 0);
    for (int i = 0; i < n; ++i) {
        ++cnt[s[i] - 'a'];
    }

    if (n < 26) {
        cout << s;
        for (int i = 0; i < 26; ++i) {
            if (cnt[i] == 0) {
                cout << (char) ('a' + i) << endl;
                return 0;
            }
        }
    }

    for (int i = n - 1; i >= 0; --i) {
        for (int j = (int) (s[i] - 'a') + 1; j < 26; ++j) {
            if (cnt[j] == 0) {
                cout << s.substr(0, i);
                cout << (char) ('a' + j) << endl;
                return 0;
            }
        }
        cnt[s[i] - 'a'] = 0;
    }

    cout << -1 << endl;
}

Measured memory_bytes: 256
while(True):
    try:
        m, n_min, n_max = map(int, input().split())
        Ps = sorted(list(int(input()) for i in range(m)), reverse=True)
        max_v = 0
        ans = 0
        if m == 0:
            break
        for i in range(n_min, n_max+1):
            if i == len(Ps):
                break
            if max_v <= Ps[i-1]-Ps[i]:
                max_v = Ps[i-1]-Ps[i]
                ans = i
        print(ans)
    except:
        break



Measured memory_bytes: 5624
#include <iostream>
#include <string>
#include <map>
#include <math.h>
#include <complex>

using namespace std;

int main(){

    int D,E;

    while(cin>>D>>E,D||E){

        int x,y;
        double direction,temp_direction;

        temp_direction = 1000000;

        for(int i=0;i<D;i++){
            direction=abs(sqrt(pow(i,2.0)+pow(D-i,2.0))-E);
            if(temp_direction>direction){
                temp_direction = direction;
                x=i;
                y=D-i;
            } 
        }

        cout<<temp_direction<<endl;
    }

    return 0;
}


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


int main(void)
{
    string line;

    getline(cin, line);
    line.append(line);
    string search;
    getline(cin, search);
    if (line.find(search) != string::npos)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	map<ll,ll> mp;
	rep(i,n){
		ll a;
		cin>>a;
		mp[a]++;
	}
	rep(i,m){
		ll b,c;
		cin>>b>>c;
		mp[c]+=b;
	}
	ll sum=0;
	auto itr=mp.end();
	itr--;
	while(n){
		if(itr->se<=n){
			sum+=itr->fi*itr->se;
			n-=itr->se;
		}else{
			sum+=itr->fi*n;
			break;
		}
		itr--;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 12800
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
long long f(int n,int m){
	if(m==0 || m > n) return 1;
	return f(n,m-1) * (n-m+1) / m;
}
int main()
{
	int n, p;
	while(~scanf("%d%d", &n, &p)) {
		int odd = 0, num;
		for (int i = 0; i < n; ++i) {
			scanf("%d", &num);
			odd += num % 2;
		}
		int even = n - odd;
		long long tmp = 0;
		for (int i = 0; i <= even; ++i) 
			tmp += f(even, i);
		long long ans = 0;
		for (int i = p; i <= odd; i += 2)
			ans += f(odd, i) * tmp;
		printf("%lld\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
 
   
int main(){
  int x,n,ans;
    cin >> x >> n;
    set<int> pp;
    rep(i,n){
        int a;
      cin >> a;
      pp.insert(a);
    }
    int mn=10000000;
    for(int i=120;i>=-120;i--){
        if(pp.count(i)){}
        else{
          if(mn>=abs(i-x)){
            ans=i;
          }
          mn=min(abs(x-i),mn);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3544
#include <iostream>
#include <cmath>

bool solve(int t, int x, int y){
  int total = x + y;
  if(total > t){
    return false;
  } else {
    if((t - total) % 2 == 0){
      return true;
    } else {
      return false;
    }
  }
  return false;
}

int main(){
  int t;
  std::cin >> t;
  bool ans = true;
  for(int i = 0; i < t; i++){
    int time, x, y;
    std::cin >> time >> x >> y;
    bool b = solve(time, x, y);
    if(!b){
      ans = false;
    }
  }

  if(ans){
    std::cout << "Yes" << '\n';
  } else {
    std::cout << "No" << '\n';
  }
}


Measured memory_bytes: 256
x,y,z = map(int,input().split())
 
if(x==5):
  if(y==5):
    if(z==7):
      print("YES")
    else:
      print("NO")
  elif(y==7):
    if(z==5):
      print("YES")
    else:
      print("NO")
elif(x==7):
  if(y==5):
    if(z==5):
      print("YES")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")

Measured memory_bytes: 38256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

struct Card{
	char suit;
	int value;
};

void mergeSort(struct Card *, int, int);
void quickSort(struct Card *, int, int);
struct Card *A;
struct Card *L;
struct Card *R;
struct Card *sortS;
int n;
int count=0;
struct Card *B;

int main(){
  int stable = 1;
  int q;
  int flug=0;
  int i,j;
  
  scanf("%d",&n);
  A = (struct Card *)malloc(sizeof(struct Card) * n);
  B = (struct Card *)malloc(sizeof(struct Card) * n);
  for(i=0;i<n;i++){
    scanf("%s %d",&A[i].suit,&A[i].value);
    B[i].suit = A[i].suit;
	B[i].value = A[i].value;
}
 
  mergeSort(A,0,n);
  quickSort(B,0,n-1);
	
  for(i=0; i<n; i++){
  	if(A[i].suit != B[i].suit) stable = 0;
  }

	if(stable == 1) printf("Stable\n");
	else printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",B[i].suit, B[i].value);
  }
  
}

void merge(struct Card A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
 
  n1 = mid - left;
  n2 = right - mid;
  L = (struct Card *)malloc(sizeof(struct Card)*(n1+2));
  R = (struct Card *)malloc(sizeof(struct Card)*(n2+2));
  for (i = 0;i < n1; i++){
    L[i] = A[left + i];
  }
  for (i = 0; i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1].value = 1000000001;
  R[n2].value = 1000000001;
  i = 0;
  j = 0;
  for (k = left;k<right;k++){
    count++;
    if(L[i].value <= R[j].value){
      A[k] = L[i];
      i = i + 1;
    }else {
      A[k] = R[j];
      j = j + 1;
    }
  }
}


void mergeSort(struct Card *A,int left,int right){
  int mid;
  if(left+1<right){
    mid = (left +right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

void quickSort(struct Card *A, int p, int r){
	int q;
	if(p < r){
		q = partition(A, p, r);
		quickSort(A, p, q-1);
		quickSort(A, q+1, r);
	}
}
int partition(struct Card *A,int p,int r){
  int x;
  int i,j;
  struct Card tmp;
  x = A[r].value;
  i = p - 1;
  for(j=p; j<r; j++){
    if(A[j].value <= x ){
      i = i + 1;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}




Measured memory_bytes: 21508
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n,m;
  cin>>n>>m;

  cout<<((n==m)? "Yes":"No")<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N; cin >> N;
    vector<int> L(N);
    for(int i = 0;i < N; ++i) cin >> L[i];
    sort(L.begin(), L.end());
    long long ans = 0;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < i; ++j){
            int r = lower_bound(L.begin(), L.end(), L[i]+L[j]) - L.begin();
            int l = i+1;
            ans += r - l;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int ans = MAX;
    for (int i = 0; i < N; i++) {
        int x = A[i];
        int cnt = 0;
        while (x % 2 == 0) {
            cnt++;
            x /= 2;
        }
        chmin(ans, cnt);
    }

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

Measured memory_bytes: 256
#include <iostream>

#define INFTY 1e15

using namespace std;

int count = 0;

void merge(int a[], int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int l[n1], r[n2];
	for(int i=0; i<n1; i++) l[i] = a[left+i];
	for(int i=0; i<n2; i++) r[i] = a[mid+i];
	l[n1] = INFTY;
	r[n2] = INFTY;
	int i=0;
	int j=0;
	for(int k=left; k<right; k++){
		count++;
		if(l[i] <= r[j]){
			a[k] = l[i];
			i++;
		}else{
			a[k] = r[j];
			j++;
		}
	}
}

void mergeSort(int a[], int left, int right){
	if(left+1 < right){
		int mid = (left + right)/2;
		mergeSort(a, left, mid);
		mergeSort(a, mid, right);
		merge(a, left, mid, right);
	}
}

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

	int array[n];
	for(int i=0; i<n; i++) cin >> array[i];

	mergeSort(array, 0, n);

	for(int i=0; i<n; i++){
		cout << array[i];
		if(i!=n-1) cout << " ";
	}
	cout << endl;
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 6920
import java.util.Scanner;

public class Main
{
	static int[] A;
	
	static boolean isValid()
	{
		for (int i = 0; i < A.length; i++)
		{
			if (A[i] == i + 1) return false;
		}
		return true;
	}
	
	public static void main(String[] Arguments)
	{
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		A = new int[N];
		for (int i = 0; i < N; i++)
		{
			A[i] = sc.nextInt();
		}
		int count = 0;
		while (!isValid())
		{
			for (int i = 0; i < A.length - 1; i++)
			{
				if (A[i] == i + 1)
				{
					count++;
					int temp = A[i];
					A[i] = A[i + 1];
					A[i + 1] = temp;
				}
			}
			if (A[A.length - 1] == A.length)
			{
				count++;
				int temp = A[A.length - 1];
				A[A.length - 1] = A[A.length - 2];
				A[A.length - 2] = temp;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 59512
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int mp[11][1010];
int bel[11],tot,sum[11];
int Next(int x)
{
	memset(sum,0,sizeof(sum));
	int p=x;
	while(x<=m)
	{
		bool flag=1;
		for(int i=1;i<=n;i++)
		{
			sum[bel[i]]+=mp[i][x];
			if(sum[bel[i]]>k) 
				flag=0;
		}
		if(!flag) 
			break;
		x++;
	}
	if(p==x) 
		return -1;
	return x;
}
int main()
{
	int minn=2e9;
	scanf("%d %d %d",&n,&m,&k);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) 
			scanf("%1d",&mp[i][j]);
	for(int i=(1<<(n-1))-1;i>=0;i--)
	{
		bel[1]=tot=1;
		for(int j=2;j<=n;j++)
		{
			if(i&(1<<(j-2))) 
				bel[j]=bel[j-1];
			else 
				bel[j]=++tot;
		}
        int x=1,ans=0;
        while(x!=-1&&x<=m) 
			x=Next(x),ans++;
        if(x!=-1) 
			minn=min(minn,ans+tot-2);
	}
	printf("%d\n",minn);
	return 0;
}

Measured memory_bytes: 256
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;


 
public class Main{
	
        static final Scanner sc=new Scanner(System.in);
        
        
        
        
        
        
        public static void main(String[]args){
                int N=sc.nextInt();
                if(N%2==0){
                        System.out.println(N*N/4);
                }else{
                        System.out.println((N+1)*(N-1)/4);
                }

                
                
                


                
        }
        
        
        

		
	
}


Measured memory_bytes: 23252
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
ll longinf=1ll<<60;
int inf=1<<29;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
int dh[4]={0,1,0,-1};
int dw[4]={1,0,-1,0};

int main (){
      int N;
      cin>>N;
      P p[N];
      rep0(i,N){
            cin>>p[i].first>>p[i].second;
      }
      sort(p,p+N);
      map<P,vector<Q>> v;
      rep0(i,N){
            if(i!=(N-1)){
                  ll d = abs(p[i+1].first-p[i].first);
                  v[p[i]].push_back({d,p[i+1]});
            }
            if(i!=0){
                  ll d=abs(p[i].first-p[i-1].first);
                  v[p[i]].push_back({d,p[i-1]});
            }
      }
      rep0(i,N){
            swap(p[i].first,p[i].second);
      }
      sort(p,p+N);
      rep0(i,N){
            swap(p[i].first,p[i].second);
      }
      rep0(i,N){
            if(i!=(N-1)){
                  ll d=abs(p[i+1].second-p[i].second);
                  v[p[i]].push_back({d,p[i+1]});
            }
            if(i!=0){
                  ll d=abs(p[i].second-p[i-1].second);
                  v[p[i]].push_back({d,p[i-1]});
            }
            sort(v[p[i]].begin(), v[p[i]].end());
            v[p[i]].erase(std::unique(v[p[i]].begin(), v[p[i]].end()), v[p[i]].end());
      }
      /*rep0(i,N){
            cout<<i<<"  ";
            rep0(j,v[p[i]].size()){
                  cout<<v[p[i]][j].first<<" "<<v[p[i]][j].second.first<<" "<<v[p[i]][j].second.second<<"  ";
            }
            cout<<endl;
      }*/
      map<P,ll> d;
      map<P,bool> merged;
      rep0(i,N){
            d[p[i]]=longinf;
            merged[p[i]]=false;
      }
      d[p[0]]=0;
      priority_queue<Q,vector<Q>,greater<Q>> q;
      q.push({d[p[0]],p[0]});
      ll ans=0;
      while(q.size()){
            Q hoge = q.top();
            q.pop();
            ll di = hoge.first;
            P node = hoge.second;
            if(merged[node]) continue;
            ans+=di;
            merged[node]=true;
            for(int i=0;i<v[node].size();i++){
                  ll nd = v[node][i].first;
                  P np =v[node][i].second;
                  d[np]=min(d[np],nd);
                  q.push({d[np],np});
            }
      }
      cout<<ans<<endl;

      return 0;
}


Measured memory_bytes: 37108
import java.util.Scanner;

public class Main {
	public static void main(String[] args ) {

		Scanner scanner = new Scanner(System.in);
		int numOfSheep = scanner.nextInt();
		int numOfWolf = scanner.nextInt();

		if(numOfSheep<=numOfWolf) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}

		scanner.close();
	}
}

Measured memory_bytes: 35764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
     if(a==b && b==c) cout<<"No\n";
     else if(a!=b && a!=c && b!=c) cout<<"No\n"<<endl;
     else cout<<"Yes\n"<<endl;
     return 0;
}


Measured memory_bytes: 256
import math
n,d = map(int ,input().split())
l=[list(map(int ,input().split())) for x in range(n)]
ans=0
cnt=0
k=0
for i in range(n-1):
    
    for k in range(n-i-1):
        ans=0
        for j in range(d):
            ans+=abs((l[i][j])-(l[i+1+k][j]))**2
        if float.is_integer(math.sqrt(ans))==True:
            cnt+=1
print(cnt)  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

using namespace std;

typedef long long ll;

ifstream fin ("spioni.in");
ofstream fout ("spioni.out");

#define f first
#define s second

int f[100002], n, m, nr1, nr2, x;
string s;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x >> s;
    if (s == "AC") {
      if (f[x] != -1) {
        nr2 += f[x];
        nr1++;
      }
      f[x] = -1;
    }
    else {
      if (f[x] != -1)
        f[x]++;
    }
  }
  cout << nr1 << " " <<nr2;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
   for (int i = 0; i < N; i++) {
     cin >> vec.at(i);
   }
  int a = 1;
  int x = 0;
   for (int i = 0; i < N; i++) {
     if (vec.at(i) != a){
       x ++;
     }
     else {
       a ++;
     }
   }
  if (x == N)
    x = -1;    
  cout << x << endl;     
}

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

int main(){
   string S;
   cin >>S;
   int count =0;
  
    for(int i=0;i<3;i++){
      //文字なので''が必要である
      if(S[i]=='1') count++;
    }
   
   cout<<count<<endl;

return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    int n;
    cin>>n;
    set<string> st;
    rep(i, n) {
        string ins, s;
        cin>>ins>>s;
        if (ins == "insert") st.insert(s);
        else {
            set<string>::iterator iter = st.find(s);
            if (iter != st.end()) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
}


Measured memory_bytes: 29020
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long ;
using ld=long double;


int main(){
    int n;
    cin>>n;
    vector<int> v(n),a(3);
    for(int i=0;i<n;i++)
    cin>>v[i];
    int c=0;
    for(int i=1;i<n-1;i++){
        int a[3]={v[i-1],v[i],v[i+1]};
        sort(a,a+3);
        if(v[i]==a[1])
        c++;
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int K;
	int N;
	cin >> K >> N;
	vector<int> A(N);
	int total = 0;
	
	for(int i = 0;i<=N;i++){
		std::cin >> A[i];
	}
	total = A[0]+K-A[N-1];
	
	for(int i = 1;i<=N;i++){
		if(total<A[i]-A[i-1]){
			total = A[i]-A[i-1];
		}
	}
	std::cout << K-total << std::endl;
  
}


Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main() 
{
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	
	if ( x > 0 && y > 0 && x <= W-r && y <= H-r )
cout << "Yes" << endl;
	else
cout << "No" << endl;

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> length(N);
  for(int i = 0; i < N; i++) {
    cin >> length.at(i);
  }
  sort(length.begin(), length.end());
  int ans = 0;
  for(int i = 0; i < N - 2; i++) {
    for(int j = i + 1; j < N - 1; j++) {
      int l = length.at(i) + length.at(j);
      int a = j + 1;
      int b = N - 1;
      if(a == b) {
        if(length.at(b) < l) {
          ans++;
        }
        continue;
      }
      else if(a == b - 1) {
        if(length.at(a) < l) {
          ans++;
        }
        if(length.at(b) < l) {
          ans++;
        }
        continue;
      }
      if(length.at(b) < l) {
        ans += N - 1 - j;
        continue;
      }
      if(length.at(a) >= l) {
        continue;
      }
      while(b - a > 1) {
        if(length.at((a + b) / 2) < l) {
          a = (a + b) / 2;
        }
        else {
          b = (a + b) / 2;
        }
      }
      ans += a - j;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
	string in;
	while(cin >> in, !cin.eof()){
		int joi = 0, ioi = 0;
		for(int i = 0; i < (int)in.size() - 2; i++){
			string str = "";
			for(int j = 0; j < 3; j++) str += in[i+j];
			// cout << str << endl;
			if(str == "JOI") joi++;
			else if(str == "IOI") ioi++;
		}
		cout << joi << endl << ioi << endl;
	}

	return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
int main()
{
    int i;
	int n[26]={0};
	int x;
	int num;
    char str[1200];
	char str2[27];
	char tmp=1;
    for(i=0;i<26;i++){
        str2[i]=97+i;
    }
    i=0;
    while(scanf("%c",&tmp)!=EOF){   
        str[i]=tmp;
        i++;
    }
    num=i-1;
    for(i=0;i<num;i++){
        if('a'<=str[i]&&str[i]<='z'){
            x=str[i]-'a';
            n[x]+=1;
        }else if('A'<=str[i]&&str[i]<='Z'){
            x=str[i]-'A';
            n[x]+=1;
        }
    }
    for(i=0;i<26;i++){
        std::cout<<str2[i]<<" : "<<n[i]<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
 
int main(){
  long long int A, P;
  cin >> A >> P;
  
  cout << (A*3 + P) /2 << endl;

  return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back


int main() {
  int N;
  cin >> N;
  int ans = N, i;
  bool flag = true;
  while(flag) {
    for(i = 2; i < ans; i++){
      if (ans%i == 0) {
        break;
      }
    }
    if (i == ans) flag = false;
    else ans++;
  }
    
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int a=read(),b=read(),n=read(),ans=0;
signed main(){
	fz(i,max(min(n,b-1)-100000000,0ll),min(n,b-1)){
		ans=max(ans,(int)(1.0*a*i)/b);
//		cout<<i<<" "<<(int)(1.0*a*i/b)-a*(int)(1.0*i/b)<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using ll = long long;

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

 int n, count=0, ans=0;
 int m = 10000000;
 string s;
 int s1;
 cin >> n;
 vector<int> w(n); 
 rep(i,n){
   cin >> w.at(i);
   count+= w.at(i);
 }
 s1=w.at(0);
 rep(i,n-1){
   int s2 = count - s1;
   m = min(m,abs(s2-s1));
   s1+=w.at(i+1);
 }
 cout << m << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<limits>
#include<algorithm>
#include<string>
#include <iomanip>
using namespace std;
int main(){
    long double hoge;
	cin>>hoge;
	//cout<<hoge/3<<endl;
	cout<< fixed<<(hoge/3)*(hoge/3)*(hoge/3)<<endl;
}

Measured memory_bytes: 256