akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
    int a;
    scanf("%d", &a);
    if(a >= 0 && a <= 10){
        printf("%d", a + a*a + a*a*a);
    }else{
        printf("1から10の整数を入力してください！");
    }

    return 0;
}

Measured memory_bytes: 1720
import sys
input=sys.stdin.readline
A,B,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=min(a)+min(b)
for i in range(m):
	x,y,c=map(int,input().split())
	ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)


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

s = []
t = []
for i in range(n):
    inp = input().split()
    inp[1] = int(inp[1])
    s.append(inp[0])
    t.append(inp[1])

x = input()

time = 0
for i in range(s.index(x)+1, len(t)):
    time += t[i]

print(time)

Measured memory_bytes: 3064
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n=I()
lis=[SI() for i in range(n)]
c=Counter(lis)
print("AC x",end=" ")
print(c["AC"])
print("WA x",end=" ")
print(c["WA"])
print("TLE x",end=" ")
print(c["TLE"])
print("RE x",end=" ")
print(c["RE"])

Measured memory_bytes: 16516
#include<bits/stdc++.h>
#include <scoped_allocator>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector < pair<ll, ll > > vp1;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/



int main()
{
	cin >> n;
	v.resize(n);
	REP(i, n) cin >> v[i];
	v1.resize(n);
	REP(i,n-1)
	{
		ll a;
		a = v[i + 1] - v[i];
		if(a!=0)
		{
			v1.push_back(a);
		}
	}
	REP(i,v1.size()-1)
	{
		if(v1[i+1]*v1[i]<0)
		{
			ans++;
			i++;
		}
	}
	cout << ++ans << endl;
}


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

using namespace std;


void solve(long long N, long long T, vector<long long> c, vector<long long> t)
{
    long long an = INT_MAX;
    for (int i = 0; i < N; ++i) if (t[i] <= T) {
        an = min(an, c[i]);
    }
    if (an == INT_MAX) {
        cout << "TLE\n";
    } else {
        cout << an << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long N;
    cin >> N;
    long long T;
    cin >> T;
    vector<long long> c(N);
    vector<long long> t(N);
    for(int i = 0 ; i < N ; i++){
        cin >> c[i];
        cin >> t[i];
    }
    solve(N, T, move(c), move(t));
    return 0;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; ll C;
  cin >> N >> C;
  vl x(N),v(N);
  rep(i,N) cin >> x[i] >> v[i];
  ll ans = 0LL;
  vl s1(N),s2(N);
  ll ss = 0LL;
  rep(i,N){
    ss += v[i];
    s1[i] = ss - x[i];
    chmax(ans,s1[i]);
  }
  ss = 0LL;
  rrep(i,N-1){
    ss += v[i];
    s2[i] = ss - (C-x[i]);
  }
  vl ma1(N),ma2(N);
  ll ma = 0LL;
  rep(i,N){
    ma1[i] = ma;
    chmax(ma,s1[i]-x[i]);
  }
  ma = 0LL;
  rrep(i,N-1){
    ma2[i] = ma;
    chmax(ma,s2[i]-(C-x[i]));
  }
  dump(ma1);
  dump(ma2);
  ma = 0LL;
  rep(i,N){
    chmax(ma,s1[i]);
    chmax(ans,ma+ma2[i]);
  }
  ma = 0LL;
  rrep(i,N-1){
    chmax(ma,s2[i]);
    chmax(ans,ma+ma1[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6272
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    vector<int> A(100000+1);
    vector<ll> ans(100000+1);
    REP(i, N) {
        int a;
        cin >> a;
        A[a]++;
        ans[0] += a;
    }
    int Q;
    cin >> Q;
    REP(i, Q) {
        int b, c;
        cin >> b >> c;
        ans[i+1] = ans[i] + (c - b) * A[b];
        A[c] += A[b];
        A[b] = 0;
    }
    REP(i, Q) {
        cout << ans[i+1] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 4576
n = gets.to_i
p_i = gets.split.map(&:to_i)
second = []
for k in 1...n-1
    if (p_i[k-1].to_i < p_i[k].to_i && p_i[k].to_i < p_i[k+1].to_i) || (p_i[k].to_i < p_i[k-1].to_i && p_i[k+1].to_i < p_i[k].to_i)
        second.push(p_i[k])
    end
end
puts second.size

Measured memory_bytes: 1916
N, M = [int(x) for x in input().split()]

AB = []
for i in range(M):
    a, b = [int(x) for x in input().split()]
    AB.append((a, b))

AB.sort(key=lambda x: x[1])

ans = 0
while len(AB) != 0:
    cut = AB[0][1]
    newAB = []
    ans += 1
    for a, b in AB:
        if a < cut:
            pass
        else:
            newAB.append((a, b))
    AB = newAB

print(ans)


Measured memory_bytes: 131868
local mod = 1000000007
local mfl = math.floor
local function bmul(x, y)
  local x0, y0 = x % 31623, y % 31623
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end
local n = io.read("*n")
local r = 1
for i = 2, n do
  r = bmul(r, i)
end
print(r)


Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(a);
    cini(b);
    cout<<a*b<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

int main(){
    int n;
    cin >> n;
    char s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    int count=0;

    for(int i=0;i<n-2;i++){
        if(s[i]=='A'){
            if(s[i+1]=='B'){
                if(s[i+2]=='C'){
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int[] n = new int[3];
  n[0] = sc.nextInt();
  n[1] = sc.nextInt();
  n[2] = sc.nextInt();
  Arrays.sort(n);
  int count = 0;
  count += (n[1] - n[0])/2;
  if((n[1] - n[0])%2 == 0)count += n[2] - n[1];
  else{
    count += n[2] - n[1] + 2;
  }
  System.out.println(count);
}}

Measured memory_bytes: 21972
n = gets.chomp.to_i
town = []
n.times{town << gets.chomp.split(" ").map(&:to_i)}
ans = 0.0
bunnbo = 0.0

town.permutation(n).each do |arr|
    bunnbo += 1.0
    (n-1).times do |idx|
        xi, yi = arr[idx]
        xj, yj = arr[idx+1]
        ans += Math.sqrt((xi-xj)*(xi-xj) + (yi-yj)*(yi-yj))
    end
end

puts ans / bunnbo

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
	int N, Q;
	int sum[100005] = {};
	string S;
	cin >> N >> Q >> S;
	
	for (int i = 1; i < N; i++) {
		sum[i + 1] += sum[i] + (int)(S[i - 1] == 'A' && S[i] == 'C');
	}
	
	while (Q--) {
		int l, r;
		cin >> l >> r;
		cout << sum[r] - sum[l] << endl;
	}

    return (0);
}

Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

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

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define mod 1000000007

int main()
{

    string ss;
    cin >> ss;
    set<char> s;
    for(ll i = 0; i < ss.size(); i++) s.insert(ss[i]);
    if(s.size()==ss.size()) cout << "yes";
    else cout << "no";
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x=0,y=0,z,cnt=0;
		int k=sc.nextInt();
		int s=sc.nextInt();
		for(x=0;x<=k;x++) {
			for(y=0;y<=k;y++) {
				if(s-(x+y)>=0 && s-(x+y)<=k) {
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}

}


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

namespace ProconTemplate
{
    class Doing
    {
        public static void Main(string[] args)
        {
            var num = int.Parse(Console.ReadLine());
            var str = Console.ReadLine();

            if (num >= 3200)
            {
                Console.WriteLine(str);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}


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

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<int> d;
	for (int i = 0; i < n; i++) {
		d.push_back(0);
		cin >> d[i];
	}

	sort(d.begin(), d.end());

	cout << d[n / 2] - d[n / 2 - 1] << endl;

}

Measured memory_bytes: 892
import math

N = input()
A = list(map(int, input().split()))
n = 0
d = 0

while n >= 0:
    for a in A:
        if a%2 == 1:
            print(n)
            d += 1
            break
    if d > 0:
        break
    A = [a/2 for a in A] #Aを2で割る
    n += 1
    

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

typedef long long ll;
typedef pair<ll, ll> P;

int s;

int main(){
    cin >> s;
    
    vector<int> num;
    num.push_back(s);
    map<int, int> m;
    m[s]++;
    int i = 0;
    while(1){
        if(num[i] % 2 == 0){
            num.push_back(num[i] / 2);
        } else {
            num.push_back(3 * num[i] + 1);
        }
        i++;
        m[ num[i] ]++;
        if(m[ num[i] ] >= 2)  break;
    }

    cout << i + 1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long long int n,a,b,ans=0,tmp,rem;
    scanf("%lld%lld%lld",&n,&a,&b);

    tmp = n / (a + b);
    ans += a * tmp;

    rem = n - (a + b) * tmp;

    if(rem < a){
        ans += rem;
    }else{
        ans += a;
    }

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

Measured memory_bytes: 1732
#include<stdio.h>
#include<iostream>

//最大公約数を求める関数                                             
int GCD(int a,int b){
  if(a%b==0){
    return b;
  }else{
    return (GCD(b,a%b));
  }
}

int main(){

  int a,b,c;
  int fgcd;
  int total; total=0;
  int K; scanf("%d",&K);

  for(a=1;a<K+1;a++){//a                                             
    for(b=1;b<K+1;b++){//b                                           
      for(c=1;c<K+1;c++){//c                                         
        fgcd=GCD(a,b);
        total += GCD(fgcd,c);
      }
    }
  }
  printf("%d\n",total);
  return 0;
}


Measured memory_bytes: 3816
N = int(input())
S = input()

# 左は尺取り。しかも３とって失敗したら、l,r双方いんくりしてよい
# 右は総当たり。

ans = 0
l,r = 0,1
while l<N and r<N:
  findf = False
  target = S[l:r]
  L = r-l
  for k in range(l+L,N-1):
    compare = S[k:k+L]
    #print(target, compare)
    if target == S[k:k+L]:
      ans = max(ans,L)
      findf = True
      break
  if findf and r < N-1:
    r += 1
  else:
    l += 1
    r = min(r+1,N-1)
    
print(ans)

Measured memory_bytes: 75140
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  long long a;
  long long b;
  long long c;
  cin >> a >>b >> c;
  long long d =b+c;
  long long e;
  
  e =a / (b+c) * b ;
  e += min(b,a % (b + c));
  cout << e;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  int n;
  cin>>n;
  int arr[n][3];
  for(int i=0;i<n;i++)
  {
      cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
  }
  ll dp[n][3];
  dp[0][0]=arr[0][0];
  dp[0][1]=arr[0][1];
  dp[0][2]=arr[0][2];
  for(int i=1;i<n;i++)
  {
      dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr[i][0];
      dp[i][1]=max(dp[i-1][2],dp[i-1][0])+arr[i][1];
      dp[i][2]=max(dp[i-1][0],dp[i-1][1])+arr[i][2];
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
  return 0;
}


Measured memory_bytes: 3712
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
class Edge
{
	public:
	int to,cost;
	Edge(int t,int c)
	{
		to=t;cost=c;
	}
};
vector<Edge> g[10000];
vector<Edge> g2[10000];
map<string,int> mp; //都市名をインデックスに直す
vector<int> check; //stとgl, LPGステーションの位置
int d[10000];

//始点sからの縮約前のダイクストラ
void dijk(int s)
{
	fill(d,d+10000,1e8-1);
	priority_queue<P,vector<P>,greater<P> > q;
	d[s]=0;
	q.push(P(0,s));
	while(!q.empty())
	{
		P p=q.top();q.pop();
		if(p.first>d[p.second])
			continue;
		for(int i=0;i<g[p.second].size();i++)
		{
			Edge e=g[p.second][i];
			if(p.first+e.cost<d[e.to])
			{
				d[e.to]=p.first+e.cost;
				q.push(P(d[e.to],e.to));
			}
		}
	}
	return;
}

int main()
{
	while(1)
	{
		int n,m,cap;
		int cnt=1;
		mp.clear();
		for(int i=0;i<10000;i++)
		{
			g[i].clear();
			g2[i].clear();
		}
		check.clear();
		cin>>n>>m>>cap;
		if(n==0)
			break;
		string st,gl;
		cin>>st>>gl;
		//cerr<<gl<<endl;
		mp[st]=cnt; //スタートは1
		cnt++;
		mp[gl]=cnt; //ゴールは2
		cnt++;
		check.push_back(1);
		check.push_back(2);
		for(int i=0;i<n;i++)
		{
			string f,t;
			int dest;
			cin>>f>>t>>dest;
			if(mp[f]==0)
			{
				mp[f]=cnt;
				cnt++;
			}
			if(mp[t]==0)
			{
				mp[t]=cnt;
				cnt++;
			}
			g[mp[f]].push_back(Edge(mp[t],dest));
			g[mp[t]].push_back(Edge(mp[f],dest));
		}
		//LPG
		for(int i=0;i<m;i++)
		{
			string s;
			cin>>s;
			if(mp[s]==0)
			{
				mp[s]=cnt;
				cnt++;
			}
			check.push_back(mp[s]);
		}

		//ここからダイクストラ（1回目）
		for(int i=0;i<check.size();i++)
		{
			dijk(check[i]);
			for(int j=0;j<check.size();j++)
			{
				if(i==j)
					continue;
				if(d[check[j]]<=cap*10)
					g2[check[i]].push_back(Edge(check[j],d[check[j]]));
			}
		}
		//ダイクストラ（2回目）
		priority_queue<P,vector<P>,greater<P> > q;
		fill(d,d+10000,1e8-1);
		d[1]=0;
		q.push(P(0,1));
		while(!q.empty())
		{
			P p=q.top();q.pop();
			if(p.first>d[p.second])
				continue;
			for(int i=0;i<g2[p.second].size();i++)
			{
				Edge e=g2[p.second][i];
				if(e.cost+p.first<d[e.to])
				{
					d[e.to]=e.cost+p.first;
					q.push(P(d[e.to],e.to));
				}
			}
		}
		if(d[2]==1e8-1)
			cout<<-1<<endl;
		else
			cout<<d[2]<<endl;
	}
	return 0;
}


Measured memory_bytes: 6504
#include <stdio.h>
#define N 123456

main() {
  int n, count, i;

  while(1) {
    scanf("%d", &n);
    if(n==0) break;
    count=0;
    /* 合成数pは x＜＝√pとなる素因子xをもつ 
       例えば When x=31, i= 2, 3, 4, 5, 6, 7, 8...で
                                       ↑ここまで なぜなら√31<=6
				       すなわち i<=√x or  i*i<=x
    */
    for(i=n+1 ; i<=n*2 ; i++) {
      if(i%2 == 0 && i>2) continue;
      count += Prime(i);
    }
    printf("%d\n", count);
  }

  return 0;
}

int Prime(int x) {
  int i;

  for(i=3 ; i*i<=x ; i++)
    if(x%i == 0) return 0;
  return 1; 
}

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

int main(){
    int N,M;
    long long mod = 1000000007;
    cin >> N >> M;
    vector<int> a(M);
    for (int i=0;i<M;i++){
        cin >> a[i];
    }
    vector<long long> dp(N+2,1);
    for (int i=0;i<a.size();i++){
        dp[a[i]+1] = 0;
    }
    dp[0] = 0;
    for (int i=2;i<dp.size();i++){
        if (dp[i]==0){
            continue;
        }
        dp[i] = (dp[i-1] + dp[i-2]) % mod;
    }
    cout << dp[dp.size()-1] << endl;
    return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string S, T; cin >> S >> T;
  ll A, B; cin >> A >> B;
  string U; cin >> U;
  if (S == U) {
    cout << A - 1 << " " << B << endl;
  }else {
    cout << A << " " << B - 1 << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int d = n%10;
	if(d==2 || d==4 ||d==5 ||d==7 ||d==9)
		cout<<"hon";
	else if(d==0 ||d==1||d==6 ||d==8)
		cout<<"pon";
	else
		cout<<"bon";
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e12;
using Graph = vector<vector<int>>;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

signed main(){
  int H, W;
  cin >> H >> W;
  int SH, SW, GH, GW;
  cin >> SH >> SW >> GH >> GW;
  SH--; SW--; GH--; GW--;

  vector<string> S(H);
  for( int i = 0; i < H; i++ ) cin >> S[i];

  vector<vector<int>> dist(H, vector<int>(W, INF));
  dist[SH][SW] = 0;
  deque<pair<int, int>> que;
  que.push_front(make_pair(SH, SW));

  while( !que.empty() ){
    int x = que.front().first;
    int y = que.front().second;
    que.pop_front();

    //移動Aで行けるところ
    for (int direction = 0; direction < 4; ++direction) {
      int next_x = x + dx[direction];
      int next_y = y + dy[direction];
      if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
      if (S[next_x][next_y] == '#') continue;
      if( dist[next_x][next_y] <= dist[x][y] ) continue;
      dist[next_x][next_y] = dist[x][y];
      que.push_front(make_pair(next_x, next_y));
    }

    //移動Bで行けるところ
    for( int i = -2; i <= 2; i++ ){
      for( int j = -2; j <= 2; j++ ){
        int next_x = x + i;
        int next_y = y + j;
        if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
        if (S[next_x][next_y] == '#') continue;
        if( dist[next_x][next_y] < dist[x][y]+1 ) continue;
        dist[next_x][next_y] = dist[x][y]+1;
        que.push_back(make_pair(next_x, next_y));
      }
    }
  }

  if( dist[GH][GW] == INF ) cout << -1 << endl;
  else cout << dist[GH][GW] << endl;

}


Measured memory_bytes: 14552
import sys
import numpy as np

if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')

    @cc.export('is_ok', '(i8[:],i8[:],i8,i8)')
    def is_ok(A, F, x, k):
        tmp = 0
        for a, f in zip(A, F):
            y = a * f
            if y > x:
                tmp += a - x // f
        return tmp <= k

    cc.compile()
    sys.exit()
from my_module import is_ok

n, k = map(int, input().split())
A = np.array(input().split(), dtype="i8")
F = np.array(input().split(), dtype="i8")

A = np.sort(A)
F = np.sort(F)[::-1]

ok = 10 ** 12
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if is_ok(A, F, mid, k):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 52012
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vvi				vector< vi > 
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define loop(i,n)		for(int i=0;i<n;i++)
#define Loop(i,n)		for(int i=1;i<=n;i++)
#define sz(a)			int(a.size())
#define all(c) 			c.begin(),c.end()
#define tr(c,i) 		for(auto i = c.begin(); i != c.end(); i++)
#define present(c,x) 	(c.find(x) != c.end())
#define cpresent(c,x) 	(find(all(c),x) != c.end())
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void Gur27()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
 
int32_t main()
{
    Gur27();
    int s,w;
    cin>>s>> w;
    cout<<(w>=s?"unsafe" : "safe");
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    stack<char> st;

    REPR(i,n-1) {
        if (st.empty()) st.push(s[i]);
        else {
            if (st.top() == ')') {
                if (s[i] == '(') {
                    st.pop();
                }
                else st.push(s[i]);
            }
            else st.push(s[i]);
        }
    }

    int cntl = 0;
    int cntr = 0;

    while (!st.empty()) {
        char e = st.top(); st.pop();
        if (e == '(') cntl++;
        else cntr++;
    }
    
    REP(i,cntr) cout << '(';
    cout << s;
    REP(i,cntl) cout << ')';
    cout << endl;

    return 0;
}

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;
using P = pair<int,int>;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll cwari = b/c - (a-1)/c;
    //cout << cwari << endl;
    ll dwari = b/d - (a-1)/d;
    //cout << dwari << endl;
    ll koubai = c*d/__gcd(c,d);
    //cout << koubai << endl;
    ll kouwari = b/koubai - (a-1)/koubai;
    ll ans = b-a+1;
    ans -= cwari;
    ans -= dwari;
    ans += kouwari;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner n=new Scanner(System.in);
        int a=n.nextInt();
        int b=n.nextInt();
        int c=n.nextInt()*2;
        int x=n.nextInt();
        int y=n.nextInt();
        int sum=0;

        if(a+b>c) {
            if (x > y) {
                sum += c * y;
                if (a < c) {
                    sum += a * (x - y);
                } else {
                    sum += c * (x - y);
                }
            } else {
                sum += c * x;
                if (b < c) {
                    sum += b * (y - x);
                } else {
                    sum += c * (y - x);
                }
            }
        }else{
            sum+=a*x+b*y;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21844
def main():
    N, K = (int(i) for i in input().split())
    X = [int(i) for i in input().split()]
    ans = 10**12
    for i in range(N-K+1):
        u = X[i]
        v = X[i+K-1]
        if u*v >= 0:
            ans = min(ans, max(abs(u), abs(v)))
        else:
            u = -u
            ans = min(ans, min(u, v)*2+max(u, v))
    print(ans)


if __name__ == '__main__':
    main()


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

int main(){
  string st;
  cin>>st;
  int n=st.size();
  int flag=0,cntR=0, cntL=0;
  vector<int> ans(n);
  
  for(int i=0; i<n+1; i++){
    if(flag==0 && st[i]=='R'){
      cntR++;
      continue;
    }
    if( st[i]=='L'){
      cntL++;
      flag=1;
      continue;
    }
    if((flag==1 && st[i]=='R') || i==n){
     // if(i==n)cout<<cntR<<cntL<<endl;
      ans[i-cntL-1]=cntL/2+(cntR+1)/2;
      ans[i-cntL]=cntR+cntL-ans[i-cntL-1];
      cntR=1;
      cntL=0;
      flag=0;
      
    }
    
  }
    
    rep(i,n)
      cout<<ans[i]<<" ";
    
  
    
}

Measured memory_bytes: 1024
n = int(input())
a = map(int, input().split())
*b, = map(int, input().split())
*c, = map(int, input().split())
count = 0
tmp = -1
for i in a:
    count += b[i-1]
    if i - tmp == 1:
        count += c[i-2]
    tmp = i

print(count)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
typedef unsigned long long ll;

const int INF = 1 << 28;
int N, a[102];

void solve() {
  ll dp[102][52];
  memset(dp, 0, sizeof(dp));
  //dp[0][0] = 1;
  dp[1][ a[0] ] = 1;
  for (int i = 1; i < N-1; ++i) {
    for (int j = 0; j < 21; ++j) {
      if (dp[i][j]) {
        if (j + a[i] <= 20)
          dp[i+1][ j + a[i] ] += dp[i][j];
        if (j - a[i] >= 0)
          dp[i+1][ j - a[i] ] += dp[i][j];
      }
    }
  }
  cout << dp[N-1][ a[N-1] ] << endl;  
}

int main() {
  while (cin >> N) {
    rep (i,N) cin >> a[i];
    solve();
  }  
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <utility>
#include <queue>


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

using namespace std;
const int INF=100000000;
typedef pair<int,int> P;
#define MAXN 100
#define MAXM 100
char maze[MAXN][MAXM+1];
int N,M;
int dx[4] = {-1,0,1,0},dy[4] = {0,1,0,-1};
int d[MAXN][MAXM+1];

int bfs(int sx,int sy,int gx,int gy){
    queue<P> q;
    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            d[i][j] = INF;
        }
    }
    q.push(P(sx,sy));
    d[sx][sy] = 0;
    while(q.size()){
        P p = q.front();
        
        q.pop();
        if(p.first == gx && p.second == gy)break;
        for(int i=0;i<4;i++){
        int nx = p.first+dx[i],ny = p.second+dy[i];
        //cout << p.first << p.second << " " << nx << ny << endl;
        if(0<=nx && nx<N&&0<=ny&&ny<M&&maze[nx][ny]!= '#'&&d[nx][ny]==INF){
            q.push(P(nx,ny));
            //cout <<  d[2][2] << endl;
            //cout << nx <<" "<< ny << endl;
            d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gx][gy];
}

int main(){
    cin >> N >> M;
    rep(i,N)rep(j,M){
        cin >> maze[i][j];
    }
    int ans = 0;
    rep(i,N)rep(j,M)rep(k,N)rep(l,M){
        int pto = bfs(i,j,k,l);
        if(maze[i][j]!='#'&&maze[k][l]!='#' && pto!=INF){
            ans = max(pto,ans);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};

/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        s: String,
    }

    let v: Vec<_> = s.split('/').map(|s| s.parse::<u64>().unwrap()).collect();

    let answer = if v[0] <= 2019 && v[1] <= 4 && v[2] <= 30 {
        "Heisei"
    } else {
        "TBD"
    };

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


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

int main(void){
    int N,sum=0;
    cin>>N;
    rep(i,N){
        int l,r;
        cin>>l>>r;
        sum += r-l+1;
    }
    cout<<sum<<endl;
    return 0;
}


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

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

int a, b, c, d, f;
double e;

int main(){
  cin >> a >> b >> c >> d >> e >> f;
  P res = P(100*a, 0);
  double ma = 0.0;
  for(int i = 0; i <= 35; i++){
    for(int j = 0; j <= 20; j++){
      for(int k = 0; k <= 1600; k++){
        for(int l = 0; l <= 800; l++){
          int C = k*c;
          int D = l*d;
          int A = 100*a*i;
          int B = 100*b*j;
          int F = A + B + C + D;
          if(A+B == 0)  continue;
          double x = double(C+D) / (double)(A+B);
          double y = double(C+D) / (double) F;
          if(F <= f){
            if(C+D <= e*(a*i+b*j) && y > ma){
              res = P(F, C+D);
              ma = y;
            }
          }
          else break;
        }
      }
    }
  }

  cout << res.first << " " << res.second << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n,gcd,lcm;
	cin >> n;
	long long a;
	for(int i=0;i<n;i++){
		cin >> a;
		if(i==0){
			lcm=a;
		}
		gcd=__gcd(lcm,a);
		lcm*=a/gcd;
	}
	cout << lcm << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <queue>
#include <functional>
#include <iomanip>

using P = std::pair<double,double>;

using Node = std::pair<double,int>;

constexpr int MAX_N=1002;

constexpr double INF = 1e9*3;

P s,t;

int n;

double G[MAX_N][MAX_N];

double d[MAX_N];

double dijkstra(int S,int T){

    std::fill(d,d+n,INF);

    std::priority_queue<Node,std::vector<Node>,std::greater<Node>> que;

    que.emplace(d[S]=0.0,S);

    while(!que.empty()) {

        Node node = que.top();

        que.pop();

        if(node.first<d[node.second])
            continue;

        if(node.second==T)
            return d[T];

        for(int i=0;i<n;++i) {

            if(d[i]>d[node.second]+G[node.second][i]){

                d[i]=d[node.second]+G[node.second][i];

                que.emplace(d[i],i);
            }
        }
    }
}

P xy[MAX_N];
double r[MAX_N];

int main() {
    
    std::cin>>s.first>>s.second>>t.first>>t.second;

    std::cin>>n;

    for(int i=1;i<=n;++i)
        std::cin>>xy[i].first>>xy[i].second>>r[i];

    xy[0]=s;

    xy[n+1]=t;

    n+=2;

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

            double len = sqrt(pow(xy[i].first-xy[j].first,2)+pow(xy[i].second-xy[j].second,2))-r[i]-r[j];

            G[i][j]=(len>0)? len : 0;
        }
    }

    double ans=dijkstra(0,n-1);

    std::cout<<std::fixed<<std::setprecision(10)<<ans<<std::endl;

    return 0;
}

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

#define int long long
#define pii pair<int, int>
#define pb push_back

const int N = 1e7 + 10;
int spf[N];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    for (int i = 2; i < N; i++) {
        for (int j = i; j < N; j += i) {
            if(spf[j] == 0) {
                spf[j] = i;
            }
        }
    }
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int res = 1; 
        int p = i;
        int sp = spf[i];
        while (p > 1) {
            int ct = 0;
            while (p % sp == 0) {
                p /= sp;
                ct ++;
            }
            sp = spf[p];
            res *= (ct + 1);
        }
        ans += i * res;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 81724
HW=input().rstrip('\n').split()
H=int(HW[0])
W=int(HW[1])
if H==1 or W==1 :
    print (1)
elif H%2==1 and W%2==1 :
    print (int((H*W+1)/2))
else :
    print(int(H * W / 2))

Measured memory_bytes: 3064
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))

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

# define F first    
# define S second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}           
const int N = 2001;
bitset <N*N/2> sums;

int n, a, b;

int main() 
{
  Read_rap ();
  cin >> n >> a >> b;
  cout << (((b-a) & 1) ? "Borys" : "Alice");

  return 0;
} 










// Coded by Z..


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {

    vector<int> prime;
    prime.pb(2);
    for (int i = 3 ; i <= 1e5 + 1 ; i += 2) {
        int t = i;
        bool isPrime = true;
        for (int j=0;j<prime.size();j++) {
            if (t%prime[j] == 0) isPrime = false;
        }
        if (isPrime) prime.pb(t);
    }

    vector<int> like;
    REP(i,prime.size()) {
        int t = (prime[i]+1)/2;
        if (binary_search(ALL(prime),t)) {
            like.pb(prime[i]);
        }
    }

    vector<int> sum(1e5+5,0);
    REP(i,like.size()) {
        sum[like[i]+1]++;
    }
    for (int i=1;i<sum.size();i++) {
        sum[i] += sum[i-1];
    }

    int Q;
    cin>>Q;
    vector<int> ans(Q);
    REP(i,Q) {
        int l,r;
        cin>>l>>r;
        ans[i] = sum[r+1] - sum[l];
    }
    REP(i,Q) cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 1536
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();

    int ans = 0;
    int count = 1;
    while (count < B) {
      ans++;
      count = count - 1 + A;
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include <iostream>
#include <list>
#include <vector>
#define MOD 1000000007

using namespace std;
typedef long long ll;

int num, k;

ll Search(int n, int par, vector<list<int>>&d) {
	int a = k - 2;
	ll ans = 1;
	if (n == 1)
		a++;
	for (auto itr = d[n].begin(); itr != d[n].end(); itr++) {
		if ((*itr) != par) {
			ans *= a--;
			ans %= MOD;
			ans *= Search((*itr), n, d);
			ans %= MOD;
		}
	}
	return ans;
}


int main(void) {
	int a, b, i;
	cin >> num >> k;
	ll ans = k;
	vector<list<int>> d(num + 1);
	for (i = 0; i < num - 1; i++) {
		scanf("%d%d", &a, &b);
		d[a].push_back(b);
		d[b].push_back(a);
	}
	ans *= Search(1, 0, d);
	ans %= MOD;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 13952
public class Hello{
    
    public static void Main(){
        
        var line1 = System.Console.ReadLine();
        var line2 = System.Console.ReadLine();
        var line3 = System.Console.ReadLine();
        
        string[] array1 = line1.Split(' ');
        string[] array2 = line2.Split(' ');
        string[] array3 = line3.Split(' ');
        
        int n = int.Parse(System.Console.ReadLine());
        for(int i = 0; i < n; i++){
            var b = System.Console.ReadLine();
            for(int ary = 0; ary < 3; ary++){
                if(array1[ary] == b){
                    array1[ary] = "x";
                }
                if(array2[ary] == b){
                    array2[ary] = "x";
                }
                if(array3[ary] == b){
                    array3[ary] = "x";
                }
            }
        }
        
        string[] bingo = new string[8];
        bingo[0] = array1[0] + array1[1] + array1[2];
        bingo[1] = array2[0] + array2[1] + array2[2];
        bingo[2] = array3[0] + array3[1] + array3[2];
        bingo[3] = array1[0] + array2[0] + array3[0];
        bingo[4] = array1[1] + array2[1] + array3[1];
        bingo[5] = array1[2] + array2[2] + array3[2];
        bingo[6] = array1[0] + array2[1] + array3[2];
        bingo[7] = array1[2] + array2[1] + array3[0];
        
        var result = "No";
        for(int i = 0; i < 8; i++){
            if(bingo[i] == "xxx"){
                result = "Yes";
            }
        }
        
        System.Console.WriteLine(result);
    }
}

Measured memory_bytes: 11092
s = input()
first = s[0]
second = ""
cnt_f = 0
cnt_s = 0
for i in range(len(s)):
    if s[i] != first:
        second = s[i]
        break
for i in range(len(s)):
    if s[i] == first:
        cnt_f+=1
    if s[i] == second:
        cnt_s+=1
if cnt_f == 2 and cnt_s == 2:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		int answer = 0;
		if(k >= a) {
			answer += a;
			k -=a;
		}else {
			answer = k;
			System.out.println(answer);
			return;
		}
		if(k >= b) {
			k -=b;
		}else {
			System.out.println(answer);
			return;
		}

		answer -= k;
		System.out.println(answer);

	}
}

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

int main()
{

        char op;
        int  a,b;

        cin >> a >> op >> b;

        while( op != '?' )
        {
                switch ( op ) {
                        
                        case '+' :
                                cout << a+b << endl;
                                break;
                        case '-' :
                                cout << a-b << endl;
                                break;
                        case '*' :
                                cout << a*b << endl;
                                break;
                        case '/' :
                                cout << a/b << endl;
                                break;
                        default :
                                break;
                }

                cin >> a >> op >> b;
        }

return 0;
}



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

int main()
{
    int n,m,i,total = 0,x;
    cin >> n >> m;
    for (i = 0; i < m; i++)
    {
        cin >> x;
        total += x;
    }

    n >= total ? cout << n - total : cout << "-1";
}


Measured memory_bytes: 3632
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
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);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}
int main(){
    //std::stack<int> stack;
    int n,m;
    long k;
    cin >> n >> m >> k;
    vector<long> a(n+1,0);
    vector<long> b(m+1,0);
    
    long num;
    for(int i = 1; i <= n; i++){
        cin >> num;
        a[i] = a[i-1] + num;
    }
    for(int i = 1; i <= m; i++){
        cin >> num;
        b[i] = b[i-1] + num;
    }
    int j = m;
    int ans = 0;
    for(int i = 0; i <= n; i++){
        if(a[i] > k){
            break;
        }
        while(b[j] > k-a[i]){
            j --;
        }
        ans = max(ans, i+j);
    }
    cout << ans << endl;
    return 0;
}






Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
const int maxn = 303030;
const int mod = 1000000007;
int fat[maxn], ifat[maxn];
int mul(long long a, long long b){
  return 1ll * a * b % mod;
}
int xp(int a, int b){
  int r = 1;
  for(; b; b >>= 1, a = mul(a, a) ) if(b&1) r = mul(r, a);
  return r;
}
void init(){
  fat[0] = 1;
  for(int i = 1; i < maxn; i++) fat[i] = mul(i, fat[i - 1]);
  ifat[maxn - 1] = xp(fat[maxn - 1], mod - 2);
  for(int i = maxn - 2; i >= 0; i--) ifat[i] = mul(i + 1, ifat[i + 1]);
  for(int i = 0; i < maxn; i++) assert(mul(fat[i], ifat[i]) == 1);
}
int ncr(int n, int r){
  if(r > n) return 0;
  return mul(fat[n], mul(ifat[n - r], ifat[r]));
}
vector<int> e[maxn];
int n, x[maxn], y[maxn], deg[maxn], f[maxn];
int get(int a, int b, int c, int d){
  return ncr(c - a + d - b, c - a);
}
int main(){
  init();
  int h, w; cin >> h >> w >> n;
  for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
  x[n] = 1; y[n] = 1; n++;
  x[n] = h; y[n] = w; n++;
  vector<int> od(n,0);
  iota(od.begin(), od.end(), 0);
  sort(od.begin(), od.end(), [&](int a, int b){
    if(x[a] != x[b]) return x[a] < x[b];
    return y[a] < y[b];
  });
  for(int i = 0; i < n; i++) f[od[i]] = get(x[od[0]], y[od[0]], x[od[i]], y[od[i]]);
  for(int i = 1; i < n; i++) {
    for(int j = i + 1; j < n; j++){
      if(x[od[j]] >= x[od[i]] && y[od[j]] >= y[od[i]] && i != j){
        f[od[j]] += mod - mul(f[od[i]], get(x[od[i]], y[od[i]], x[od[j]], y[od[j]]));
        if(f[od[j]] >= mod) f[od[j]] -= mod;
      }
    }
  }
  cout << f[od[n - 1]] << endl;
  return 0;
}
  
                         

Measured memory_bytes: 12416