akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		int x = Integer.parseInt(sc.next());

		// 出力
		if (x <= 599) {
			System.out.println(8);
			return;
		}
		if (x <= 799) {
			System.out.println(7);
			return;
		}
		if (x <= 999) {
			System.out.println(6);
			return;
		}
		if (x <= 1199) {
			System.out.println(5);
			return;
		}
		if (x <= 1399) {
			System.out.println(4);
			return;
		}
		if (x <= 1599) {
			System.out.println(3);
			return;
		}
		if (x <= 1799) {
			System.out.println(2);
			return;
		}
		if (x <= 1999) {
			System.out.println(1);
			return;
		}
	}

}


Measured memory_bytes: 35528
N = int(input())
ans = [0 for _ in range(10050)]

for i in range(1, 105):
  for j in range(1, 105):
    for k in range(1, 105):
      v = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if v<10050:
        ans[v] += 1
for i in range(N):
  print(ans[i+1])

Measured memory_bytes: 74224
N,C=[int(i) for i in input().split()]
D=[[int(j) for j in input().split()] for i in range(C)]
c=[[int(j)-1 for j in input().split()] for i in range(N)]#0-indexed

cate=[[0 for j in range(C)] for i in range(3)]#category divide
for i in range(N):
    for j in range(N):
        cate[(i+j)%3][c[i][j]]+=1
score = 9999999999#answer

#O(30 Comb 3)≒5*10^3
for c1 in range(C):
    for c2 in range(C):
        for c3 in range(C):
            if c1==c2 or c2==c3 or c3==c1:
                continue
            nowsc = 0
            cset = [c1,c2,c3]
            #O(3*C)=90 →4.5*10^5
            for i in range(3):
                for j in range(C):
                    num = cate[i][j]
                    nowsc += D[j][cset[i]]*num
            score=min(score,nowsc)
print(score)


Measured memory_bytes: 5492
K, N = map(int, input().split())
A = list(map(int, input().split()))
maxDis = 0
for x in range(len(A)):
    if x != len(A) - 1:
        maxDis = max(maxDis, A[x + 1] - A[x])
    else:
        maxDis = max(maxDis, A[0] - A[x] + K)
print(K - maxDis)


Measured memory_bytes: 77388
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

#define itr(itr, map) for (auto itr = map.begin(); itr != map.end(); ++itr)
#define out(x) cout<<(x)
#define outl(x) cout<<(x)<<endl

int main() {
    
    lint N, A, B, C, D, E, mi;
    cin >> N>>A>>B>>C>>D>>E;
    lint t=0;
    mi = min(A,min(B,min(C,min(D,E))));
    cout << ((N+mi-1)/mi)+4 << endl;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio 
    int x , y , z ; 
    cin >> x >> y >> z ; 
    cout << z << ' ' << x << ' ' << y << endl;
    return 0 ; 
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
 int N;
 cin>>N;
 int ans=100000;
  
 for(int i=0;i<N;i++){
  int a[i];
  cin>>a[i];
  int cnt=0;
   
  while(a[i]%2==0){
   a[i]/=2;
   cnt++;
  }
  ans=min({ans,cnt});
 }
 cout<<ans<<endl;
}

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


long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;
const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int N,bool visited[nmax]){

    bool all_visited=true;

    for(int i=0;i<N;++i){
        if(visited[i]==false)
            all_visited=false;
    }
    
    if(all_visited){
        return 1;
    }

    int ret=0;

    for(int i=0;i<N;++i){
        //頂点vに隣接しているかつ未訪問ならdo
        if(graph[v][i]==false)continue;
        if(visited[i])continue;

        visited[i]=true;
        ret+=dfs(i,N,visited);//頂点iスタートで再帰
        visited[i]=false;
    }

    return ret;

}

int main(){

int N,M;
cin>>N>>M;
int a,b;
for(int i=0;i<M;i++){
cin>>a>>b;
a--;
b--;
graph[a][b]=true;
graph[b][a]=true;
}

bool visited[nmax];

for(int i=0;i<N;++i){
    visited[i]=false;
}

visited[0]=true;
cout<<dfs(0,N,visited)<<endl;

 return 0;
}

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

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> L;
    for (int i = 0; i < 2 * N; ++i)
    {
        int temp;
        cin >> temp;
        L.push_back(temp);
    }
    int ans = 0;
    sort(L.begin(), L.end());

    for (int i = 0; i < 2 * N; ++i)
    {
        ans += min(L[i], L[i + 1]);
        ++i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
s1 = input()
s2 = input()
sum = 1
mul = 1
flag = 0
i = 0

while True:
    if i >= N:
        print(sum%1000000007)
        break

    elif s1[i]==s2[i] and flag==0:
        sum = 3
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==0:
        sum = 6
        i += 2
        flag = 2
    elif s1[i]==s2[i] and flag==1:
        mul = 2
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==1:
        mul = 2
        i += 2
        flag = 2
    elif s1[i]==s2[i] and flag==2:
        mul = 1
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==2:
        mul = 3
        i += 2
        flag = 2
    sum = sum*mul


Measured memory_bytes: 3064
/*Shivam Bhalla */
/* f2016941@pilani.bits-pilani.ac.in */

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iostream>
#include <string>
#include <cmath>
#include <cassert>
#include <bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
long long maxv = 1e9;

int main(){
	int N,L;
	cin>>N>>L;
	int old_total=((2*L + (N-1))*N)/2;
	int new_total;
	int final_total;
	int diff=10000;
	for(int i=L;i<(L+N);i++){
		new_total=old_total-i;
		if(abs(old_total-new_total)<diff){
			final_total=new_total;
			diff=abs(old_total-new_total);
		}
	}
	cout<<final_total;
	return 0;
}


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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  int n,q;cin>>n>>q;
  vector<int> a(n), o(n), e(n);
  rep(i, n) {
    cin>>a[i];
    if (i%2==0) e[i]=a[i];
    else o[i]=a[i];
  }
  vi aa(a);
  rep(i, 1, n) {
    e[i] += e[i-1];
    o[i] += o[i-1];
    aa[i] += aa[i-1];
  }
  dump(a);
  dump(e);
  dump(o);
  dump(aa);

  rep(i, q){
    cerrendl;
    int x;cin>>x;
    int left = 0;
    int right = n-1;
    auto isright = [&](int i) {
      if (x>=a[i]) return false;

      int d = a[i]-x;
      int c1 = ub(all(a), x+d) - lb(all(a), x-d);
      int c2 = n-i;
      bool ans = (c1>=c2 ? true : false);
      dump(i, x, d, c1, c2, ans);
      return ans;
    };
    while (right-left>1){
      int mid = (right+left)/2;
      if (isright(mid)) { right = mid;}
      else{ left = mid; }
    }
    dump(i, x, right);

    int ans = 0;
    ans += aa[n-1];
    ans -= aa[right-1];
    dump(ans);
    int j = right - (n-right+1);

    if (j>=0){
      ans += (j%2==0 ? e[j] : o[j]);
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 4864
#include <stdio.h>

int maxArray;
int sortTimes = 0;

void bubbleSort(int *numericArray)
{
    int count, currentReference, temporaryValue;
    for (count = 0; count < maxArray; count++) {
        for(currentReference = maxArray - 1; currentReference > count; currentReference--) {
            if (numericArray[currentReference] < numericArray[currentReference - 1]) {
                temporaryValue = numericArray[currentReference];
                numericArray[currentReference] = numericArray[currentReference - 1];
                numericArray[currentReference - 1] = temporaryValue;
                sortTimes++;
            }
        }
    }
}

void printOut(int *numericArray)
{
    int count;

    printf("%d", numericArray[0]);
    for (count = 1; count < maxArray; count++) {
        printf(" %d", numericArray[count]);
    }
    printf("\n%d\n",sortTimes);
}

int main(void)
{
    int count;

    scanf("%d", &maxArray);
    int numericArray[maxArray];

    for (count = 0; count < maxArray; count++) {
        scanf("%d", &numericArray[count]);
    }

    bubbleSort(numericArray);
    printOut(numericArray);

    return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 303;

int n;
int cnt[4];
ld dp[N][N][N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    cnt[a]++;
  }
  for (int k = 0; k <= n; k++) {
    for (int j = 0; j <= n; j++) {
      for (int i = 0; i <= n; i++) {
        if (!i && !j && !k) continue;
        ld e = n-i-j-k;
        ld add = (n - e) / (n * (1 - e/n) * (1 - e/n)) - 1;
        //cerr << i << " " << j << " " << k << " -> " << add << nl;
        if (i) {
          ld p = (ld) i / (i + j + k);
          dp[i][j][k] += p * (dp[i-1][j][k] + 1);
        }
        if (j) {
          ld p = (ld) j / (i + j + k);
          dp[i][j][k] += p * (dp[i+1][j-1][k] + 1);
        }
        if (k) {
          ld p = (ld) k / (i + j + k);
          dp[i][j][k] += p * (dp[i][j+1][k-1] + 1);
        }
        dp[i][j][k] += add;
      }
    }
  }
  cout << fixed << setprecision(10) << dp[cnt[1]][cnt[2]][cnt[3]] << nl;
  return 0;
}


Measured memory_bytes: 432512
#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    long int bar[100];
    long int bar_long, bar_mid, bar_short;
    long int bar_long_temp, bar_mid_temp;
    int rect=0;
    int i, j, k;
    
    scanf("%d", &n);
    //printf("%d ", n);
    if((n<1) || (n>100)){
        printf("incorrect number:N\n");
        return -1;
    }

    for(i=0;i<n;i++){
        scanf("%ld", &bar[i]);
        //printf("%ld ", bar[i]);
        if((bar[i]<1) || (bar[i]>1000000000)){
            printf("incorrect number:L(%d)\n", i+1);
            return -1;
        }
    }

    bar_long=0;
    bar_mid=0;
    bar_short=0;
    for(i=0;i<n-2;i++){
        bar_long = bar[i];
        for(j=i+1;j<n-1;j++){
            bar_long = bar[i];
            bar_mid = 0;
            if(bar[j] > bar_long){
                bar_mid = bar_long;
                bar_long = bar[j];
            }
            else if(bar[j] > bar_mid){
                bar_mid = bar[j];
            }
            bar_long_temp = bar_long;
            bar_mid_temp = bar_mid;
            for(k=j+1;k<n;k++){
                bar_long = bar_long_temp;
                bar_mid = bar_mid_temp;
                bar_short = 0;
                if(bar[k] > bar_long){
                    bar_short = bar_mid;
                    bar_mid = bar_long;
                    bar_long = bar[k];
                }
                else if(bar[k] > bar_mid){
                    bar_short = bar_mid;
                    bar_mid = bar[k];
                }
                else if(bar[k] > bar_short){
                    bar_short = bar[k];
                }
                
                if(((bar_long > 0) && (bar_mid > 0) && (bar_short > 0)) && ((bar_long != bar_mid) && (bar_mid != bar_short) && (bar_short != bar_long))){
                    if(bar_long < bar_mid+bar_short){
                        //printf("%d %d %d %ld %ld %ld\n", i+1, j+1, k+1, bar_long, bar_mid, bar_short);
                        rect++;
                    }
                }
            }
        }
    }

    
    printf("%d\n", rect);
    
    return 0;
    
}


Measured memory_bytes: 1728
import java.util.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    String answer = "YES";

    if (a > c || a + b < c) {
      answer = "NO";
    }

    System.out.println(answer);
  }
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
using i64 = long long;

bool query(int n) {
    std::string res;
    std::cout << n << std::endl;
    fflush(stdout);
    std::cin >> res;
    if (res == "Vacant") exit(0);
    if (res == "Male") return false;
    else return true;
}

int main() {
    int n;
    std::cin >> n;
    bool m = query(0);
    int l = 0, r = n;
    while (r - l > 1) {
        int k = (r + l) / 2;
        bool res = query(k);
        if (res == (m ^ (k % 2))) l = k;
        else r = k;
    }

    return 0;
}

Measured memory_bytes: 852
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for y in range(N - M + 1):
    for x in range(N - M + 1):
        matched = True
        for yy in range(y, y + M):
            for xx in range(x, x + M):
                if A[yy][xx] != B[yy - y][xx - x]:
                    matched = False
                if not matched:
                    break
            if not matched:
                break
        if matched:
            print('Yes')
            exit(0)
print('No')


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

			return 0;
}

Measured memory_bytes: 1812
import math
A, B = map(int, input().split())
taxA = A / 8 * 100
taxB = B * 10
judge = True
litaxB = [taxB + i for i in range(10)]
if taxA - int(taxA) < 0.5:
    litaxA = [int(taxA) + j for j in range(13)]
else:
    litaxA = [int(taxA) + 1 + j for j in range(12)]
for k in litaxA:
    if k in litaxB:
        print(k)
        judge = False
        break
if judge == True:
    print(-1)

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    v[i] = abs(a-x);
  }

  int ans =v[0];
  for(int i = 1; i < n; i++){
    ans = __gcd(ans, v[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
t = {}
for i = 1, 5 do table.insert(t, io.read("*n")) end
table.sort(t, function(a, b)
        ad = a % 10
        bd = b % 10
        if(ad == 0) then ad = 10 end
        if(bd == 0) then bd = 10 end
        return ad > bd
    end
);
sum = 0
for i = 1, 4 do
    if(t[i] % 10 == 0) then sum = sum + t[i] else
        sum = sum + 10 * (1 + math.floor(t[i] / 10))
    end
end
sum = sum + t[5]
print(sum)

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

ans = 0

l = 0
r = 0
s = 0
while l <= N-1 and r <= N-1:
    if s + A[r] == s ^ A[r]:
        s += A[r]
        ans += r-l+1
        r += 1
    else:
        s -= A[l]
        l += 1
            

print(ans)

Measured memory_bytes: 24840
#include <bits/stdc++.h>
using namespace std;
main () {
	int a,b;
	cin>>a>>b;
	
	if (a>b) swap(a,b);
	if (a==1 && b==2) cout<<3<<endl;
		else
	if (a==1 && b==3) cout<<2<<endl;
		else cout<<1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define SFOR(i,a,b) for(int i=a;i<b;i++)
#define elif(a) else if(a)
#define INF INT_MAX
#define F first
#define S second
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x,n,m,ans=0,mim=1001;
  cin>>n>>x;
  int cnt=n;
  FOR(i,n){
    cin>>m;
    mim=min(m,mim);
    ans+=m;
  }

  cout<<cnt+(x-ans)/mim<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    int x1,y1,x2,y2;
    cin >> x1>>y1>>x2>>y2;
    int a,b;
    a = x2-x1;
    b = y2-y1;
    int x3,y3,x4,y4;
    x3 = x2-b;
    y3 = y2+a;
    x4 = x1-b;
    y4 = y1+a;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 <<endl;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
		ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,val;
    cin>>n;
    vector<ll> count(n+1,0);
    for(int i=0;i<n-1;i++){
				cin>>val;
				count[val]++;
		}
		for(int i=1;i<=n;i++)
			cout<<count[i]<<"\n";
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    string S;
    cin>>S;
    string T="CODEFESTIVAL2016";
    int count=0;
    for(int i=0;i<S.size();i++){
     if(S.at(i)!=T.at(i)){count++;}
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
l = []

for i in range(1,n+1):
    i_1 = 0
    while True:
        if i >= k:
            l.append(i_1)
            break
        i*= 2
        i_1 += 1

lis = [(1/n) * (1/2)**i for i in l]

print(sum(lis))

Measured memory_bytes: 7064
public class Main {


  private static void solve() {
    int a = ni();
    int b = ni();
    int t = ni();
    
    System.out.println(t / a * b);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 21204
import java.util.*;
public class Main {
    static final long MODVAL = 998244353L;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int A[] = new int[N];
        int total = 0;
        for(int i=0; i<N; i++) {
            A[i] = sc.nextInt();
            total+=A[i];
        }
        int threshold = 4 * M * total;
        int okcount = 0;
        for(int i=0; i<N; i++) {
            if(total <= 4 * M * A[i]) okcount++;
        }
        System.out.println(okcount>=M ? "Yes" : "No");
    }
}


Measured memory_bytes: 24148
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    double A,B,X;cin >> A >> B >> X;
    X /= A;
    double H;
    if(X <= A*B/2){
        A = X*2 / B;
        H = atan2(A,B);
        H = H * 180.0 / 3.14159265;
        cout << fixed << setprecision(7) << 90-H << endl;
        return 0;
    }
    else{
        X = A*B - X;
        H = 2*X / A;
        H = atan2(A,H);
        H = H * 180.0 / 3.14159265;
        cout << fixed << setprecision(7) << 90-H << endl;
        return 0;
    }
}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define SUM(v) accumulate((v).begin(),(v).end(),0ll)
#define range(i,left,right) (left<=i && i<right)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int iscount(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    
    double theta=min(abs(30.0*h+0.5*m-6.0*m),360.0-abs(30.0*h+0.5*m-6.0*m));
    double c2 = a*a+b*b-2*a*b*cos(PI*theta/180.0);
    cout<<sqrt(c2)<<endl;

    return 0;
}

Measured memory_bytes: 4252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

mint c(ll n, ll k) {
  mint md = 1;
  mint me = 1;
  rep(i, k) {
    md *= (n - i);
    me *= (k - i);
  }
  md *= me.inv();
  return md;
}

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  mint ans(0);
  mint mb(m - 1);
  mint mbpow = mb.pow(n - k - 1);
  mint ccc = c(n - 1, k);
  rep(i, k + 1) {
    mint ma(m);
    ma *= mbpow;
    ma *= ccc;
    ans += ma;
    mbpow *= mb;
    ccc *= k - i;
    ccc /= (n - k + i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
n,k=map(int,input().split())
s,p,r=map(int,input().split())
t=input()
u=[0]*k
tt=[[p,r,s][(x=='r')+2*(x=='s')] for x in t]
ans=0
for i in range(n):
  if u[i%k]==0:
    ans+=tt[i]
    u[i%k]=1
  else:
    if not t[i]==t[i-k]:
      ans+=tt[i]
    else:
      u[i%k]=0
print(ans)

Measured memory_bytes: 4724
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pb push_back

using namespace std;

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        string s;
        cin>>s;
        if(s[2]==s[3] && s[4]==s[5]){
            cout<<"Yes"<<endl;
        }      
        else{
            cout<<"No"<<endl;
        }
    }
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int INF=1e8;
int dist[15][15];

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  while(cin>>n,n){

    //??\????????£??\???????????¢?????????
    fill(dist[0],dist[0]+15*15,INF);
    int m=0,a,b,d;
    rep(i,n){
      cin>>a>>b>>d;
      dist[a][b]=dist[b][a]=min(dist[a][b],d);
      m=max({m,a,b});
    }
    ++m;

    rep(i,m) dist[i][i]=0; //i??????i????????¢???0
    //???????????£???????????????
    rep(k,m) rep(i,m) rep(j,m)
      dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);

    //(?????¢?????????,????????????)
    pii re=pii(INF,-1);
    rep(i,m){

      int sum=0; //??????????¨????
      rep(j,m) sum+=dist[i][j];

      //????°??????´??°
      re=min(re,pii(sum,i));
    }
    cout<<re.Y<<" "<<re.X<<endl;
  }
  return 0;
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);
    ll m,k; cin>>m>>k;

    if(k==0){
        rep(i,(1ll<<m)){
            cout<<i<<" "<<i<<" ";
        }
        cout<<endl;
        return 0;
    }

    ll s = 0;
    rep(i,(1ll<<m)){
        if(i==k) continue;
        s = s^i;
    }

    if(s == k){
        vint ans;
        rep(i,(1ll<<m)){
            if(i==k) continue;
            ans.push_back(i);
        }
        ans.push_back(k);
        repr(i,(1ll<<m)){
            if(i==k) continue;
            ans.push_back(i);
        }
        ans.push_back(k);

        printv(ans);

    }else{
        cout<<-1<<endl;
    }


    return 0;

}

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf LLONG_MAX

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    

    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll a,b,c,k;
        cin>>a>>b>>c>>k;
        
        if(k<=a)
        cout<<k;
        else
        {
            if(k<=a+b)
            cout<<a;
            else
            {
                k-=a;
                k-=b;
                
                cout<<a-k;
                
            }
        }
    }
}














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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define debugs(s) cerr << s << "\n"
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mk(x,y) make_pair((x),(y))

// http://ehafib.hatenablog.com/entry/2015/12/23/164137
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qpm(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define sz(v) int(v.size())

// x1, x2ライブラリとの被りを避ける
#define x1 x192837465
#define x2 x123456789
#define y1 y192837465
#define y2 y123456789

// typo
#define itn int
#define reutrn return
#define reutnr return

#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

int nlcm(vector<int> numbers) {
    int res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}


signed main() {
    make(int, N);

    vector<int> Ts(N);
    REP(i, N) {
        make(int, T);
        Ts.at(i) = T;
    }

    int ans = nlcm(Ts);
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <math.h>
#define PI 3.141592
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  double x,y,ca,a,l;
  x = 0; y = 0; ca = PI / 2;
  char c;
  while (true) {
    cin >> l >> c >> a; // 進む距離と回転角度
    if (l == 0 && a == 0) break;

    x += l * cos(ca);
    y += l * sin(ca);

    ca -= a * PI / 180.0;
  }

  cout << (int) x << endl;
  cout << (int) y << endl;
}

Measured memory_bytes: 1228
#include<iostream>
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;


int main(){
    int H, W, N;
    map<pair<int, int>, int> rect;

    cin >> H >> W >> N;
    for(int n = 0; n < N; n++){
        int a, b;
        scanf("%d %d", &a, &b);
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(a-i >= 1 && a-i <= H-2 && b-j >= 1 && b-j <= W-2){
                    //printf(":::::%d, %d\n", a-i, b-j);
                    rect[make_pair(a-i, b-j)]++;
                }
            }
        }
    }
    long long res[10] = {};
    res[0] = (1ll)*(H-2)*(W-2);
    for(map<pair<int, int>, int>::iterator i = rect.begin(); i != rect.end(); i++){
        //printf("(x, y) = (%d, %d), cnt = %d\n", i->first.first, i->first.second, i->second);
        res[i->second]++;
        res[0]--;
    }
    for(int i = 0; i < 10; i++){
        cout << res[i] << endl;
    }
    return 0;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			Console.WriteLine((n - 1) / 2);
		}
	}



	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 13140
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=10005;
int ses[M];
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,105)
    {
        f(j,1,105)
        {
            f(k,1,105)
            {
                int x=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
                if(x<M)
                ses[x]++;
            }
        }
    }
    f(i,1,n)
    {
        cout<<ses[i]<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, p;
    string s;
    cin>>n>>p;
    cin>>s;
    ll ans = 0;
    if(p == 2) {
        for(int i=0; i<n; ++i) {
            if((s[i]-'0')%2 == 0)
                ans += i+1;
        }
    }
    else if(p == 5) {
        for(int i=0; i<n; ++i) {
            if((s[i]-'0')%5 == 0)
                ans += i+1;
        }
    }
    else {
        vector<ll> r(n);
        ll curr = 0;
        ll x = 1;
        vector<ll>cnt(p, 0);
        for(int i=n-1; i>=0; --i) {
            curr += (s[i]-'0')*x;
            curr %= p;
            x *= 10;
            x %= p;
            r[i] = curr;
            cnt[r[i]]++;
        }
        // for(int i=0; i<n; ++i)
        //     cout<<r[i]<<" ";
        // cout<<endl;
        for(int i=0; i<p; ++i)
            ans += cnt[i] * (cnt[i]-1) / 2;
        ans += cnt[0];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2196
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int n;
	long long int m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		}
		long long int b;
		vector<long long int> ss;
		ss.push_back(0);
		for (int i = 0; i < n; i++) {
			cin >> b;
			if (b <= m) {
				ss.push_back(b);
			}
		}
		vector<long long int> ss2;
		for (long long int i = 0; i < ss.size(); i++) {
			ss2.push_back(ss[i]);
			for (long long int j = i; j < ss.size(); j++) {
				if (ss[i]+ss[j] <= m) {
					ss2.push_back(ss[i]+ss[j]);
				}
			}
		}
		sort(ss2.begin(), ss2.end());
		/*for (long long int i = 0; i < ss2.size(); i++) {
			cout << ss2[i] << endl;
		}*/
		long long int MAX = 0;
		long long int sz = ss2.size();
		for (long long int j = 0; j < sz; j++) {
			long long int a = m;
			for (long long int i = 0; i < 2; i++) {
				vector<long long int>::iterator ite = upper_bound(ss2.begin(), ss2.end(), a);
				if (ite != ss.begin()) {
					ite--;
					a -= *(ite);
				}
			}
			vector<long long int>::iterator ite2 = ss2.end();
			ss2.erase(ite2-1);
			MAX = max(MAX, m-a);
		}
		cout << MAX << endl;
	}
	return 0;
}

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

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

	long long x = min(k, a); k -= x;
	long long y = min(k, b); k -= y;
	long long z = min(k, c); k -= z;
	
	cout << (x - z) << endl;

	return 0;
}

Measured memory_bytes: 3640
PI = 3.14159265358979323846

a,b,x = gets.split.map(&:to_f)

s = x / a
ans = 0
if s > b * a / 2
  bu = 2 * s / a - b
  s -= a * bu
  b -= bu
else
  a = 2 * s / b
end
r = Math.atan(b/a)
ans = r * (180.0/PI)

puts ans

Measured memory_bytes: 1788
n=int(raw_input())
A=[]
for i in range(n):
    A.append(int(raw_input()))

t=min(4,n)
A=[str(x) for x in sorted(A)[:t]]
B=[]
for i in range(t):
    for j in range(i+1,t):
        B.append(int(A[i]+A[j]))
        B.append(int(A[j]+A[i]))
B.sort()
print B[2]

Measured memory_bytes: 6836
// Problem : B - Frog 2
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
#define inf 1e9
using namespace std;
ll mincost(vl v,ll n,ll k)
{
	vl dp(n);
	dp[0]=0;
	fr(i,1,n)
	{
		ll ct=i,ck=k,x=inf;
		while(ct>0 && ck>0)
		{
			x=min(x,abs(v[ct-1]-v[i])+dp[ct-1]);
			ct--;
			ck--;
		}
		dp[i]=x;
	}
	return dp[n-1];
}
int main()
{
fast;
ll n,k;cin>>n>>k;
vl v(n);
fr(i,0,n) cin>>v[i];
cout<<mincost(v,n,k);
return 0;
}

Measured memory_bytes: 5568