akhauriyash/Code-Regression huggingface dataset:
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT fixed << setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
int A[100001];
int P[100002];
int MAX;

int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i];
		P[A[i]]++;
	}

	REP(i, 0, 100000) {
		int t = P[i] + P[i + 1] + P[i + 2];
		if (t > MAX) {
			MAX = t;
		}
	}
	cout << MAX << endl;
	return 0;
}

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

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
nq = int(input())
Q = list(map(int, input().split()))
m = 2 ** n
A_s = set()
for i in range(m):
    b = list(map(int, str(bin(i))[2:].zfill(n)))
    s = 0
    for j in range(n):
        s += A[j] * b[j]
    A_s.add(s)
for q in Q:
    if q in A_s:
        print("yes")
    else:
        print("no")




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

int main(){
	int n, cnt = 0;
	set<string> s;

	cin >> n;

	for(int i=0; i<n; i++){
		string tmp;
		cin >> tmp;

		if(!s.count(tmp)){
			s.insert(tmp);
			cnt++;
		}
	}

	cout << cnt << endl;
}



Measured memory_bytes: 19252
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    ll ans=0;
    rep(i,1,n+1){
        vector<ll> v;
        ll u=i;
        //cout<<ans<<endl;
        while(u>0){
            v.push_back(u%10);
            u/=10;
        }
        ll f=v[0],g=v.back();
        if(f==0||g==0)continue;
        if(f==g)ans++;
        ll now=10*f+g;
        if(now<=n)ans++;
        else continue;
        now=100*f+g;
        if(now>n)continue;
        ll noww=now+90;
        if(n>=noww)ans+=10;
        else{
            ll uu=(n-now)/10+1;
            ans+=uu;
        }
        now=1000*f+g;
        if(now>n)continue;
        noww=now+990;
        if(n>=noww)ans+=100;
        else{
            ll uu=(n-now)/10+1;
            ans+=uu;
        }
        now=10000*f+g;
        if(now>n)continue;
        noww=now+9990;
        if(n>=noww)ans+=1000;
        else{
            ll uu=(n-now)/10+1;
            ans+=uu;
        }
        now=100000*f+g;
        if(now>n)continue;
        noww=now+99990;
        if(n>=noww)ans+=10000;
        else{
            ll uu=(n-now)/10+1;
            ans+=uu;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
 
using namespace std;
 
double EPS = 1e-10;
 
double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}
 
struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }
 
  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }
 
  point operator * (double d){
    return point(x*d,y*d);
  }
};
 
struct segment{
  point a,b;
};
 
double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}
 
double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}
 
int is_intersected_ls(point a1, point a2, point b1, point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int inside(point p, vector<point> ps){
  point a(p.x,p.y),b(1000000,p.y);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<ps.size();i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;

  int cnt1=0;
  for(int i=0;i<ps.size();i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<ps.size();i++)
    if(is_intersected_ls(ps[i],ps[(i+1)%ps.size()],a,b))cnt++;

  return (cnt-cnt1)%2;
}

int main(void){
  int n;
  point k,s,in;
  vector<point>p; 

  cin >> n;
  while(n--){
    p.clear();
    for(int i=0;i<3;i++){
      cin >> in.x >> in.y;
      p.push_back(in);
    }     

    cin >> k.x >> k.y >> s.x >> s.y;

    if(inside(k,p)!=inside(s,p))cout << "OK" << endl;
    else cout << "NG" << endl;
     
  }
 
  return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,dp[1003][1003],B[100005],C[100005],j;
char A[1003][1003];
int main()
{
           cin>>n>>m;
           for(long long i=1;i<=n;i++)
           for(long long j=1;j<=m;j++)
           cin>>A[i][j];
           dp[1][1]=1;
           for(long long i=1;i<=n;i++)
           {

                      for(long long j=1;j<=m;j++)
                      {
                                 if(A[i][j+1]=='.') dp[i][j+1]=(dp[i][j+1]+dp[i][j])%1000000007;
                                 if(A[i+1][j]=='.') dp[i+1][j]=(dp[i][j]+dp[i+1][j])%1000000007;
                      }
           }
           /*for(long long i=1;i<=n;i++)
           {
                      for(long long j=1;j<=m;j++)
                     // cout<<dp[i][j];
                     // cout<<endl;
           }*/
           cout<<dp[n][m]%1000000007;
}

Measured memory_bytes: 9600
#include <iostream>
using namespace std;
int main(void){
    int i=1;
    int x;
    cin >> x;
    while(true){
        if(x == 0){
            break;
        }
        cout << "Case" << " ";
        cout << i;
        cout << ":" << " ";
        cout << x << endl;
        cin >> x;
        i=i+1;
    }
}



Measured memory_bytes: 3056
#include<iostream>
#include<cmath>
#include<algorithm>
#include<list>
#include<sstream>
#include<string>
#include<ctime>
#include<stdio.h>

using namespace std;

long long insertionSort(int*, int, int,long long);



int main() {
	int n;
	cin >> n;
	int* a = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	long long ti = clock();
	int g[100];
	int m;
	long long cnt = 0;
	for (int i = 0;i < 100;i++) {
		g[i] = (int)floor(pow(n, (double)(99-i) / 100));
	}
	m = 100;
	for (int i = 0;i < m - 1;) {
		if (g[i] == g[i + 1]) {
			for (int j = i + 1;j < m;j++) {
				g[j - 1] = g[j];
			}
			m--;
		}
		else {
			i++;
		}
	}
	for (int i = 0;i < m;i++) {
		cnt = insertionSort(a, n, g[i], cnt);
	}
	
	cout << m << endl;
	string msg = "";
	ostringstream oss;
	for (int i = 0;i < m;i++) {
		oss << g[i];
		msg += oss.str() + " ";
		oss.str("");
		oss.clear(stringstream::goodbit);
	}
	msg = msg.substr(0, msg.length() - 1);
	cout << msg << endl;
	cout << cnt << endl;
	msg = "";
	for (int i = 0;i < n;i++) {
		oss << a[i];
		msg += oss.str() + "\n";
		oss.str("");
		oss.clear(stringstream::goodbit);
	}
	cout << msg;

	
}

long long insertionSort(int* a, int n, int g,long long cnt) {
	int work;
	for (int i = g;i < n;i++) {
		work = a[i];
		int j = i - g;
		while (j >= 0 && a[j] > work) {
			a[j + g] = a[j];
			j -= g;
			cnt++;
		}
		a[j + g] = work;
	}
	return cnt;
}


Measured memory_bytes: 23360
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    ll N;
    cin >> N;
    queue<ll> qu;
    qu.emplace(3);
    qu.emplace(5);
    qu.emplace(7);
    ll count=0;
    while(1){
        ll x=qu.front();
        if(x>N)break;
        qu.pop();
        string S=to_string(x);
        ll n=S.size();
        ll a=0,b=0,c=0;
        for(auto p: S){
            if(p=='3')a++;
            else if(p=='5')b++;
            else if(p=='7')c++;
        }
        if(a&&b&&c)count++;
        qu.emplace(x*10+3);
        qu.emplace(x*10+5);
        qu.emplace(x*10+7);
    }
    print(count);
    return 0;
}

Measured memory_bytes: 768
A, B = map(int, input().split())

# 最大公約数
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

GCD = gcd(A, B)

# 最大公約数の素因数を求める
prime_factor = []

# 素因数で可能な限り割る
def divide_by_prime_factor(GCD, p):
    if GCD%p == 0:
        prime_factor.append(p)
        while GCD%p == 0:
            GCD /= p
    return GCD, prime_factor

GCD, prime_factor = divide_by_prime_factor(GCD, 2)

for i in range(3, int(GCD**0.5)+1, 2):
    GCD, prime_factor = divide_by_prime_factor(GCD, i)

# GCDそれ自身が素数の場合を考慮。GCD==1の場合を除くことに注意
if GCD > 2:
    GCD, prime_factor = divide_by_prime_factor(GCD, GCD)

# 素因数の数+1を出力
print(len(prime_factor)+1)

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for (int i = 0; i <= A; ++i) {
    for (int j = 0; j <= B; ++j) {
      for (int k = 0; k <= C; ++k) {
        if (i * 500 + j * 100 + k * 50 == X) {
          ++ans;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef pair<ll, P> P1;

//#define int long long

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (ll i = 0; i < x; i++)
#define rep1(i, x) for (ll i = 1; i <= x; i++)
#define rrep(i, x) for (ll i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (ll i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const ll INF = 10000000000000000;
const ll M = 100000000;
const ll dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const ll dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                        {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

int main() {
    ll x, y, z, k, a[1010], b[1010], c[1010];
    scanf("%lld%lld%lld%lld", &x, &y, &z, &k);
    rep(i, x) scanf("%lld", &a[i]);
    rep(i, y) scanf("%lld", &b[i]);
    rep(i, z) scanf("%lld", &c[i]);
    ll n = x * y * z;
    // vector<ll> av, bv, cv;
    vector<ll> cv;
    // rep(i, x) av.pb(a[i]);
    // rep(i, y) bv.pb(b[i]);
    rep(i, z) cv.pb(c[i]);
    // rev(av);
    // rev(bv);
    sor(cv); //いらない

    vector<ll> ab;
    rep(i, x) rep(j, y) {
        ll s = a[i] + b[j];
        ab.pb(s);
    }
    sor(ab);
    ll abn = x * y;

    ll cis[1010];
    rep(i, z) cis[i] = abn - 1;

    rep(i, k) {
        ll mx = 0;
        ll mxi = -1;
        rep(j, z) {
            if (cis[j] < 0)
                continue;
            if (c[j] + ab[cis[j]] > mx) {
                mx = c[j] + ab[cis[j]];
                mxi = j;
            }
        }
        printf("%lld", mx);
        printf("\n");

        cis[mxi]--;
    }

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 10360
#include<stdio.h>
#include<limits.h>
int main(){
	int n, a, i;
	long max = LONG_MIN, min = LONG_MAX, sum = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d", &a);
		if(a > max){
			max = a;
		}
		if(a < min){
			min = a;
		}
		sum = sum + a;
	}
	printf("%ld %ld %ld\n", min, max, sum);
}


Measured memory_bytes: 2104
import Control.Monad

main = do
    n <- read <$> getLine
    h <- map read <$> words <$> getLine
    putStrLn $ show $ solve n h

solve :: Int -> [Int] -> Int
solve n h = doit 0 h
  where
    doit m []                = 0
    doit m (h:t) | m > h     = 0 + doit m t
                 | otherwise = 1 + doit h t


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <vector>
#include <climits>
using namespace std;

const int MX = 2097152;
const int HEAD = 1048575;
int A[MX], V[MX];
int n, q;

void init(int n) {
    int l = HEAD + n;
    for (int i=0; i<=l; ++i) {
        A[i] = (i < HEAD ? 1 : i - HEAD);
        V[i] = 0;
    }
    for (int i=l+1; i<MX; ++i) {
        A[i] = INT_MAX;
        V[i] = -INT_MAX;
    }
}

void update(int a, int v) {
    int k = HEAD + a;
    V[k] += v;
    while (k) {
        k = (k - 1) / 2;
        int l = 2*k+1, r = 2*k+2;
        if (V[l] < V[r] || (V[l] == V[r] && A[l] > A[r])) {
            V[k] = V[r];
            A[k] = A[r];
        } else {
            V[k] = V[l];
            A[k] = A[l];
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> q;
    init(n);
    int a, v;
    for (int i=0; i<q; ++i) {
        cin >> a >> v;
        update(a, v);
        cout << A[0] << " " << V[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 17580
n,m,x = map(int, input().split())
c = []
a = []
for i in range(n):
    lis = list(map(int, input().split()))
    c.append(lis[0])
    a.append(lis[1:])
#print(c)
#print(a)
ans = 10000000000000
for j in range(m):
    val = 0
    for i in range(n):
        val += a[i][j]
    #print(val)
    if val < x:
        print('-1')
        exit()
for i in range(2 ** n):
    flg = [True] * n
    for j in range(n):
        if i >> j & 1:
            flg[j] = False
    flg2 = True
    for j in range(m):
        val = 0
        for k in range(n):
            if flg[k] == False:
                continue
            val += a[k][j]
        #print(val)
        if val < x:
            flg2 = False
    if flg2 == True:
        val = 0
        for j in range(n):
            if flg[j] == True:
                val += c[j]
        ans = min(ans,val)
    #print(flg2)
print(ans)


Measured memory_bytes: 74264
// In His Name

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define gcd __gcd
#define int long long
#define err(x) cout << #x << ": " << x << endl;

using namespace std;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef map <int, int> mi;

const int MAX = 1e5 + 1;
int n, m;

main(){
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	cout << (n - 1) * (m - 1);
}

Measured memory_bytes: 256
import java.util.*

data class Spreadsheet(val rows: List<List<Int>>) {
    val col = if (rows.size != 0) rows.get(0).size else 0
    fun withTotal(): Spreadsheet {
        val newElement = mutableListOf<List<Int>>()
        val totalRow = (1..col + 1).map { 0 }.toMutableList()
        for (row in rows) {
            val newRow = row + row.sum()
            totalRow.forEachIndexed { index, e -> totalRow.set(index, e + newRow[index]) }
            newElement.add(newRow)
        }
        newElement.add(totalRow)
        return Spreadsheet(newElement)
    }

    override fun toString(): String =
        this.rows.map { it.joinToString(" ") }.joinToString("\n")
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val rows = mutableListOf<List<Int>>()
    val r = scanner.nextInt()
    val c = scanner.nextInt()
    (1..r).forEach {
        val row = mutableListOf<Int>()
        (1..c).forEach {
            row.add(scanner.nextInt())
        }
        rows.add(row)
    }
    println(Spreadsheet(rows).withTotal())
}



Measured memory_bytes: 43060
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
using namespace std;



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

	int N;
	cin >> N;
	vector<int>x(N);
	rep(i, N)cin >> x[i];
	int L, Q;
	cin >> L >> Q;
	vector<array<int, 2>>ab(Q);
	rep(i, Q)cin >> ab[i][0] >> ab[i][1];
	rep(i, Q)rep(j, 2)ab[i][j]--;


	//table[i][j]:=ホテルiから(1<<j)日以内に到達できるような最も右のホテル。
	vector<vector<int>>table(N, vector<int>(17, 0));
	rep(j, 17)table[N - 1][j] = N - 1;

	//ホテルiから1日以内に到達できる最も右のホテルを2分探索する。
	rep(i, N - 1) {
		int lb = i + 1, ub = N;//真の解は[lb,ub)の間。
		while (lb + 1 < ub) {
			const int med = (lb + ub) / 2;
			const int dist = x[med] - x[i];
			if (dist <= L)lb = med;
			else ub = med;
		}
		table[i][0] = lb;
	}

	//ホテルiから1<<j日以内に到達できる最も右のホテルを再帰的に求める。
	REP(j, 1, 17)rep(i, N - 1) {
		table[i][j] = table[table[i][j - 1]][j - 1];
	}

	rep(qq, Q) {
		int a = min(ab[qq][0], ab[qq][1]);
		int b = max(ab[qq][0], ab[qq][1]);

		int answer = 1;
		for (int i = 16; 0 <= i; i--) {
			if (table[a][i] < b) {
				a = table[a][i];
				answer += 1 << i;
			}
		}
		cout << answer << endl;
	}

}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  printf("%d\n",min(a + b, min(b + c, a + c)));
}


Measured memory_bytes: 256
n, k = map(int, input().split())
res = 0
#print()
for i in range(k + 1, n + 1):
    #print("i", i)
    res += (n // i) * (i - k)
    #print(" 1.", (n // i) * (i - k))
    res += max(n % i - k+1, 0)
    #print(" 2.", )
if k == 0:
    res -= n
print(res)



Measured memory_bytes: 39024
#include<stdio.h>
#include<stdlib.h>
#define INFTY 1000000000
#define max 500001
void merges(int*,int,int,int);
void mergesorts(int*,int,int);
int count=0;
int n;
int main(){
  int mid;
  int right;
  int left;
  int list[max];
  scanf("%d",&n);
  mid=(n-1)/2;
  left=0;
  right=n;
  int i;
  for(i=0;i<n;i++)scanf("%d",&list[i]);
  mergesorts(list,left,right);
  for(i=0;i<n;i++)printf("%d%c",list[i],((i<n-1)?' ':'\n'));
  printf("%d\n",count);
  return 0;
}
void merges(int* list,int left,int mid,int right){
  int i;
  int j;
  int k;
  int m1=mid-left;
  int m2=right-mid;
  int n1[m1+1];
  int n2[m2+1];
  for(i=0;i<m1;i++)n1[i]=list[left+i];
  for(i=0;i<m2;i++)n2[i]=list[mid+i];
  n1[m1]=INFTY;
  n2[m2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(n1[i]<=n2[j]){
      list[k]=n1[i];
      i++;
    }
    else{
      list[k]=n2[j];
      j++;
    }
    count++;
  }
}
void mergesorts(int *list,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergesorts(list,left,mid);
mergesorts(list,mid,right);
merges(list,left,mid,right);
}
}



Measured memory_bytes: 5628
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner read=new Scanner(System.in);
        int num=read.nextInt();
        int count=0;
        int i;
        for(i=1; i<num; i++){
            int a=read.nextInt();

            if (a==i){
                count++;
            i++;
            a=read.nextInt();

            }

        }
        if(i!=num+1) {
            int last = read.nextInt();
            if (last == num) {
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 48084
#include<stdio.h>

int n,A[50];

int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(void){
    
    int q,M,i;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        
        scanf("%d",&M);
        if(solve(0,M))printf("yes\n");
        else printf("no\n");
    }
    
    return 0;
}



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

int main(){
  int n;
  double a[101];
  double df = 1e9;
  double avg = 0;
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> a[i];
    avg += a[i];
  }
  avg /= n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (abs(a[i] - avg) < df) {
      df = abs(a[i] - avg);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef struct P
{
    int x,y;
    bool operator== (const P& right)
    {
        if(x == right.x && y == right.y)
            return true;
        return false;
    }
}P;
typedef struct
{
    P f,s;
}PS;

int main() {
    int all;
    cin >> all;
    for(int i = 0; i < all; i++)
    {
        P goal;
        cin >> goal.x >> goal.y;
        int area[goal.x + 1][goal.y + 1];
        for(int i = 0; i < goal.x +1;i++)
            for(int j = 0; j < goal.y + 1; j++)
                area[i][j] = 0;
        int stop;
        cin >> stop;
        PS ps[stop];
        for(int i = 0; i < stop; i++)
        {
            cin >> ps[i].f.x >> ps[i].f.y >> ps[i].s.x >> ps[i].s.y;
        }
        
        area[0][0] = 1;
        for(int i = 0; i < goal.x + 1; i++)
        {
            for(int j = 0; j < goal.y + 1; j++)
            {
                for(int k = 0; k < stop; k++)
                {
                    if(ps[k].s == P{i,j})
                    {
                        if(j > 0 && ps[k].f == P{i,j-1})
                            area[i][j] -= area[i][j-1];
                        if(i > 0 && ps[k].f == P{i-1,j})
                            area[i][j] -= area[i-1][j];
                    }
                    if(ps[k].f == P{i,j})
                    {
                        if(j > 0 && ps[k].s == P{i,j-1})
                            area[i][j] -= area[i][j-1];
                        if(i > 0 && ps[k].s == P{i-1,j})
                            area[i][j] -= area[i-1][j];
                    }
                }
                if(i > 0)
                {
                    area[i][j] += area[i-1][j];
                    if(j > 0)
                        area[i][j] += area[i][j-1];
                }
                else if(j > 0)
                    area[i][j] += area[i][j-1];
            }
        }
        if(area[goal.x][goal.y] == 0)
            cout << "Miserable Hokusai!" << endl;
        else
            cout << area[goal.x][goal.y] << endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 2984
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 tall = 0;
        for (int i = 1; i <= b - a; i++) {
            tall += i;
        }
        System.out.println(tall - b);
    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
//#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
 
 
int main(){
   int n;
   cin>>n;
   string s,ans;
   ans="Yes";
   cin>>s;
   if(n%2==0){
       for(int i=0;i<(n/2);i++){
           if(!(s.at(i)==s.at((n/2)+i)))ans="No";
       }
   }else ans="No";
   cout<<ans<<endl;
  
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Omar Yasser
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(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, Scanner sc, PrintWriter out) {
            String s = sc.next() + sc.next() + sc.next();
            if (Integer.parseInt(s) % 4 == 0) out.println("YES");
            else out.println("NO");
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

        public Scanner(FileReader f) {
            br = new BufferedReader(f);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int min(int a ,int b){
    if(a>b){
        return(b);
    }else{
        return(a);
    }
}
int max(int a ,int b){
    if(a<b){
        return(b);
    }else{
        return(a);
    }
}
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<a+b+c-max(a,max(b,c))<<endl;
    return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int N, C;
    cin >> N >> C;
    vector<map<int, int> > m(3);
    vector<vector<int> > D(C, vector<int>(C));
    vector<vector<int> > c(N, vector<int>(N));
    for (int i = 0; i < C; i++) {
        for (int j = 0; j < C; j++) {
            cin >> D[i][j];
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            int r = (i + j) % 3;
            int color = c[i][j];
            if (m[r].count(color) == 0) {
                m[r][color] = 1;
            } else {
                m[r][color] += 1;
            }
        }
    }

    int minCost = INT_MAX;
    for (int x = 1; x <= C; x++) {
        for (int y = 1; y <= C; y++) {
            for (int z = 1; z <= C; z++) {
                int cost = 0;
                if (x == y || y == z || z == x) {
                    continue;
                }
                for (auto& m1: m[0]) {
                    if (m1.first != x) {
                        cost += m1.second * D[m1.first-1][x-1];
                    }
                }
                for (auto& m2: m[1]) {
                    if (m2.first != y) {
                        cost += m2.second * D[m2.first-1][y-1];
                    }
                }
                for (auto& m3: m[2]) {
                    if (m3.first != z) {
                        cost += m3.second * D[m3.first-1][z-1];
                    }
                }
                minCost = min(cost, minCost);
            }
        }
    }
    cout << minCost << endl;
    return 0;
}


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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, D, X;
    int A[100];

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

    int a;
    int sum = 0;
    for(int i = 0; i < N; ++i){
        a = A[i];
        for(int j = 0; j < D; ++j){
            if( j * a + 1 > D ){
                break;
            }
            ++sum;
        }
    }
        
    cout << sum + X << endl;

    return 0;
}


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

using namespace std;

const int MAXN = 5005, MAXE = MAXN * 10;
int head[MAXN], nxt[MAXE], to[MAXE], cost[MAXE], cntEdges;

void init(int n) {
    memset(head, -1, sizeof head);
    cntEdges = 0;
}

void addEdge(int f, int t, int c) {
    to[cntEdges] = t;
    cost[cntEdges] = c;
    nxt[cntEdges] = head[f];
    head[f] = cntEdges++;
}

int n, m;
long long dis[MAXN];

int inQ[MAXN], vid = 0;
int Q[MAXN], qf, qe, qs;
bool bellman(int src) {
    memset(dis, 0x3f, sizeof(dis[0]) * n);
    dis[src] = 0;
    qf = qe = -1;
    inQ[src] = ++vid;
    qs = 0;
    Q[qs++, qe = (++qe % MAXN)] = src;
    int cnt = 0;
    for (int i = 0; i < 3 * n; ++i) {
        int s = qs;
        while (s--) {
            int node = Q[qs--, qf = (++qf % MAXN)];
            inQ[node] = 0;
            for (int k = head[node]; k != -1; k = nxt[k]) {
                int j = to[k];
                int c = cost[k];
                if (dis[j] > dis[node] + c) {
                    dis[j] = dis[node] + c;
                    cnt += (j == n - 1);
                    if (inQ[j] != vid)
                        Q[qs++, qe = (++qe % MAXN)] = j, inQ[j] = vid;
                }
            }
        }

        if (!qs)
            return true;
    }
    return cnt == 1;
}

int main(){
    int p;
    scanf("%d %d %d", &n, &m, &p);
    init(n);
    for(int i=0; i<m; i++){
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        --a, --b;
        addEdge(a, b, - c + p);
    }
    bool b = bellman(0);
    if(!b) {
        puts("-1");
    }else{
        printf("%lld\n", max(0ll, -dis[n-1]));
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <set>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;

bool kaibun(int n){
	int a[5],i=0;
	while (n){
		a[i++] = n%10;
		n /= 10;
	}
	return a[0]==a[4]&&a[1]==a[3];
}

int main(){
	int a,b,temp=0;
	cin >> a >> b;
	for (int i=a;i<=b;i++)
		temp+=kaibun(i);

	cout << temp << endl;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<ctime>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define is insert
#define es erase
#define pii pair<int,int>
#define ms(f,x) memset(f,x,sizeof f)
#define mc(f,x) memcpy(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
const int N=1e6+11;
int n,a,b,ans;
char s[N];
int cnt[N];
int main(){
	scanf("%d",&n);
	ans=n;
	scanf("%s",s+1);
	_rep(i,n,1)
		cnt[i]=cnt[i+1]+(s[i]=='R');
	rep(i,0,n){
		if(s[i]=='W')++a;
		ans=min(ans,a+cnt[i+1]-min(a,cnt[i+1]));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4796
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static String ans;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while(true) {

			int n = sc.nextInt();

			if(n==0) {
				break;
			}
			ans ="";
			int[] keys = new int[n];
			for(int i = 0; i < n; i++) {
				keys[i] = sc.nextInt();
				if(keys[i] > 26) {
					keys[i] = (52- keys[i])*-1;
				}
			}
			String stations = sc.next();
			for(int i = 0; i < stations.length(); i++) {
				int stationNum = (int)stations.charAt(i) - keys[i%keys.length];
				Character thisChar = stations.charAt(i);

				if(Character.isUpperCase(thisChar)) {
					if(stationNum < 65) {
						int tmp = 65- stationNum;
						stationNum = 123 - tmp;
					}else if(stationNum > 90) {
						int tmp = stationNum - 90;
						stationNum = 96 + tmp;
					}
				}else {
					if(stationNum < 97) {
						int tmp = 97 -stationNum;
						stationNum = 91 - tmp;
					}else if(stationNum > 122) {
						int tmp = stationNum - 122;
						stationNum = 64 + tmp;
					}
				}
				ans += (char)stationNum;
			}
			System.out.println(ans);
		}
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}
}



Measured memory_bytes: 36132
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())

    def main(N):
        i = 1
        ans = 0

        while True:
            ans += i
            if ans >= N:
                print(i)
                if N - i != 0:
                    if N-i<i:
                        print(N - i)
                        return True
                    else:
                        main(N-i)
                        return True
                else:
                    return True
            else:
                i += 1

    main(N)


resolve()

Measured memory_bytes: 44784
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
int main (void)
{
    ll shuzu[12];
    ll r,d;
    ll tmpp;
    ios::sync_with_stdio(0);
    cin>>r>>d>>tmpp;
    shuzu[0]=tmpp;
    for(int i=1;i<11;i++)
    {
        shuzu[i]=r*shuzu[i-1]-d;
        cout<<shuzu[i]<<endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    ans += tmp - 1;
  }
  cout << ans << 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 = sc.nextInt();
            Set<String> set1 = new HashSet<>();
            for(int i = 0; i < N; i++){
              set1.add(sc.next());
            }
            int ans = set1.size();
            if(ans == 3){
              System.out.println("Three");
            } else {
              System.out.println("Four");
            }
          }
}

Measured memory_bytes: 21844
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
H = list(map(int, readline().split()))
good = [True] * N
for i in range(M):
    a, b = [int(x) - 1 for x in readline().split()]
    if H[a] <= H[b]:
        good[a] = False
    if H[a] >= H[b]:
        good[b] = False


def solve():
    return sum(good)


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 85256
#define M 26
P[M],A[M],B[M];
int R(a){return P[a]==a?a:(P[a]=R(P[a]));}
char s[99];main(k,l,x,y){for(;scanf("%d",&l),l;puts(k<M?"NG":"OK")){
	for(k=0;k<M;k++)A[k]=B[k]=0,P[k]=k;
	for(k=0;k<l;k++)scanf("%s",s),x=*s-97,y=s[strlen(s)-1]-97,A[x]++,B[y]++,P[R(x)]=R(y);
	for(k=0;k<M;k++){if(A[k]-B[k]||((A[k])&&R(*s-97)!=R(k)))break;}
}exit(0);}

Measured memory_bytes: 584
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        x: i64,
    };
    let mut c = vec![];
    let mut a = vec![];
    for _ in 0..n {
        input! {
            c_i: i64,
            a_i: [i64; m],
        };
        c.push(c_i);
        a.push(a_i);
    }
    let inf = 1_000_000_000_000_i64;
    let mut ans = inf;
    for bits in 0..2_usize.pow(n as u32) {
        let mut sa = vec![0_i64; m];
        let mut sc = 0;
        for i in 0..n {
            if (bits >> i) & 1 == 1 {
                sc += c[i];
                for (j, &a_ij) in a[i].iter().enumerate() {
                    sa[j] += a_ij;
                }
            }
        }

        if sa.iter().filter(|&&sa_ij| sa_ij >= x).count() == m {
            ans = std::cmp::min(ans, sc);
        }
    }
    println!("{}", if ans == inf { -1 } else { ans });
}


Measured memory_bytes: 2196
#include <iostream>
#include <cassert>
//#define NDEBUG
int main(void){
	using namespace std;
	static const int INPUT_A_MAX = 10000;
	static const int INPUT_B_MAX = 10000;
	static const int INPUT_C_MAX = 10000;
	static const int INPUT_A_MIN = 0;
	static const int INPUT_B_MIN = 0;
	static const int INPUT_C_MIN = 0;
	int input_a = 0;
	int input_b = 0;
	int input_c = 0;
	int cnt = 0;

	/* 値を3つ入力 */
	cin >> input_a;
	cin >> input_b;
	cin >> input_c;

	/* 入力値の前提条件 */
	assert (INPUT_A_MIN <= input_a && input_a <= INPUT_A_MAX); 
	assert (INPUT_B_MIN <= input_b && input_b <= INPUT_B_MAX);
	assert (INPUT_C_MIN <= input_c && input_c <= INPUT_C_MAX);
	assert (input_a <= input_b);

	/* 割り切れる数をカウント */
	for(int i = input_a; i <= input_b; i++){
		if(input_c % i == 0){
			cnt++;
		}
	}
        /* 個数を出力 */
	cout << cnt << endl;
	return 0;
}




Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    int ans = x;
    for (int i = 0, a; i < n; i++) {
        cin >> a;
        for (int i = 1; i <= d; i += a) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main()
{
	string s, t;
	cin >> s >> t;
	int c = 0;
	for (int i = 0; i < 3; i++)
	{
		if(s[i] == t[i])
			c++;
	}
	cout << c;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;


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

	int d;
	set<int> ds;
	for(int i=0;i<n;i++){
		cin >> d;
		ds.insert(d);
	}
	cout << ds.size() << "\n";

	return 0;
}

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

int main(){
  int x,s,m,M,h,a=60;
  cin >> x;
  m=x/a;
  h=m/a;
  M=m%a;
  s=x%a;
  cout << h << ":" << M << ":" << s << endl;
  return 0;
}



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

int main(){
  int a;
  cin >> a;
  vector<int> seq;
  int ans = 0;
  bool flag = true;
  int b;
  int i = 0;
  while(flag){
    if (i == 0) b = a;
    else if (seq.at(i - 1) % 2 == 0) b = seq.at(i - 1) / 2;
    else b = 3 * seq.at(i - 1) + 1;
    seq.push_back(b);
    rep(j, i){
      if (seq.at(i) == seq.at(j)){
        ans = i + 1;
        flag = false;
      }
    }
    i++;
  }
  cout << ans << endl;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

struct Edge{
    int to;
    int cost;
};
vector<Edge> ga[100000], gb[100000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s; --t;
    for(int i = 0; i < m; ++i){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        --u; --v;
        ga[u].push_back({v, a});
        ga[v].push_back({u, a});
        gb[u].push_back({v, b});
        gb[v].push_back({u, b});
    }

    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> que;
    vector<ll> da(n, LLINF);
    da[s] = 0;
    que.push({ll(0), s});
    
    while(!que.empty()){
        ll c = que.top().first;
        int v = que.top().second;
        que.pop();
        
        for(auto && e : ga[v]){
            if(da[e.to] > c + e.cost){
                da[e.to] = c + e.cost;
                que.push({da[e.to], e.to});
            }
        }
    }
    
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> que2;
    vector<ll> db(n, LLINF);
    db[t] = 0;
    que2.push({ll(0), t});
    
    while(!que2.empty()){
        ll c = que2.top().first;
        int v = que2.top().second;
        que2.pop();
        
        for(auto && e : gb[v]){
            if(db[e.to] > c + e.cost){
                db[e.to] = c + e.cost;
                que2.push({db[e.to], e.to});
            }
        }
    }
    
    vector<ll> ans(n, 1'000'000'000'000'000);
    ll cost = LLINF;
    for(int i = n - 1; i >= 0; --i){
        cost = min(cost, da[i] + db[i]);
        ans[i] -= cost;
    }
    for(int i = 0; i < n; ++i){
        cout << ans[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 17396
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var buffer = Console.ReadLine().Split();
            var D = float.Parse(buffer[0]);
            var T = float.Parse(buffer[1]);
            var S = float.Parse(buffer[2]);

            if (D / S <= T)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 27480
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin>>n>>s;
  string res;
  res = s;
  for(char c = 'A'; c <= 'Z'; ++c){
    for(int i = 0; i < s.size(); ++i){
      if(s[i] == c){
	if(c + n > 90){
	  res[i] = (c + n) - 26;
	}
	else{
	  res[i] = (c + n);
	}
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[100];
int main()
{
	string s, t;
	cin >> s >> t;
	int r = 0;
	if (s.size() > t.size())r = 1;
	else if (s.size() < t.size())r = -1;
	else if (s > t)r = 1;
	else if (s < t)r = -1;
	printf((r == -1) ? "LESS\n" : (r == 0) ? "EQUAL\n" : "GREATER\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>
#include <regex>
#include <locale>
#include <fstream>
#include <stdlib.h>
#include <cctype>

//#include <map>

using namespace std;

int main()
{
	double a, b, c;
	double deg, rad;
	double S, L, h;
	double ad;

	cin >> a >> b >> deg;

	rad = deg / 180.0 * M_PI;
	ad = a - (b * cos(rad));
	h = b * sin(rad);
	c = sqrt(ad * ad + h * h);
	S = a * h / 2;
	L = a + b + c;

	cout << fixed << setprecision(8) << S << endl;
	cout << fixed << setprecision(8) << L << endl;
	cout << fixed << setprecision(8) << h << endl;

	return 0;
}

Measured memory_bytes: 3676