akhauriyash/Code-Regression huggingface dataset:
n = int(input())
def solve(n):
    i = 1
    ans = 10000000
    while i*i <= n:
        if n % i == 0:
            lower = i
            if i != n // i:
                upper = n//i
            else:
                upper = i
            anstmp = max(len(str(lower)), len(str(upper)))
            if ans > anstmp:
                ans = anstmp
        i += 1
        
    return ans

print(solve(n))

Measured memory_bytes: 9144
n = input()
a = "357"
count357 = ["3", "5", "7"]
i = 0
count = 0
while int(count357[-1]) <= int(n):
    for j in range(3):
        count357.append(str(int(count357[i])*10 + int(count357[j])))
        if int(count357[-1]) > int(n):
            break
    i += 1
count357.pop(-1)
for i in range(len(count357)):
    if "3" in count357[i] and "5" in count357[i] and "7" in count357[i]:
        count += 1
print(count)

Measured memory_bytes: 5156
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, X, *A = map(int, read().split())
    
    v = 0
    for a in A:
        if a < X:
            v += 1
        else:
            break
    
    print(min(v, M - v))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mod 1000000007
const int N=200005;
int ans=0;
void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if(count)
    ans+=1;
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        }
        if(count) 
        ans+=1;
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        ans+=1;
} 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif*/
    cout<<fixed<<setprecision(15);
    
    ll a,b;
    cin>>a>>b;

    ll gc=__gcd(a,b);

    factorize(gc);

    cout<<ans+1;


    
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int[] a = new int[3];
			for (int i = 0; i < 3; i++) {
				a[i] = sc.nextInt();
			}
			Arrays.sort(a);

			System.out.println(a[2] - a[0]);
		}
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  vector<vector<int>> graph(N);
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  int ans[N];
  vector<int> lis;
  function<void(int, int)> dfs = [&](int v, int p) {
    int i = lower_bound(lis.begin(), lis.end(), a[v]) - lis.begin();
    int cs;
    int pre;
    if (i == lis.size()) {
      lis.push_back(a[v]);
      cs = 1;
    } else {
      pre = lis[i];
      lis[i] = a[v];
      cs = 2;
    }
    ans[v] = lis.size();
    for (int u : graph[v])
      if (u != p) {
        dfs(u, v);
      }
    if (cs == 1) lis.pop_back();
    if (cs == 2) lis[i] = pre;
  };
  dfs(0, -1);
  for (int i = 0; i < N; i++) cout << ans[i] << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

string s;
vector <int> ans, wh;
vector <vector<int>> d;
vector <bool> used;
int lroot;

void dfs(int u, int t, int root){
    used[u] = true;
    if (t % 2 == 0)
        ans[root]++;
    else
        lroot++;
    for (auto v : d[u]){
        if (used[v]) continue;
        dfs(v, t + 1, root);
    }
}

int main() {
#ifdef HOME
    freopen("input.txt", "rt", stdin);
#endif
    cin >> s;
    int n = s.length();
    wh.resize(n);
    d.resize(n);
    ans.resize(n);
    used.resize(n);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            d[i - 1].push_back(i);
        } else {
            d[i + 1].push_back(i);
        }
    }
    for (int i = 0; i < n - 1; i++){
        if (s[i] == 'R' && s[i + 1] == 'L'){
            lroot = 0;
            dfs(i, 0, i);
            ans[i + 1] = lroot;
        }
    }
    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';
    return 0;
}

Measured memory_bytes: 11520
#include<stdio.h>
#define INFTY 1000000000

void merge(int*,int,int,int);
void mergeSort(int*,int,int);
int *A,c;
int main()
{
  int a[500000],i,n;
  A=a;
  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      scanf("%d",A+i);
    }
  mergeSort(A,0,n);

  for(i=0;i<n;i++)
    {
      printf("%d",*(A+i));
      if(i<n-1)printf(" ");
    }
  printf("\n%d\n",c);

  return 0;
}
void  merge(int *A, int left, int mid, int right)
{
  int n1,n2,L[mid-left],R[right-mid],k,i,j;

  n1= mid - left;
  n2= right - mid;

  for(i=0; i<n1; i++)
    {
      L[i] = *(A+left+i);
    }

  for(i=0; i<n2; i++)
    {
      R[i] = *(A+mid+i);
    }

  L[n1] = INFTY;
  R[n2] = INFTY;

  i=0;
  j=0;
  for(k=left; k<right; k++)
    {
     if( L[i] <= R[j] ){
        *(A+k) = L[i];
        i++;
      }
      else{
        *(A+k) = R[j];
        j++;
      }
      c++;
    }
}
void mergeSort(int *A, int left, int right)
{
  int mid;
  if(left+1 < right)
    {
      mid = (left + right)/2;
      mergeSort(A, left, mid);
      mergeSort(A, mid, right);
      merge(A,left,mid,right);
    }
}


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

dp = [[0]*3 for i in range(n)]
dp[0][0], dp[0][1], dp[0][2] = map(int, input().split())

for i in range(1,n):
    l = list(map(int, input().split()))
    for j in range(3):
        dp[i][j] = max(dp[i-1][j-1], dp[i-1][j-2]) + l[j]

print(max(dp[n-1]))

Measured memory_bytes: 59956
n = int(input())
w = list(map(int, input().split()))

l = len(w)
S = sum(w)

min_d = S
s = 0
for wi in w:
    min_d = min(min_d, S - 2 * s)
    s += wi
    if S - 2 * s < 0:
        min_d = min(min_d, 2 * s - S)
        break

print(min_d)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){

    int r,c,ans[110][110],i,j;
  
	 scanf("%d",&r);  	 
  	 scanf("%d",&c);
    
     for(i=1;i<=r;++i){
	  for(j=1;j<=c;++j){             
            scanf("%d",&ans[i][j]);
        }
      }
    
     for(i=1;i<=r;++i){
	  for(j=1;j<=c;++j){  
         ans[i][c+1]+=ans[i][j];
	     ans[r+1][j]+=ans[i][j];
	   }
   	     ans[r+1][c+1]+=ans[i][c+1];
      }     
    
     for(i=1;i<=r+1;++i){
	   for(j=1;j<=c+1;++j){
         if (j==1){ 
			 printf("%d",ans[i][j]);
		 }else{
			 printf(" %d",ans[i][j]);
         }
	   }
	     printf("\n");
     }	 	  

	return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<algorithm>
using ll = long long;
using namespace std;
int main(){
	ll n,ans=0;
	cin >> n;
	vector<ll> a(n),b(n),c(n),x(n),y(n);
	
	for(int i=0;i<n;i++)	cin >> a[i];
	for(int i=0;i<n;i++)	cin >> b[i];
	for(int i=0;i<n;i++)	cin >> c[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	for(int i=0;i<n;i++){
		auto itr = upper_bound(a.begin(),a.end(),(b[i]-1));
		x[i] = int(itr-a.begin());
		//cout << x[i] << endl;
	}
	//cout << endl;
	for(int i=0;i<n;i++){
		auto itr2 = upper_bound(c.begin(),c.end(),(b[i]));
		ans += x[i]*(c.end()-itr2);
		//cout << int(c.end()-itr2) << endl;
	}
	cout << ans << endl;
	return 0;
}

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

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

	double ans = 0;

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

		int tmp = i;
		double tmp_ans = (double) 1 / n;
		
		while (tmp <= k - 1) {
			tmp *= 2;
			tmp_ans *= (double)1 / 2;
		}

		ans += tmp_ans;

	}

	cout << fixed << setprecision(14) << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import math

# 読み込み
N, D = [int(x) for x in input().split(" ")]
X, Y = [], []

for _ in range(N):
    _x, _y = [int(x) for x in input().split(" ")]
    X.append(_x)
    Y.append(_y)

# 処理
count = 0
for i in range(N):
    dist = math.sqrt(X[i]**2 + Y[i]**2)
    if (dist <= D): count += 1

# 出力
print(count)

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

using namespace std;

long long dp[200][200000];
long long c[200],w[200];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n,we;
    cin >> n >> we;

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

    for (int i=0;i<=n;i++)
        for (int j=0;j<=100000;j++)
        dp[i][j]=(long long)1e18;

    dp[0][0]=0;
    for (int i=0;i<n;i++)
        for (int j=0;j+c[i]<=100000;j++)
    {
        dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        dp[i+1][j+c[i]]=min(dp[i+1][j+c[i]],dp[i][j]+w[i]);
    }

    int ans=0;
    for (int i=0;i<=100000;i++)
        if (dp[n][i]<=we)
        ans=i;

    cout << ans;
}


Measured memory_bytes: 157184
N=int(input())
K=-1
for i in range(1,N+2):
    if i*(i-1)==2*N:
        K=i
        break
if K==-1:
    print("No")
    exit()
else:
    print("Yes")
print(K)
L=[[] for i in range(K)]
t=1
X=[[0 for i in range(K-1)] for i in range(K)]
for i in range(K):
    for j in range(i):
        L[i].append(L[j][-1])
        L[j].pop()
    for j in range(K-1-i):
        L[i].append(t)
        t+=1
    for j in range(K-1):
        X[i][j]=L[i][j]
for i in range(K):
    S=str(K-1)
    for j in range(K-1):
        S=S+" "+str(X[i][j])
    print(S)


Measured memory_bytes: 10604
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  string str;cin>>str;
  set<string> SET;
  int L = 1;
  int init = 0;
  string prev = "";
  int cnt = 0;
  while(true)
  {
    string tmp = str.substr(init,L);
    if(prev != tmp)
    {
      prev = tmp;
      init += L;
      L = 1;
      cnt++;
    }
    else
    L++;

    if(init + L >str.size())break;
  }
  cout<<cnt<<endl;
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}

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

#define ll long long

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

    int n;
    cin >> n;

    int T[n+1], X[n+1], Y[n+1];

    for (int i = 1; i <= n; i++){
        cin >> T[i];
        cin >> X[i];
        cin >> Y[i];
    }

    for (int i = 1; i <= n; i++){
        int p, t;
        if (i == 1){
            p = (X[i] - 0) + (Y[i] - 0);
            t = T[i] - 0;
        }else{
            p = (X[i] - X[i-1]) + (Y[i] - Y[i-1]);
            t = T[i] - T[i-1];
        }

        if (t < p){
            cout << "No" << endl;
            return 0;
        }else if (t > p){
            int lt = t - p;
            if (lt % 2 != 0){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,a[200000],b[200000],k,ans;
  cin >> n;
  k=0;
  ans=0;
  rep(i,n)cin >> a[i];
  rep(i,n)b[i]=0;
  while(1){
    b[k]++;
    k=a[k]-1;
    ans++;
    if(k==1){
      printf("%lld",ans);
      return 0;
    }
    if(b[k]==2){
      printf("-1");
      return 0;
    }
  }
}

Measured memory_bytes: 3072
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N, D = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    grid = [[int(x) for x in sys.stdin.readline().split()]
            for _ in range(3)]  # int grid
    N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]

    for b in v_list:
        for i in range(3):
            for j in range(3):
                if grid[i][j] == b:
                    grid[i][j] = True

    # 横
    for i in range(3):
        if grid[i][0] == True and grid[i][1] == True and grid[i][2] == True:
            print('Yes')
            return

            # たて
    for j in range(3):
        if grid[0][j] == True and grid[1][j] == True and grid[2][j] == True:
            print('Yes')
            return

    if grid[0][0] == True and grid[1][1] == True and grid[2][2] == True:
        print('Yes')
        return

    if grid[0][2] == True and grid[1][1] == True and grid[2][0] == True:
        print('Yes')
        return

    print('No')


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """41 7 46
26 89 2
78 92 8
5
6
45
16
57
17"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34"""
        output = """Yes"""
        self.assertIO(input, output)


Measured memory_bytes: 6432
#include <stdio.h>

int main(void)
{
	int n, m;
	int alive;
	int player[1000];
	int i;
	int count;
	
	while (scanf("%d %d", &n, &m), n){
		alive = n;
		for (i = 0; i < n; i++){
			player[i] = 1;
		}
		
		count = m;
		while (alive > 1){
			player[count] = 0;
			alive--;
			
			for (i = 0; i < m; i++){
				count = (count + 1) % n;
				while (!player[count]){
					count = (count + 1) % n;
				}
			}
		}
		
		for (i = 0; i < n; i++){
			if (player[i]){
				if (!i){
					printf("%d\n", n);
				}
				else {
					printf("%d\n", i);
				}
				break;
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 604
n = int(input())
*A, = map(int, input().split())
inf = 10**18
# DP[i][0]=i番目まででi//2個選んだ最大値
# DP[i][1]=i番目まででi//2+1個選んだ最大値
DP = [[-inf]*2 for i in range(n)]
DP[0][0] = 0
DP[0][1] = A[0]
DP[1][0] = 0
DP[1][1] = max(A[0], A[1])
for i in range(2, n):
    if i % 2 == 0:
        DP[i][0] = max(DP[i-2][0]+A[i], DP[i-1][1])
        DP[i][1] = DP[i-2][1]+A[i]
    else:
        DP[i][0] = max(DP[i-2][0]+A[i], DP[i-1][0])
        DP[i][1] = max(DP[i-2][1]+A[i], DP[i-1][1])
if n % 2 == 0:
    print(DP[n-1][1])
else:
    print(DP[n-1][0])


Measured memory_bytes: 55196
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

def main():
  a,b=ints()
  A = {n for n in range(int(ceil(a/0.08)),int(ceil((a+1)/0.08)))}
  B = {n for n in range(int(ceil(b/0.1)),int(ceil((b+1)/0.1)))}
  print(min(A&B)) if len(A&B)!=0 else print(-1)
    
if __name__ == '__main__':
  main()

Measured memory_bytes: 3316
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  double a,b,c,d;
  double BC,CA,C;
  while(cin>>a>>b>>c>>d,a!=-1|b!=-1|c!=-1|d!=-1){
    BC=M_PI*(90.0-a)/180.0;
    CA=M_PI*(90.0-c)/180.0;
    C=M_PI*(d-b)/180.0;
    cout<<(int)(0.5+6378.1*acos(cos(BC)*cos(CA)+sin(BC)*sin(CA)*cos(C)))<<endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const int N=2e5+5;
using namespace std;
map<pair<int,int>,int> mp;
int main()
{

    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        double d;cin>>d;
        ll t=d*1e9+0.5;
        int two=0,five=0;
        while(t%2==0)
        {
             two++;
            t/=2;
        }
        while(t%5==0)
        {
            five++;
            t/=5;
        }
        mp[{two,five}]++;
    }
    ll ans=0;
    for(auto p1:mp)
    {
        for(auto p2:mp)
        {
            if (p1.first.first+p2.first.first>=18&&p1.first.second+p2.first.second>=18)
            {
                if(p1<p2) ans+=(ll)p1.second*p2.second;
                else if(p1==p2) ans+=(ll)p1.second*(p1.second-1)/2;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3724
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class Type>struct is_vector : std::false_type {};
	template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
	template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
		if (v.empty())return out;
		constexpr bool is_vector_v = is_vector<T>::value;
		if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
		else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
		return out;
	}
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
	inline void putn() {}
	template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

	void solve() {
		IOS;
		int q;
		cin >> q;
		REP(loop, q) {
			string x, y;
			cin >> x >> y;
			int m = x.size(), n = y.size();
			vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
			REP(i, m) {
				REP(j, n) {
					dp[i + 1][j + 1] = max({ dp[i + 1][j],dp[i][j + 1],dp[i][j] + (x[i] == y[j]) });
				}
			}
			put(dp[m][n]);
		}
	}
} // namespace idaten

int main() {
	idaten::solve();
	return 0;
}



Measured memory_bytes: 6800
N = int(input())
a = []
for _ in range(N):
    a.append(int(input())-1)

tmp = a[0]
ans = 1
for i in range(N+1):
    if tmp == 1:
        print(ans)
        break
    tmp = a[tmp]
    ans += 1
else:
    print(-1)

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

int main() {
	int n, m, x, y, ans, minp;
	int a[50], b[50], c[50], d[50], point[50];
	cin >> n >> m;
	for (int i = 0;i < n;++i)cin >> a[i] >> b[i];
	for (int i = 0;i < m;++i)cin >> c[i] >> d[i];
	for (int i = 0;i < n;++i) {
		for (int j = 0;j < m;++j) {
			x = abs(a[i] - c[j]);
			y = abs(b[i] - d[j]);
			if (j == 0) { 
				minp = x + y;
				ans = 1; 
			}
			if (minp > x + y) {
				minp = x + y;
				ans = j + 1;
			}
		}point[i] = ans;
	}
	for (int i = 0;i < n;++i)cout << point[i] << endl;
	return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n : usize,
        a : [usize; n - 1],
    }
    let mut emp = vec![0; n];
    for (_i, v) in a.iter().enumerate() {
        emp[*v - 1] += 1;
    }
    for i in 0..n {
        println!("{}", emp[i])
    }
}


Measured memory_bytes: 5516
#include<bits/stdc++.h>
using namespace std;
int n,y;
int main()
{
	scanf("%d%d",&n,&y);
	for(int i=0;i<=n;i++)
	for(int j=0;j<=n-i;j++)
	if(10000*i+5000*j+1000*(n-i-j)==y)
	{
		printf("%d %d %d\n",i,j,n-i-j);
		return 0;
	}
	printf("-1 -1 -1");
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int N;
    float T, A, H;
    cin >> N >> T >> A;
    float best = 1000000, tmp = 0;
    int res = 0;
    
    for (int i = 0; i < N; i++) {
        cin >> H;
        tmp = T - H * 0.006;
        if (abs(best - A) > abs(tmp - A)) {
            best = tmp;
            res = i + 1;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n,in;
	ll sum = 0;
	vi v;
	cin >> n;
	rep(i, n) {
		cin >> in;
		v.push_back(in);
		sum += in;
	}
	sort(all(v));
	if (sum % 10) {
		cout << sum << endl;
	}
	else {
		rep(i, n) {
			if (v[i] % 10) {
				cout << sum - v[i] << endl;
				return 0;
			}
		}
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
/*input
3
5 6 3 8
5 100 8




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

// ALL DEFFINES HERE
#define ll long long int
#define ii pair<int, int>
#define mp make_pair

#define rep(i, n) for(int i=0; i < n; i++)
#define Rep(i, k, n) for(int i=k; i < n; i++)
#define pb push_back
#define vi vector<int>
#define vii vector< vector<int> >
#define vl vector<ll>
#define F first
#define S second
#define all(v) v.begin(), v.end()

// ALL declarations here const ints etc
// const  ll mod = 1e9+7;
const ll mod = 998244353; 
// const int MAXN = 1e5;

// IMPORTANT FUNCTION DECLARATIONS , 
//SORRY FOR THE BAD PRESENTATION
ll gcd(ll a, ll b)
{
	if ( b==0)
		return a;
	return gcd(b, a%b);
}
ll absl(ll a )
{
	return  a>= 0 ?a:-a;
}
ll maxl(ll a, ll b)
{
	return a >= b? a:b;
}
ll minl(ll a, ll b)
{
	return a <= b? a:b;
}
ll exp(ll a, ll n)
{
	if ( n==0)
		return 1;
	if ( n==1 )
		return a;
	if ( n & 1)
		return (a%mod * exp((a*a)%mod, n/2)%mod)%mod;
	else
		return exp((a*a)%mod, n/2)%mod;
}
// --->>> main starts here
// m*h >= l + k
double mi( double a , double b)
{
	return a < b? a : b;
}
double mx( double a , double b)
{
	return a >= b ? a : b;
}
int add(int a, int b) {
	a += b;
	if (a >= mod) a -= mod;
	if (a < 0) a += mod;
	return a;
}

int mul(int a, int b) {
	return a * 1ll * b % mod;
}

// ll ceil( ll a  , ll b){  return ( a % b == 0 ? a/b : a/b +1); }

// int find( int i){ return (people[i] = i == people[i] ? i : find(people[i]));}

set<pair<int, int > > v;
int dx[4] = { 0 , 1, -1 , 0};
int dy[4] = { 1 , 0 , 0 , -1};

void solve()
{
	int n;
	cin >> n;
	vector<int> v(n+1);
	ll total =0;
	for  (int i =0;  i <  n+1; i++)
		cin >> v[i] , total += v[i];
	vector<int> b(n);
	for ( int i =0; i < n;i++)
		cin >> b[i];
	for ( int  i= 0 ;  i < n; i++)
	{
		int d= min(v[i] , b[i]);
		v[i]   -=  d;
		b[i]   -=  d;
		d =min(v[i+1] , b[i]);
		v[i+1] -=  d;
		b[i]   -=  d;
		// cout << v[i] << " " << v[i+1] << " " << b[i] << "\n";
	}
	ll rem =0;
	for ( int i =0; i < n+1 ; i++)
		{
			rem+=v[i];
			
		}
	cout << total - rem;

}
int main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  #ifdef debug
   auto beginProgram = chrono::steady_clock::now();
  #endif
  // int t; cin >> t;
  // while (t--) 
  {
  	// cal();
    solve();
  }
  #ifdef debug
  auto endProgram = chrono::steady_clock::now();
  std::chrono::duration<double> diff = endProgram - beginProgram;
  cout << "\nTime: " <<diff.count()*1000 << " ms\n";
  #endif
  return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W ;
  string s[H * W];
  bool U, D, R, L = 0;
  int buff;
  for (int i = 0; i < H; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < H; i++) {
    if (i != 0) {
      U = 1;
    } else {
      U = 0;
    }
    if (i != H-1) {
      D = 1;
    } else {
      D = 0;
    }
    for (int j = 0; j < W; j++) {
      int count = 0;
      if (s[i].at(j) == '#') {
        continue;
      }
     //   cout << i<<":"<<j << endl;
      if (U == 1) {
        if (s[i - 1].at(j) == '#') {
          count++;
        }
      }
      if (D == 1) {
        if (s[i + 1].at(j) == '#') {
          count++;
        }
      }
      if (j != 0) { //L
        if (s[i].at(j - 1) == '#') {
          count++;
        }
        if (U == 1) {
          if (s[i - 1].at(j - 1) == '#') {
            count++;
          }
        }
        if (D == 1) {
          if (s[i + 1].at(j - 1) == '#') {
            count++;
          }
        }
      }
      if (j != W-1) { //R
        if (s[i].at(j + 1) == '#') {
          count++;
        }
        if (U == 1) {
          if (s[i - 1].at(j + 1) == '#') {
            count++;
          }
        }
        if (D == 1) {
          if (s[i + 1].at(j + 1) == '#') {
            count++;
          }
        }
      }
      if(count==0){
      buff='0';
      }else if(count==1){
      buff='1';
      }else if(count==2){
      buff='2';
      }else if(count==3){
      buff='3';
      }else if(count==4){
      buff='4';
      }else if(count==5){
      buff='5';
      }else if(count==6){
      buff='6';
      }else if(count==7){
      buff='7';
      }else if(count==8){
      buff='8';
      }
    s[i].at(j)=buff;
    }
  }
  for(int i=0;i<H;i++){
  cout << s[i] << endl;    
  }
  // ここにプログラムを追記
}


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

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

const int INF = 1000000007;

int add2(int a[]){
	int cnt=0;
	sort(a, a+3);
	for(int i=0;i<2;i++){
		while(a[i] != a[2]){
			a[i] += 2;
			cnt++;
		}
	}

	return cnt;
}

int main(){
	int a[3]={0};
	int odd=0,cnt=0;
	for(int i=0;i<3;i++){
		cin>>a[i];
		if(a[i] % 2 == 0) odd++;
	}

	int sum=0;

	//cout<<odd<<endl;

	sum = a[0] + a[1] + a[2];
	if(sum % 2 == 1){
		if(odd == 0){
			cnt += add2(a);
		}
		else{
			for(int i=0;i<3;i++){
				if(a[i] % 2 == 0){
					a[i] += 1;
				}
			}
			cnt++;
			cnt += add2(a);
		}
	}
	else{
		if(odd == 1){
			for(int i=0;i<3;i++){
				if(a[i] % 2 == 1){
					a[i] += 1;
				}
			}
			cnt++;
			cnt += add2(a);
		}
		else{
			cnt += add2(a);
		}
	}

	cout<< cnt <<endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int main(){
  int h,w;
  while(1){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(i==0 || j==0 || i==h-1 || j==w-1){
          printf("#");
        }else{
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 2584
#include <iostream>
#include <algorithm>
#include<vector>
#include <queue>
using namespace std;
int main()
{
	long long n;
	cin >> n;
	cout << n << ":";


	for (int j = 2; j*j <= n; j ++) {

		while (n % j == 0) {
			n = n / j;
			cout << " " << j;
		}
	}
	if(n!=1)cout << " " << n;
	cout << endl;
}


Measured memory_bytes: 3108
#include<stdio.h> 
#include<math.h>
int main() 
{ 
      int a,b; 
      while(scanf("%d%d",&a,&b)!=EOF) 
      { 
         int x=a+b; 
         int cnt=0; 
         while(x) 
           { 
		      cnt++; 
              x/=10; 
           } 
         printf("%d\n",cnt); 
      } 
      return 0; 
} 

Measured memory_bytes: 1028
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer = new StringTokenizer(input.readLine());
        int k = Integer.parseInt(tokenizer.nextToken());
        int s = Integer.parseInt(tokenizer.nextToken());
        int count = 0;
        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k; j++) {
                if (s >= i+j && s-(i+j) <= k){
                    count++;
                }
            }
        }
        System.out.println(count);

    }
}


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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<long long> x, std::vector<long long> y){
    vector<ll> points1(N), points2(N);
    rep(i,0,N) {
        points1[i] = x[i]+y[i];
        points2[i] = x[i]-y[i];
    }
    ll answer = max(*max_element(all(points1)) - *min_element(all(points1)), *max_element(all(points2)) - *min_element(all(points2)));
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 9612
#include<iostream>
using namespace std;
int main(){
	int n,y; cin>>n>>y;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n-i;j++){
			int k=n-i-j;
			if(10000*i+5000*j+1000*k==y){
				cout << i << ' ' << j << ' ' << k;
				return 0;
			}
		}
	}
	cout << -1 << ' ' << -1 << ' ' << -1;
	return 0;
}


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

int main(){
   int n;
   cin >> n;
   vector<int> d(n);
   vector<int> cnt(n);
   for(int i = 0; i < n; i++){
       cin >> d.at(i);
       cnt[d.at(i)]++;
   }
    if(d.at(0) != 0){
        cout << 0 << endl;
        return 0;
    }
    long long ans = cnt[0] == 1 ? 1 : 0;
    for(int i = 1; i < n; i++){
        ans = ans * cnt[d.at(i) - 1] % 998244353;
    }
    if(cnt[0] != 1){
        cout << 0 << endl;
    }
    else{
        cout << ans << endl;        
    }
}

Measured memory_bytes: 1024
'use strict'
function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp[0].split(' ').map(n => Number(n))
    .sort((a, b) => a - b)
  
  let ans = [inp[0]]
  for (let i = 1; i < N; i++) {
    ans[i] = (ans[i - 1] + inp[i]) / 2
  }
  console.log(ans[N-1])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define ll long long
#define MOD (ll)1e9+7
#define REP(i,b,e) for(int (i)=b;(i)<e;(i)++)
const ll INF= 1LL << 60;
 
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
 
 
//入力
ll A,B,T;

int main(){
  cin >> A>>B>>T;
    cout<<(ll)(T/A)*B<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

vector<vector<int>> to;
vector<vector<ll>> cost;

int main() {
	int n;
	cin >> n;
	to.resize(n);
	cost.resize(n);
	rep(i,n-1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		to[a].push_back(b);
		to[b].push_back(a);
		cost[a].push_back(c);
		cost[b].push_back(c);
	}
	int q, k;
	cin >> q >> k;
	k--;
	vector<int> x(q), y(q);
	rep(i,q) {
	 cin >> x[i] >> y[i];
	 x[i]--, y[i]--;
	}

	vector<ll> dist(n, LINF);
	dist[k] = 0;
	queue<int> que;
	que.push(k);
	while(!que.empty()) {
		int x = que.front(); que.pop();
		for (int j = 0; j < (int) to[x].size(); j++) {
			int nx = to[x][j];
			if (dist[nx] != LINF) continue;
			dist[nx] = dist[x] + cost[x][j];
			que.push(nx);
		}
	}

	rep(i,q) {
		cout << dist[x[i]] + dist[y[i]] << endl;
	}
}

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

int main(){
  int N,K;cin>>N>>K;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<N-K;i++){
    cout<<(A.at(i)<A.at(i+K)?"Yes":"No")<<endl;
  }
}

Measured memory_bytes: 4048
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  long long a, b, x;
  cin >> a >> b >> x;

  long long ret = b / x;
  if (a >= x)
    ret -= a / x;
  if (a % x == 0)
    ++ret;

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
long long p = 1000000007;
long long kai[1001];
long long inv[1001];
long long ikai[1001];
long long dp[21][1001];
long long n, k, a[20], x;
int main() {
	kai[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		kai[i] = kai[i - 1] * i % p;
	}
	inv[1] = 1;
	for (int i = 2; i <= 1000; i++) {
		inv[i] = (p - inv[p % i]) * (p / i) % p;
	}
	ikai[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		ikai[i] = ikai[i - 1] * inv[i] % p;
	}
	scanf("%lld%lld", &n, &k);
	for (long long i = 0; i < k; i++) {
		scanf("%lld", a + i);
	}
	dp[0][0] = 1;
	for (long long l = 0; l < k; l++) {
		for (long long i = 0; i <= n; i++) {
			for (long long j = 0; j <= a[l]; j++) {
				if (i + j <= n) {
					x = kai[n - i] * kai[n - j] % p;
					x *= ikai[n - a[l]] * ikai[n - i - j] % p;
					x %= p;
					x *= ikai[j] * ikai[a[l] - j] % p;
					x %= p;
					dp[l + 1][i + j] += x * dp[l][i] % p;
					dp[l + 1][i + j] %= p;
				}
			}
		}
	}
	printf("%lld\n", dp[k][n]);
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void){
	int a,b,c,x,y,z;
	scanf("%d %d %d",&a,&b,&c);
	
	z=0;
	for(x=a;x<=b;x++){
		if(c%x==0){
			z+=1;
		}else{
			z+=0;
		};
		
		
	}
	printf("%d\n",z);
	return 0;
}
 

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

for i in range(1, K + 1):
  if i % 2 != 0:
    if A % 2 != 0:
      A -= 1
    B += int(A/2)
    A = int(A/2)
  else:
    if B % 2 != 0:
      B -= 1
    A += int(B/2)
    B = int(B/2)
    
print(A, B)

Measured memory_bytes: 3060
// 2011/03/22 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	while(!cin.eof()){
		string str;
		getline(cin, str);

		if(str.empty())
			continue;

		istringstream ist(str);
		int p, q;
		ist >> p >> q;

		int syo[100];
		int ama[100];
		int m = -1;
		int n = -1;
		for(int i=0; i<100; i++){
			p *= 10;
			syo[i] = p/q;
			ama[i] = p%q;

			if(ama[i]==0){
				cout << syo[i] << endl;
				break;
			}

			for(int j=0; j<i; j++)
				if(syo[j]==syo[i]&&ama[j]==ama[i]){
					m = j;
					n = i;
					break;
				}

			if(m!=-1){
				cout << endl;
				for(int j=0; j<m; j++)  cout << ' ';
				for(int j=m; j<n; j++)  cout << '^';
				cout << endl;
				break;
			}

			cout << syo[i];
			p = ama[i];
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


LL paintCount(LL n, vector<LL>& h, LL i, LL j){
    LL cnt = 0;
    LL left = 0;
    if(i > 0) left = h[i-1];
    for(LL cur = i; cur <= j; ++cur){
        cnt += max(0LL, h[cur] - left);
        left = h[cur];
    }
    return cnt;
}

LL paintCount2(LL n, vector<LL>& h, LL i, LL j){
    LL left = 0;
    if(i > 0) left = h[i-1];
    return max(0LL, h[j] - left);
}

int main(){
    LL n, k;
    cin >> n >> k;
    vector<LL> h(n+1);
    for(LL i = 0; i < n; ++i){
        cin >> h[i];
    }
    vector<vector<LL>> dp(n+2, vector<LL>(k+1));
    for(LL i = 0; i <= n; ++i){
        for(LL j = i; j <= n; ++j){
            for(LL b = 0; b <= k; ++b){
                dp[j+1][b] = max(dp[j+1][b], dp[i][b]);
            }
        }
        for(LL j = i+1; j <= n; ++j){
            LL cnt = paintCount(n, h, i, j) - paintCount2(n, h, i, j);
            //cerr << i << " " << j << " " << cnt << endl;
            for(LL b = 0; b < k; ++b){
                if(b+j-i > k) continue;
                dp[j+1][b+j-i] = max(dp[j+1][b+j-i], dp[i][b] + cnt);
            }
        }
    }
    for(auto row: dp){
        //cerr << row << endl;
    }
    LL total = paintCount(n, h, 0, n);
    //cerr << "total=" << total << endl;
    cout << total - dp[n+1][k] << endl;
    return 0;
}



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

int main() {
    long long n,a,b;
    cin>>n>>a>>b;
    if (a==0) cout<<0<<endl;
    else if (a>=n) cout<<n<<endl;
    else if (a+b>=n) cout<<a<<endl;
    else {
        long long ans = floor(n/(a+b)),ans1=0,ans2=0;
        ans2=ans*a;
        ans1=ans*a+ans*b;
        if(ans1+a<=n){
            ans1+=a;
            ans2+=a;
        }
        else ans2+=(n-ans1);
        cout<<ans2<<endl;
        
    }
        
}

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

using namespace std;

#define N 300000

int n,ans,a[N];

bool check(int x){
	for (int i=1;i<n;++i){
		if (a[n-i]<x&&a[n-i+1]<x) return 0;
		if (a[n-i]>=x&&a[n-i+1]>=x) return 1;
		if (a[n+i]<x&&a[n+i-1]<x) return 0;
		if (a[n+i]>=x&&a[n+i-1]>=x) return 1;
	}
	return a[1]>=x;
}

int main(){
	scanf("%d",&n);
	for (int i=1;i<n*2;++i) scanf("%d",a+i);
	int l=1,r=n*2-1;
	while (l<=r){
		int mid=(l+r)>>1;
		if (check(mid)){ans=mid; l=mid+1;}
		else r=mid-1;
	}
	printf("%d\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int Maxn=200010;
const int inf=2147483647;
const int mod=998244353;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int n,f[Maxn],s[Maxn],L[11],R[11],k;
void upd(int&x,int y){x=(x+y)%mod;}
int main()
{
	memset(f,0,sizeof(f));
	n=read(),k=read();
	f[1]=s[1]=1;s[0]=0;
	for(int i=1;i<=k;i++)L[i]=read(),R[i]=read();
	for(int i=2;i<=n;i++)
	{
		f[i]=0;
		for(int j=1;j<=k;j++)
		{
			if(i-L[j]<1)continue;
			upd(f[i],(s[i-L[j]]-s[max(1,i-R[j])-1]+mod)%mod);
		}
		s[i]=(s[i-1]+f[i])%mod;
	}
	printf("%d",f[n]);
}

Measured memory_bytes: 5320
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    ll x[n];
    rep(i, n) cin >> x[i];
    ll sum = 0;

    rep(i, n - 1) {
        sum += min((x[i + 1] - x[i]) * a, b);
    }
    cout << sum << endl;
    return 0;
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

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

  int now = 0;
  for ( int i = 0; i < N; i++ ) {
    if ( A[i] == now+1 ) now++;
  }

  if ( now == 0 ) cout << -1 << endl;
  else cout << N-now << endl;
  
  return 0;
}


Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val (n, m, l) = readLine()!!.split(' ').map(String::toInt)
    val minCostMap = Array(n + 1) { Array(n + 1) { Long.MAX_VALUE / 2 } }
    (1..n).forEach {
        minCostMap[it][it] = 0
    }
    for (i in 0 until m) {
        val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
        minCostMap[a][b] = c.toLong()
        minCostMap[b][a] = c.toLong()
    }
    for (i in 1..n) {
        for (j in 1..n) {
            for (k in 1..n) {
                minCostMap[j][k] = Math.min(minCostMap[j][k], minCostMap[j][i] + minCostMap[i][k])
            }
        }
    }

    val minSupMap = Array(n + 1) { Array(n + 1) { Long.MAX_VALUE / 2 } }
    (1..n).forEach { minSupMap[it][it] = 0 }
    for (i in 1 until n) {
        for (j in i + 1..n) {
            if (minCostMap[i][j] <= l) {
                minSupMap[i][j] = 1
                minSupMap[j][i] = 1
            }
        }
    }
    for (i in 1..n) {
        for (j in 1..n) {
            for (k in 1..n) {
                minSupMap[j][k] = Math.min(minSupMap[j][k], minSupMap[j][i] + minSupMap[i][k])
            }
        }
    }
    for (x in 1..(readLine()!!.toInt())) {
        val (s, t) = readLine()!!.split(' ').map(String::toInt)
        val sup = minSupMap[s][t] - 1
        println(if (sup > Long.MAX_VALUE / 10) -1 else sup)
    }
}

Measured memory_bytes: 132504
using System;

namespace MF
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(' ');
            var a = double.Parse(x[0]);
            var b = double.Parse(x[1]);
            var c = double.Parse(x[2]) * Math.PI / 180;;
            Console.Write("{0}\n{1}\n{2}\n",
            a * b * Math.Sin(c) / 2,
            a + b + Math.Sqrt(a * a + b * b - 2 * a * b * Math.Cos(c)),
            b * Math.Sin(c));
        }
    }
}

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

int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int min=arr[0],sum=0;
    
     for(int i=0;i<n;i++){
         if(arr[i]<min){
             min=arr[i];
             sum++;
             }
         }
    cout<<sum+1;;
}

Measured memory_bytes: 1024