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


using namespace std;
int main()
{
int c;
cin>>c;
double a[c],b[c],d[c];
for(int i=0;i<c;i++){
    cin>>a[i];
}
for(int i=0;i<c;i++){
    cin>>b[i];
    d[i]=fabs(a[i]-b[i]);
    
}

    double s=0.0;
   
    for(int i=0;i<c;i++){
        s+=d[i];
    }
    printf("%f",s);
    cout<<endl;
    s=0.0;
   
    for(int i=0;i<c;i++){
        s+=pow(d[i],2);
       
    }
    printf("%f",pow(s,0.5));
    cout<<endl;
    s=0.0;
    for(int i=0;i<c;i++){
        s+=pow(d[i],3);
       
    }
    printf("%f",pow(s,0.3333333333333));
    cout<<endl;

double m=0;
for(int i=0;i<c;i++){
    
    if(d[i]>m){
        m=d[i];
    }
}
printf("%f",m);
cout<<endl;
}


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

using namespace std;
const long long mod=1e9+7;

int main()
{
    int h,w;
    cin>>h>>w;

    vector<string>str(h+1);
    vector<vector<long long> >dp(h+1,vector<long long>(w+1));

    for(int i=0;i<h;i++){
        cin>>str[i];
    }
    dp[0][0]=1;

    for(int i=1;i<w;i++) {
        if(str[0][i]=='.') dp[0][i]=dp[0][i-1];
        else dp[0][i]=0;

    }
    for(int j=1;j<h;j++){
        if(str[j][0]=='.') dp[j][0]=dp[j-1][0];
        else dp[j][0]=0;
    }

    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(str[i][j]=='.') dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
            else dp[i][j]=0;

        }
    }
    /*for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout <<dp[i][j]<< ' ';
        }
        cout <<endl;
    }*/

    cout <<dp[h-1][w-1]<<endl;

    return 0;
}





Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

const int MOD = 1000000007;

ll modpow(ll x, ll y){
    if(y == 0) return 1;
    ll xx = modpow(x, y/2);
    xx *= xx;
    xx %= MOD;
    return y&1 ? xx*x%MOD : xx;
}

ll fact[1001], inv_fact[1001];

ll comb(int a, int b){
    if(a < b) return 0;
    return fact[a] * inv_fact[b] % MOD * inv_fact[a-b] % MOD;
}

int h,w;

int main(){
    char g[100][100];
    while(cin >> h >> w){
        rep(i,h) cin >> g[i];
        bool ok = true;
        rep(i,h)rep(j,w){
            if(g[i][j] != '#') continue;
            if(i != 0 || j != 0){
                int cnt = 0;
                if(i != 0){
                    cnt += g[i-1][j] == '#';
                }
                if(j != 0){
                    cnt += g[i][j-1] == '#';
                }
                if(cnt != 1){
                    ok = false;
                }
            }
            if(i != h-1 || j != w-1){
                int cnt = 0;
                if(i != h-1){
                    cnt += g[i+1][j] == '#';
                }
                if(j != w-1){
                    cnt += g[i][j+1] == '#';
                }
                if(cnt != 1){
                    ok = false;
                }
            }
        }

        cout << (ok ? "Possible" : "Impossible") << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

typedef long long ll;
const ll infl = 1LL << 60;

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

    ll ans = 0;
    if (b < a * 2)
    {
        cout << b / 2 << endl;
        return 0;
    }

    b -= a * 2;
    ans += a;
    ans += b / 4;
    cout << ans << endl;
}

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

const int INF = 1e9;
string A;
int N;

int next(int i, char c) {
  int pos = A.find(c, i);
  return ( (i < N && pos != string::npos) ? pos : N );
}

int main() {
  cin >> A;
  N = A.length();
  vector<int> dp(N + 2, INF);
  dp[N] = 1; dp[N + 1] = 0;
  for (int i = N; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) {
      int k = next(i, 'a' + j) + 1;
      dp[i] = min(dp[i], dp[k] + 1);
    }
  }
  string ans;
  int cur = 0;
  while (cur < N + 1) {
    for (int j = 0; j < 26; ++j) {
      int k = next(cur, 'a' + j) + 1;
      if (dp[cur] == dp[k] + 1) {
        cur = k;
        ans += (cur == N + 1) ? static_cast<char>('a' + j) : A[cur - 1];
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



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

int a[100009], p[100009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (n % 3) {
		for (int i = 0; i < n; i++)
			if (a[i] != 0) {
				cout << "No" << '\n';
				return 0;
			}
		cout << "Yes" << '\n';
		return 0;
	}
	sort(a, a + n);
	for (int i = 0; i < n / 3; i++) {
		p[i * 3] = a[i]; p[i * 3 + 1] = a[i + n / 3]; p[i * 3 + 2] = a[i + n / 3 * 2];
	}
	for (int i = 0; i < n; i++) {
		if ((p[i] ^ p[(i + 1) % n]) != p[(i + 2) % n]) {
			cout << "No" << '\n';
			return 0;
		}
	}
	cout << "Yes" << '\n';
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int x,a,b;
	cin >> x >> a >> b;
	if(abs(a - x) < abs (b - x)) cout << "A" << endl;
	else cout << "B" << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    int ans = 0;
    if(S[0] == '1') ans++;
    if(S[1] == '1') ans++;
    if(S[2] == '1') ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N; cin >> N;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int a; cin >> a;
        if (a % 2 == 0) ans++;
    }
    double sum = pow(3, N) - pow(2, ans);
    printf("%d\n", (int)sum);
}


Measured memory_bytes: 4128
using System;


class AOJ
{

    public static void Main(){
        int[] height = new int[10];

        for (int i = 0; i < 10; i++ )
            height[i] =int.Parse( Console.ReadLine());

        Array.Sort(height);
        Array.Reverse(height);

        for (int j = 0; j < 3; j++)
        {
            Console.WriteLine(height[j]); 
        }
        
    }
}

Measured memory_bytes: 5748
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
  static void Main(string[] args)
  {
    var num1 = int.Parse(Console.ReadLine());
    long numSum = 0;
    for(int i = 1; i <= num1; i++)
    {
      if (i % 3 == 0 || i % 5 == 0)
      {
        continue;
      }
      numSum += i;
    }

    Console.Write(numSum);
  }
}

Measured memory_bytes: 27480
l,r = gets.chomp.split(" ").map(&:to_i)

if r - l >= 2019 then
  puts 0
  exit 0
end

min = 2018
(l..r-1).each do |i|
  (i+1..r).each do |j|
    mod = (i * j) % 2019
    min = mod if mod < min
  end
end

puts min


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;
const int MAX = 10000000;

int g[MAX+1];

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

    for (int i = 1; i <= MAX; i++) {
        g[i] = 1;
    }

    for (int i = 2; i <= MAX; i++) {
        for (int j = i; j <= MAX; j+=i) {
            g[j]++;
        }
    }

    lint res = 0;

    for (int i = 1; i <= n; i++) {
        res += (lint)i * g[i];
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 42692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll K =21;
const ll N =2100000;
const ll mod =1e9+7;
ll dp[N],dp2[N],k,n;
ll v[K][K],cnt[N];

int main()
{
    ios_base::sync_with_stdio(false);

	cin>>k;n=pow(2LL,k);
	forn(i,k)forn(j,k)cin>>v[i][j];
	clr(cnt);forn(i,N){ll x=i;ll t=0;while(x){t+=x%2;x/=2;}cnt[i]=t;}



	clr(dp);clr(dp2);dp[0]=1;
	forn(j,k)
	{
		forn(i,n)
		{
			if(cnt[i]!=j+1)continue;
			forn(x,k)
			{
				if(v[j][x]==0)continue;
				ll t = 1<<x&i;
				if(t!=0 )dp2[i]+=dp[i^(1<<x)];
			}
			dp2[i]%=mod;
		}
		forn(i,n){dp[i]=dp2[i];dp2[i]=0;}
		//forn(i,n)cout<<dp[i]<<" ";cout<<endl;
	}
	cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 49536
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  bool b = true;
  cin >> S;
  for (int i = 0; i < (S.size() - 1); i++) {
    for (int j = i + 1; j < S.size(); j++) {
      if (S.at(i) == S.at(j)) {
        b = false;
      }
    }
  }
  if (b) {cout << "yes" << endl;}
  else {cout << "no" << endl;}
}

Measured memory_bytes: 3596
package main

import "fmt"

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)

	cs := make([]int, n)
	as := make([][]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&cs[i])
		as[i] = make([]int, m)
		for j := 0; j < m; j++ {
			fmt.Scan(&as[i][j])
		}
	}

	ans := int(1e18)
	for bit := 0; bit < (1 << n); bit++ {
		cost := 0
		mx := make([]int, m)
		for i := 0; i < n; i++ {
			if bit&(1<<uint(i)) > 0 {
				for j := 0; j < m; j++ {
					mx[j] += as[i][j]
				}
				cost += cs[i]
			}
		}
		ok := true
		for j := 0; j < m; j++ {
			if mx[j] < x {
				ok = false
			}
		}
		if ok {
			ans = min(ans, cost)
		}
	}

	if ans == 1e18 {
		ans = -1
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 2220
import java.util.*;
import java.util.Scanner;
import java.util.stream.Collectors;
import static java.lang.Character.toLowerCase;


public class Main {

    // input
    static String s;
    
    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){

        String s1 = s.substring(0,2);
        String s2 = s.substring(2,4);
        String ans = "NA";

        ArrayList<String> mm = new ArrayList<String>(
            Arrays.asList("01","02","03","04","05","06","07","08","09","10","11","12")
        );

        boolean b1 = mm.contains(s1);
        boolean b2 = mm.contains(s2);

        if (b1 && b2) ans = "AMBIGUOUS";
        if (b1 && !b2) ans = "MMYY";
        if ( !b1 && b2) ans = "YYMM";

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
}


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

static const int MAX = 200000;

int main() {
  ll n;
  cin >> n;
  ll ans = 1e18;
  for(ll i=1; i*i<=n; i++) {
    if(n%i != 0) continue;
    ans = min(i+n/i-2, ans);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3588
#include<iostream>
#include<utility>
#include<cmath>

using namespace std;

int main(){
    int a, b, c, n;
    cin >> a >> b >> c >> n;
    if(a < b) swap(a, b);
    if(a < c) swap(a, c);
    cout << a * pow(2, n) + b + c << endl;
    return 0;
}

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

int main() {
	string a, b, c;

	int n, count;
	cin >> n;
	cin >> a;
	cin >> b;
	cin >> c;
	count = 0;

	for (int i = 0; i < n; i++) {
		if (a[i] == b[i] && a[i] != c[i]) {
			count++;
		}
		else if (a[i] != b[i] && a[i] == c[i]) {
			count++;
		}
		else if (a[i] != b[i] && b[i] == c[i]) {
			count++;
		}
		else if (a[i] != b[i] && a[i] != c[i]) {
			count += 2;
		}
		else {
		}
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 256
def main():
	N, K = map(int, input().split())
	D = list(map(int, input().split()))
	rec = 0
	rec2 = 1
	for d in D:
		if rec != d:
			break
		rec += 1
	for d in D:
		if rec2 != d:
			break
		rec2 += 1

	strN = str(N)
	carry = False
	ans = ""
	for i in range(len(strN)-1, -1, -1):
		cur = int(strN[i])
		chanegd = False
		if carry:
			cur += 1
			carry = False
			chanegd = True
			if cur == 10:
				carry = True
		while cur in D:
			cur += 1
			chanegd = True
			if cur == 10:
				cur = 0
				carry = True
		if carry:
			ans = str(rec)*(len(strN)-i)
		else:
			if chanegd:
				ans = str(rec)*(len(strN)-i-1)
			ans = str(cur)+ans
	if carry:
		ans = str(rec)*(len(strN))
		if rec == 0:
			ans = str(rec2) + ans
		else:
			ans = str(rec) + ans

	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long mask, mod = 1e9+7;
int n;
long long count(vector<vector<long long> > &dp,int msk, int p, vector<vector<bool> > &v){
    if(msk == mask){
      //  cout<<"dddddd "<<endl;
        return 1;
    }
    if(p==n)
        return 0;
    if(dp[msk][p] != -1)
        return dp[msk][p];
    long long ans=0;
    for(int a=0; a<n; a++){

        long long tt = (msk & (1<<a));
       // cout<<p<<" "<<tt<<endl;
        if(tt==0 && v[a][p]){
       //     cout<<"sdfsd "<<endl;
            ans += count(dp,(msk|(1<<a)),p+1,v);
        }
    }
    ans = ans%mod;
    dp[msk][p] = ans;
    return ans;
}

int main()
{
   cin>>n;
   std::vector<vector<bool> > v(n+1, std::vector<bool> (n+1,false));
   for(int a=0; a<n; a++){
    for(int b= 0; b<n; b++){
        int tt;
        cin>>tt;
        if(tt)
            v[a][b] = true;
    }
   }
   mask = (1<<n)-1;

   std::vector<vector<long long> > dp(mask+2, vector<long long> (n+2, -1));
   long long ans = count(dp,0,0,v);
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 442624
#include<stdio.h>

int main(){
    int K,N,i,max,length;
    scanf("%d %d",&K,&N);
    int A[N];
    for(i=0;i<N;++i){
        scanf("%d ",&A[i]);
    }
    max=A[0]+K-A[N-1];//An~A1までの距離
    for(i=0;i<N-1;++i){
        length=A[i+1]-A[i];
        if(length>max){max=length;}
    }
    printf("%d\n",K-max);
    return 0;
}

Measured memory_bytes: 896
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  // cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int n, m, x;
  cin >> n >> m >> x;
  vecint c(n);
  vec2int a(n, vecint(m, 0));
  REP(i, n) {
    cin >> c[i];
    REP(j, m) { cin >> a[i][j]; }
  }
  int ans = 1e9;
  REP(bit, 1 << n) {
    vector<bool> book(n, false);
    int cost = 0;
    REP(i, n) {
      if (bit >> i & 1) {
        book[i] = true;
        cost += c[i];
      }
    }
    vecint und(m, 0);
    REP(i, n) {
      if (!book[i]) continue;
      REP(j, m) { und[j] += a[i][j]; }
    }
    bool ok = true;
    REP(i, m) {
      if (und[i] < x) {
        ok = false;
      }
    }
    if (ok) {
      ans = min(ans, cost);
    }
  }
  if (ans != 1e9) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 3644
#include<iostream>
#include<math.h>
using namespace std;

int main(){
	double x[2];
	double y[2];
	double r[2];
	double dist;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x[0] >> y[0] >> r[0] >> x[1] >> y[1] >> r[1];
		dist = hypot(x[0] - x[1], y[0] - y[1]);
		if(r[0] > dist + r[1]){
			printf("2\n");
		}else if(r[1] > dist + r[0]){
			printf("-2\n");
		}else if(r[0] + r[1] < dist){
			printf("0\n");
		}else{
			printf("1\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i=0;i<n;i++) a[i] = in.nextInt();
		for(int i=0;i<n;i++) b[i] = in.nextInt();
		List<Integer> enough = new ArrayList<>();
		List<Integer> shortage = new ArrayList<>();
		long shortage_sum = 0;
		for(int i=0;i<n;i++) {
			if(a[i]-b[i]>0) enough.add(a[i]-b[i]);
			else if(a[i]-b[i]<0) {
				shortage.add(a[i]-b[i]);
				shortage_sum += -a[i]+b[i];
			}
		}
		if(shortage_sum==0) System.out.println(0);
		else {
			enough.sort((x,y)->-x+y);
			int i=0;
			for(;i<enough.size();i++) {
				shortage_sum -= enough.get(i);
				if(shortage_sum<=0) break;
			}
			if(i==enough.size()) System.out.println(-1);
			else System.out.println(shortage.size()+i+1);
		}
		
		in.close();

	}

}


Measured memory_bytes: 85644
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int>v(200,0);

int main() {
	int n;
	cin >> n;
	REP(i, 0, n) {
		int tmp;
		cin >> tmp;
		v[tmp]++;
	}
	int ans = 0;
	REP(i, 0, v.size()) {
		if (v[i] > 0)ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
#define ll getchar();getchar();return 0;
using namespace std;
signed main() {
	int x;
	cin >> x;
	if (x % 11 > 6)cout << x / 11*2 + 2 << endl;
	else if (x % 11 == 0)cout << x / 11*2 << endl;
	else cout << x / 11*2 + 1 << endl;
	ll
}

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

namespace OthloKyopro
{
    class Program
    {
        static void Main(string[] args)
        {


            /*3*/
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray()[0];
            var mod = (35 +input - 9) % 7;
            switch (mod)
            {
                case 0:
                    Console.WriteLine("sat");
                    break;
                case 1:
                    Console.WriteLine("sun");
                    break;
                case 2:
                    Console.WriteLine("mon");
                    break;
                case 3:
                    Console.WriteLine("tue");
                    break;
                case 4:
                    Console.WriteLine("wed");
                    break;
                case 5:
                    Console.WriteLine("thu");
                    break;
                default:
                    Console.WriteLine("fri");
                    break;
            }
        }
    }
}

Measured memory_bytes: 9432
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n, k; cin >> n >> k;
	while(1){
		if(n == 0) break;
		n /= k;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Ord
import Data.Maybe

main = interact $ unlines . show' . rank_checker . read' . lines
 where
  read' xs = let (ranks,(_:reqs)) = span (/= "0,0") xs in (map parse_rank ranks, map read reqs)
   where parse_rank r = let (n,(_:p)) = span (/= ',') r in (read n, read p)
  show' = map (show . succ . fromJust)

rank_checker :: ([(Int,Int)],[Int]) -> [Maybe Int]
rank_checker (ranks,reqs) = map (query_rank (groupBy equal_snd $ reverse $ sortBy (comparing snd) ranks)) reqs
 where
  equal_snd (x1,x2) (y1,y2) = x2 == y2
  query_rank ranklist req = findIndex (\samerank -> elem req (map fst samerank)) ranklist

Measured memory_bytes: 3872
open Batteries
let n, d = Scanf.sscanf (read_line()) "%d %f" (fun n d -> n,d)

let rec loop i result =
  if i >= n then result else (
    Scanf.sscanf (read_line()) "%d %d" (fun x y -> 
      if d >= (sqrt (float_of_int @@ x * x + y * y)) then loop (i+1) (result+1) else loop (i+1) result
    )
  )
let () = Printf.printf "%d\n" @@ loop 0 0

Measured memory_bytes: 10668
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

ll cnt(ll a) {
    if (a <=  1) {
        return a;
    }
    return 1 + 2 * cnt(a / 2);
}

void oneCase () {
    ll h;
    cin >> h;

    cout << cnt(h) << "\n";

}




int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    print(9*max(a,b,c)+a+b+c)
    return

#B
def B():
    a,b = LI()
    if a*b %2:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    k = I()
    print((k//2)*(k//2+k%2))
    return

#D
def D():
    n,i = LI()
    print(n-i+1)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 39152
(function() {
    'use strict';
 
    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;
      
    // ToDo start
      var SP = lines[0].replace(/\?/g,'.')
      var T = lines[1]

      for ( var i=-1*(T.length);i>=-1*SP.length;i--){
        var re = new RegExp(SP.substr(i,T.length))
        if(T.match(re)){
            console.log( (SP.substr(0,SP.length+i) + T +SP.substr(SP.length+i+T.length)).replace(/\./g,'a') )
            return;
        }
      }
      console.log("UNRESTORABLE")
      return;

    });

    
})();
  
  

Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pdd = pair<double, double>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;
    ll sum1 = 0, sum2 = 0;
    for (int i = 0; i < N; ++i) {
        ll A;
        cin >> A;
        (sum1 += A) %= MOD;
        (sum2 += A * A) %= MOD;
    }

    ll ans = sum1 * sum1 % MOD;
    ans -= sum2;
    ans *= 500000004;
    ans %= MOD;
    if (ans < 0)
        ans += MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)

ll const INF = 1000000000000000000;
int const I_MAX = 2147483647;
ll const MOD = 1e9 + 7;
int const POW_MAX = 1e5;

ll po[POW_MAX + 2];

ll mod_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

ll mod_inv (ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}

ll comb(int n, int r) {
  return (((po[n] * mod_inv(po[r])) % MOD) * mod_inv(po[n - r])) % MOD;
}

int const M_MAX = 1e6;

int s;
int calc[M_MAX + 1];

int f(int n) {
  return n % 2 == 0 ? n / 2 : 3 * n + 1;
}

int main() {
  scanf("%d", &s);

  calc[s]++;
  int a = s;
  FOR(i, 2, 1000000) {
    a = f(a);
    if (calc[a]) {
      printf("%d\n", i);
      return 0;
    } else {
      calc[a]++;
    }
  }
}


Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int a, b;

signed main() {
	cin >> a >> b;
	for (int i = 0; i <= 10000; i++) {
		if (i * 8 / 100 == a && i * 10 / 100 == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

vector<set<int>> XY(100000);
vector<int> P(100000);
vector<bool> reach(100000,false);
set<int> bango;
set<int> suchi;

void dfs(int x) {
	if (reach[x])
		return;
	reach[x] = true;
	auto it = XY[x].begin();
	while(it != XY[x].end()) {
		dfs(*it);
		it++;
	}
	bango.insert(x);
	suchi.insert(P[x]);
}

int main() {
	int N, M;
	cin >> N >> M;
	
	for (int i = 0;i < N;i++) {
		cin >> P[i];
		P[i]--;
	}
	int a, b;
	for (int i = 0;i < M;i++) {
		cin >> a >> b;
		a--; b--;
		XY[min(a, b)].insert(max(a, b));
		XY[max(a, b)].insert(min(a, b));
	}
	int ans = 0;
	for (int i = 0;i < N;i++) {
		bango = {};
		suchi = {};
		dfs(i);
		auto bgit = bango.begin();
		while (bgit != bango.end()) {
			if (suchi.find(*bgit) != suchi.end())
				ans++;
			//cout << *bgit << " ";
			bgit++;
		}
		//cout << endl;
	}
	cout << ans << endl;
}

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> listValue = new List<int>();
            listValue.AddRange(Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse));

            int sum = 0;
            int i = -(listValue[1]) + 1;
            for (int rngCnt = 1; rngCnt < listValue[0] + 1; rngCnt++)
            {
                if (rngCnt == i)
                {
                    // 味の差が0になるとき
                    for (int cnt = 1; cnt < listValue[0] + 1; cnt++)
                    {
                        sum += listValue[1] + cnt - 1;
                    }
                    goto end;
                }
            }

            if (listValue[1] < 1)
            {
                // 味の差の最小が最大個数のとき
                for (int cnt = 1; cnt < listValue[0]; cnt++)
                {
                    sum += listValue[1] + cnt - 1;
                }
            }
            else
            {
                // 味の差の最小が１つ目のリンゴのとき
                for (int cnt = 2; cnt < listValue[0] + 1; cnt++)
                {
                    sum += listValue[1] + cnt - 1;
                }
            }

            end:
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

a,b,c,d = mi()

tt = a//d + int(bool(a%d))
at = c//b + int(bool(c%b))

# print(tt,at)
if tt < at:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9180
#include <iostream>
#include <string>//忘れ
using namespace std;

int main()
{
	
	string a;
	string b;
	string c;

	cin >> a >> b >> c;

	string p = a.substr(0, 1) + b.substr(0, 1) + c.substr(0, 1);

	cout << p;


}

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) (X).begin(), (X).end()
#define sz(X) (int)X.size()

using ll = long long;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{ _
    int n, k; cin >> n >> k;
    vector x(n, 0);
    for (int i = 0; i < n; ++i) cin >> x[i];

    int logn = 32 - __builtin_clz(n);
    vector gol(n, vector(logn, -1)), gor(n, vector(logn, n));
    vector suml(n, vector(logn, 0LL)), sumr(n, vector(logn, 0LL));

    auto findright = [&](int i)
    {
        int j = i;
        for (int z = n; z; z >>= 1)
            while (j + z < n && x[j + z] < x[i] + k) j += z;
        return j + 1;
    };

    auto findleft = [&](int i)
    {
        int j = i;
        for (int z = n; z; z >>= 1)
            while (j - z >= 0 && x[j - z] > x[i] - k) j -= z;
        return j - 1;
    };

    for (int i = n - 2; i >= 0; --i)
        if ((gor[i][0] = findright(i)) < n)
        {
            sumr[i][0] = gor[i][0];
            for (int z = 1; z < logn && gor[i][z - 1] < n; ++z)
            {
                gor[i][z] = gor[gor[i][z - 1]][z - 1];
                sumr[i][z] = sumr[i][z - 1] + sumr[gor[i][z - 1]][z - 1];
            }
        }

    for (int i = 1; i < n; ++i)
        if ((gol[i][0] = findleft(i)) >= 0)
        {
            suml[i][0] = gol[i][0];
            for (int z = 1; z < logn && gol[i][z - 1] >= 0; ++z)
            {
                gol[i][z] = gol[gol[i][z - 1]][z - 1];
                suml[i][z] = suml[i][z - 1] + suml[gol[i][z - 1]][z - 1];
            }
        }

    int q; cin >> q;
    while (q--)
    {
        int l, r; cin >> l >> r; --l, --r;
        int m = 1;
        ll a = l;
        for (int z = logn - 1, i = l; z >= 0; --z)
            if (gor[i][z] <= r)
            {
                m += 1 << z;
                a += sumr[i][z];
                i = gor[i][z];
            }
        ll b = r;
        for (int z = logn - 1, i = r; z >= 0; --z)
            if (gol[i][z] >= l)
            {
                b += suml[i][z];
                i = gol[i][z];
            }
        ll ans = b - a + m;
        cout << ans << endl;
    }

    exit(0);
}



Measured memory_bytes: 116888
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  getc (solve . (map $ wrds toInt)) >>= mapM_ print

solve :: [[Int]] -> [Int]
solve = map f
  where
    f [x,y] = gcd x y

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getc :: ([String] -> a) -> IO a
getc f = f . lines <$> getContents

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

using namespace std;

typedef long long ll;

//#include<ext/pb_ds/assoc_container.hpp>
//#nclude<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define pii pair<int,ll>
#define pi pair<int,ll>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define eps 10E-10
#define mod 1000000007
#define pai acos(-1)
#define mx 1000000000
#define N 100005



int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<(n/500)*1000+((n%500)/5)*5<<endl;
    return 0;
}


Measured memory_bytes: 256
from math import gcd
k = int(input())
total = 0
for l in range(1, k+1):
    for m in range(l, k+1):
        for n in range(m, k+1):
            if l != m and m != n:
                total += gcd(l, gcd(m, n)) * 6
            elif l != m or m != n:
                total += gcd(l, gcd(m, n)) * 3
            else:
                total += gcd(l, gcd(m, n))

print(total)


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;cin >> n;
	string s;cin>>s;
	rep(i,s.size())
	{
		s[i]=(s[i]+n);
		if(s[i]>'Z')
		s[i]=s[i]-'Z'+'A'-1;
	}
	cout<<s<<endl;
	return 0;
}

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> p(n);
  
  int leA = 0, leB = 0;
  for(int &e: p){
    cin >> e;
    if(e <= a) leA++;
    if(e <= b) leB++;
  }
  
  cout << min(leA, min(leB-leA, n-leB)) << endl;
}

Measured memory_bytes: 256
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	if(a >= k) cout << k;
	else if(a+b >= k) cout << a;
	else cout << (a + a + b - k);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3640
#include<stdio.h>

int main(){
	int r[4],a[4];
	int rr,aa,i,k,j=1000,hit=0,brow=0;
	
	while(1){
		scanf("%d%d",&rr,&aa);
		
		if(rr == 0 && aa == 0) return 0;
		for(i=0;i<4;i++){
			r[i] = rr/j;
			rr = rr%j;
			j /= 10;
		}
		j = 1000;
		for(i=0;i<4;i++){
			a[i] = aa/j;
			aa = aa%j;
			j /= 10;
			for(k=0;k<4;k++){
				if(a[i] == r[k] && i == k){
					hit++;
				}
				else if(a[i] == r[k] && i != k){
					brow++;
				}
			}
		}
		j = 1000;
		printf("%d %d\n",hit,brow);
		hit  = 0;
		brow = 0;
	}
}

Measured memory_bytes: 600
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val N = sc.nextInt
    if (N != -1) {
      println(-(1150 + math.max((N - 10) * 125, 0) + math.max((N - 20) * 15, 0) + math.max((N - 30) * 20, 0) - 4280))
      solve(sc)
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 44940
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a;
	cin >> a;
	char arr[5];
	scanf("%s", arr);
	int c=0, x=100;
	for(int i=0; i<4; ++i){
		if(arr[i]!='.'){
			c += x * (arr[i]-'0');
			x/=10;
		}
	}
	long long e = (a*c)/100;
	cout << e;
}


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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            var data = Console.ReadLine().Split();
            int n = int.Parse(data[0]);
            int m = int.Parse(data[1]);
            int[] WAcnt = new int[n+1];
            int[] results = new int[n+1];
           

            for(int i = 0; i < m; i++)
            {
                var data2= Console.ReadLine().Split(' ');
                int p = int.Parse(data2[0]);

                if (data2[1] == "WA")
                {
                    if (results[p] == 0) WAcnt[p]++;
                }
                else if(data2[1]=="AC")
                {
                    results[p] = 1;
                }

            }

            int ACcnt = 0;
            int penalty = 0;

            for(int i = 1; i <= n; i++)
            {
                if (results[i]==1)
                {
                    ACcnt++;
                    penalty += WAcnt[i];
                }
                
            }

            

            Console.WriteLine(ACcnt+" "+penalty);

        }
    }
}


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

int k[105][105];//存放数字数组 
 
int main()
{
   int n, m, i, j;
   cin >> n >> m;
   
   char s[n+1][m+1];
   for(i = 1; i <= n; i++)//字符数组赋值 
   {
   		for(j = 1; j <= m; j++)
   		cin >> s[i][j];
   }
   
    for(i = 1; i <= n; i++)//字符数组转换成数字数组 
   {
   	    for(j = 1; j <= m; j++)
   	    {
   	    	if(s[i][j] == '#')
   	        	k[i][j] = -1;
   	    	else 
			    k[i][j] = 0;
   	    }
   }
   
   for(i = 1; i <= n; i++)//根据地雷位置标号 
   {
   	   for(j = 1; j <= m; j++)
   	   {
   	   	   if(k[i][j] == -1)
   	   	   {
   	   	   	    if(k[i][j-1] != -1) k[i][j-1]++;
				if(k[i][j+1] != -1) k[i][j+1]++;
				if(k[i-1][j] != -1) k[i-1][j]++;
				if(k[i+1][j] != -1) k[i+1][j]++;
				if(k[i-1][j-1] != -1) k[i-1][j-1]++;
				if(k[i+1][j-1] != -1) k[i+1][j-1]++;
				if(k[i-1][j+1] != -1) k[i-1][j+1]++;
				if(k[i+1][j+1] != -1) k[i+1][j+1]++;
		   }
	   }
   }
     
    for(i = 1; i <= n; i++)//输出最终结果 
   {
   	    for(j = 1; j <= m; j++)
   	    if(k[i][j] == -1)
   	       cout << '#' ;
   	    else
   	       cout << k[i][j];
   	    cout << endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int> vi;
const int mod = 1000000007;
const double PI = acos(-1);





int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    long double a,b,h,m;
    cin>>a>>b>>h>>m;
    h  = (h*60.0 + m)/2.0;
    long double angle = abs(h- (6.0)*m);
    //cout<<angle<<endl;
    angle = max(360.0-angle,angle);
   //cout<<angle<<endl;

    long double angles = (angle*PI)/180.0;
   // cout<<cos(angle)<<endl;
    long double ans = sqrt(a*a + b*b - float(2)*a*b*cos(angles)) ;
     std::cout << std::setprecision(10)<<ans<<endl;



  






}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
int N;
ll X;
ll x[300100];
ll rui[300100];
ll sum(int l,int r){
	if(l<=0)return rui[r];
	else return rui[r]-rui[l-1];
}
int main(){
	cin >> N >> X;
	for(int i=0;i<N;i++){
		cin >> x[i];
	}
	rui[0] = x[0];
	for(int i=1;i<N;i++){
		rui[i] = x[i]+rui[i-1];
	}
	ll ans = LLINF;
	for(int i=1;i<=N;i++){
		ll ret = X*(N+i);
		// cout << ret << ' ';
		for(int j=0;j<N;j+=i){
			ll c = j/i+1;
			ll k = max(5ll,2ll*c+1ll);
			ll ruis = sum(N-1-j-i+1,N-1-j);
			if((LLINF-ret)/k<=ruis){
				ret = LLINF;
				break;
			}
			ret += ruis*k;
		}
		// cout << ret << endl;
		ans = min(ans,ret);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3840
#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() {
  int n;
  cin >> n;
  vector<string> w(n);
  string first;
  cin >> first;
  w[0] = first;
  string word;
  for(int i = 1; i < n; i++){
  	cin >> w.at(i);
    if(w[i-1][w[i-1].length()-1] != w[i][0]){
    	cout << "No" << endl;
      	return 0;
    }
    int cnt = 0;
    for(int j = 0; j < w.size(); j++){
      	if(w[i] == w[j]) cnt++;
      	if(cnt == 2){
        	cout << "No" << endl;
          	return 0;
        }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

string alphabets="abcdefghijklmnopqrstuvwxyz";
char C;

int main()
{
    cin>>C;
    for (int i=0; i<26; i++){
        if (C==alphabets.at(i)){
            cout<<alphabets.at(i+1)<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n,c;
  cin>>n;
  int a[n]={0};
  for(int i=0;i<n-1;i++)
  {
  	cin>>c;
  	a[c-1]++;
  }
  for(int i=0;i<n;i++)
  	cout<<a[i]<<"\n";
}

Measured memory_bytes: 4412
($n,$d)=glob<>;
@{$_}=glob<>for(1..$n);
$S[$_]=$_*$_ for(0..127);
$c=0;
for$i(1..$n-1){
    for$j($i+1..$n){
        $s=0;
        $s += ($$i[$_]-$$j[$_])**2 for (0..$d-1);
        $c++ if grep{$s==$_}@S;
    }
}
print$c

Measured memory_bytes: 768
#include<stdio.h>

int main(void){
  int a[101];
  int n;
  int i,j=0;
  int v[101],max=0;
  for(i=0;i<101;i++){
    a[i]=0;
  }
  while((scanf("%d",&n))!=EOF){
    a[n]++;
  }
  for(i=1;i<101;i++){
    if(max<a[i]){
      max=a[i];
      v[0]=i;
      j=1;
    }else if(max==a[i]){
      v[j]=i;
      j++;
    }
  }
  for(i=0;i<j;i++){
    printf("%d\n",v[i]);
  }
  return 0;
}

Measured memory_bytes: 596
n = int(input())
s = str(input())
t = str(input())

if s == t:
    print(n)
    exit()

for i in range(n):
    #print(s[i:], t[:n-1-i+1])
    if s[i:] == t[:n-1-i+1]:
        break
else:
    i = n
    #pass
ans = i*2+(n-i)
print(ans)


Measured memory_bytes: 61800
#include<bits/stdc++.h>
//*************** Constraints are always Imaginary,I'm real **************
using namespace std;
#define int long long 
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define fi first
#define se second
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
int32_t main()
{
          ios_base::sync_with_stdio(false);
          cin.tie(NULL);
          // #ifndef ONLINE_JUDGE
          // freopen("input.txt","r",stdin);
          // freopen("output.txt","w",stdout);
          // #endif
          int m,n;
          cin>>n>>m;
          if(m==n)
                    cout<<"Yes";
          else
                    cout<<"No";
          //cout<<((n-1)/x)+1;
          return 0;
}

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

int main(void) {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    for (int i = 0; i < b; i++) {
      cout << a;
    }
    cout << endl;
  } else {
    for (int i = 0; i < a; i++) {
      cout << b;
    }
    cout << endl;
  }
  return 0;
}

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

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define sPRINT(str) printf(#str "\n")
#define yOUT sPRINT(Yes)
#define nOUT sPRINT(No)
#define YOUT sPRINT(YES)
#define NOUT sPRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
 
using namespace std;

int main(void)
{   
    string s;
    cin >> s;

    int tmp, MIN =1000;
    string x;
    REP(i, s.size()-2){
        x = s.substr(i,3);
        tmp = atoi(x.c_str());
        MIN = min(MIN, abs(753 - tmp));
    }

    cout << MIN << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=300005;

int n,s,a[MAXN];
ll ans=0,b[MAXN];
int dir=-1;
void work(int l,int r)
{
	if(a[l]>s)ans+=a[r]-s;
	else if(a[r]<s)ans+=s-a[l];
	else if(b[l]>=b[r])
	{
		if(dir!=0)ans+=a[r]-a[l],dir=0;
		b[l]+=b[r];
		work(l,r-1);
	}
	else
	{
		if(dir!=1)ans+=a[r]-a[l],dir=1;
		b[r]+=b[l];
		work(l+1,r);
	}
}

int main()
{
	#ifndef ONLINE_JUDGE
//	freopen("code.in","r",stdin);
//	freopen("code.out","w",stdout);
	#endif
	readint(n),readint(s);
	for(int i=1;i<=n;++i)readint(a[i]),readint(b[i]);
	work(1,n);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1408