akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    fast;
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      string s;
      cin>>s;
      int cntr=0;
      for(int i=0;i<n;i++)
      {
        if(s[i]=='R')
        {
          cntr++;
        }
      }
      int c=0;
      for(int i=0;i<cntr;i++)
      {
        if(s[i]=='R')
        {
          c++;
        }
      }
      int ans=min(cntr,(n-cntr));
      ans=min(ans,cntr-c);
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 3772
import java.util.Scanner;
public class Main{
  public static void main (String args[]){
	Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int sum = a + b + c;
    if(sum>= 22){
      System.out.println("bust");
         }else{
          System.out.println("win"); 
         }
                       
  }
}

Measured memory_bytes: 22228
#include<iostream>


using namespace std;



int main(){
  	int N;

  	cin >> N;
	int V[N];
  	int C[N];
	for(int i = 0; i < N ; i++)cin >> V[i];
  	
  	for(int i = 0; i < N ; i++)cin >> C[i];
  	
  	int ans = 0;
  	for(int i = 0 ; i< N ;i ++){
      	if(V[i]-C[i]>0){
          	ans += V[i]-C[i];
        }
    }
  	cout << ans << endl;
  	
}


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

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<string, int>

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    int n;
    cin >> n;
    pair<P, int> p[n];
    rep(i, n){
        int s;
        cin >> p[i].first.first >> s;
        p[i].first.second = -s;
        p[i].second = i + 1;
    }
    sort(p, p + n);
    rep(i, n){
        cout << p[i].second << endl;
    }
}

Measured memory_bytes: 3588
S = str(input())
h = [int(x) for x in list(S)]
N = len(h)
a = [0] * 2019
a[0] = 1
T = 0
r = 1
c = 0
for i in range(N-1, -1, -1):
    T = (T + h[i] * r) % 2019
    r = r * 10
    r = r % 2019
    c += a[T]
    a[T] += 1
print(c)

Measured memory_bytes: 12372
sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char f[10];
char buf[2200000];
sz;
main()
{
	read(0,buf,100000);
	for(;;)
	{
		k=buf[sz++];
		if(sz==100000)read(sz=0,buf,100000);
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(sz==100000)read(sz=0,buf,100000);
			if(k<'0')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		if(!cnt[i])
		{
			buf[sz++]='0';
		}
		else
		{
			if(cnt[i-1]!=cnt[i])
			{
				k=0;
				t=cnt[i];
				while(t)
				{
					f[k++]=t%10;
					t/=10;
				}
				acc=k;
			}
			else k=acc;
			while(k--)buf[sz++]=f[k]+'0';
		}
		buf[sz++]='\n';
	}
	write(1,buf,sz);
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

ll h[100111],c[100111];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll n,k; cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> h[i];
		c[i] = 1e9;
	}
	
	c[1] = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= k; j++){
			if(i+j<=n)c[i+j] = min(c[i+j],c[i]+abs(h[i+j]-h[i]));
			else break;
		}
	}
	cout << c[n] << endl;
}	


Measured memory_bytes: 1792
#include <stdio.h>
int main() {    
    int a,b,c,d;    
    scanf("%d",&a);    
    scanf("%d",&b);    
    scanf("%d",&c);    
    scanf("%d",&d);    
    if(a*b < c*d) {    
        printf("%d",c*d);    
    }else{    
        printf("%d", a*b);    
    }    
}    


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main(void) {

	int k, x,max,min, i;

	scanf("%d%d",&k, &x);

	max = x + (k - 1);
	min = x - (k - 1);

	if(max > 1000000){
		for(i =min; i <1000001;i++){
			printf("%d ", i);
		}
	}else if(min < -1000000){
		for(i =-1000000; i <(max+1);i++){
			printf("%d ", i);
		}
	}else{
		for(i =min; i <(max+1);i++){
			printf("%d ", i);
		}

	}


	return EXIT_SUCCESS;
}

Measured memory_bytes: 128
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- 整数の入力
    x <- readLn
    -- 出力
    putStrLn . show $ solve x

solve x
    | m == 0 = 2 * d
    | m <= 6 = 2 * d + 1
    |otherwise = 2 * d + 2
    where m = mod x 11
          d = div x 11


Measured memory_bytes: 508
// https://betrue12.hateblo.jp/entry/2018/12/30/215006

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	DIR_LEFT  = 0
	DIR_RIGHT = 1
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	l := scanInt(sc)
	n := scanInt(sc)

	// 家から左回りでの距離
	xs := make([]int, n+1)

	// 家から右回りでの距離
	ys := make([]int, n+1)

	for i := 1; i <= n; i++ {
		xs[i] = scanInt(sc)
		ys[n+1-i] = l - xs[i]
	}

	// それぞれの累積和
	cxs := make([]int, n+1)
	cys := make([]int, n+1)

	for i := 1; i <= n; i++ {
		cxs[i] = cxs[i-1] + xs[i]
		cys[i] = cys[i-1] + ys[i]
	}

	dirs := []int{DIR_LEFT, DIR_RIGHT}

	maxDist := 0
	for xt := 0; xt <= n; xt++ {
		yt := n - xt

		for _, startDir := range dirs {
			for _, endDir := range dirs {
				xm, ym := countMoves(startDir, endDir, xt, yt)
				if xm < 0 || ym < 0 {
					continue
				}

				var oneWay int
				if endDir == DIR_LEFT {
					oneWay = xs[xt]
				} else {
					oneWay = ys[yt]
				}

				roundTrips := (cxs[xt]-cxs[xt-xm])*2 + (cys[yt]-cys[yt-ym])*2
				dist := roundTrips - oneWay
				if dist > maxDist {
					maxDist = dist
				}
			}
		}
	}

	fmt.Println(maxDist)
}

func countMoves(startDir, endDir int, xt, yt int) (xm int, ym int) {
	switch startDir {
	case DIR_LEFT:
		switch endDir {
		case DIR_LEFT:
			// L,R,L,...,L
			xm = min(xt, yt+1)
			ym = min(xt-1, yt)
			return xm, ym

		case DIR_RIGHT:
			// L,R,L,...,R
			m := min(xt, yt)
			return m, m
		}
	case DIR_RIGHT:
		switch endDir {
		case DIR_LEFT:
			// R,L,R,...,L
			m := min(xt, yt)
			return m, m

		case DIR_RIGHT:
			// R,L,R,...,R
			xm = min(xt, yt-1)
			ym = min(xt+1, yt)
			return xm, ym
		}
	}

	panic("unreachable")
}

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

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define ll long long
using namespace std;
const int inf=1e9;
const int mod=1e9+7;
const int maxn=1e5+10;
int n;
int a[20][20],b[20],A[20];
int main(){
    //ios::sync_with_stdio(false);
    //freopen("in","r",stdin);
    cin>>n;
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j]=-1;
    for(int i=0,x;i<n;i++){
        scanf("%d",&x);
        for(int j=0,k,l;j<x;j++){
            scanf("%d%d",&k,&l);
            a[i][k-1]=l;
        }
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<n;j++) if((i>>j)&1){
            b[j]=1;
        }else b[j]=0;
        int flag=1;
        for(int j=0;j<n&&flag;j++) if((i>>j)&1){
            for(int k=0;k<n&&flag;k++){
                if(a[j][k]!=-1&&b[k]!=a[j][k]){
                    flag=0;
                }
            }
        }
        if(flag){
                ans=max(ans,__builtin_popcount(i));
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int N, M, A[11][11], cnt[20000];

int main()
{
	scanf ("%d %d", &N, &M);
	for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) scanf ("%d", &A[i][j]);
	for (int i = 0; i < N; i++) for (int j = i + 1; j < N; j++){
		int s = 0;
		for (int k = 0; k < M; k++) s += (A[i][k] - A[j][k]) * (A[i][k] - A[j][k]);
		cnt[s]++;
	}

	int ans = 0;
	for (int i = 0; i <= 140; i++) ans += cnt[i*i];
	printf ("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e5+10,mod=1e9+7,inf=1e9+10;
int check(int x)
{
	int ans=0;
	while(x!=0)ans+=x%10,x/=10;
	return ans;
}
int32_t main()
{
	int n;
	cin>>n;
	int	ans=inf;
	for(int i=1;i<n;i++)
	{
		ans=min(ans,check(i)+check(n-i));
	}	
	cout<<ans;
}



Measured memory_bytes: 256
#include  <algorithm>
#include  <iomanip>
#include  <iostream>
#include  <climits>
#include  <cstdlib>
#include  <cstring>
#include  <cmath>
#include  <cstdio>
#include  <unordered_map>
#include  <map>
#include  <set>
#include  <stack>
#include  <string>
#include  <vector>
#include  <queue>

using namespace :: std;

using vpll = vector <pair <long long, long long> >;
using pll = pair <long long, long long>;
using vll = vector <long long>;

#define printr(x, n) cerr << '\n' << "elements of x are:\n"; for (int i = 1; i <= n; i++) cerr << x[i] << ' '; cerr << '\n';
#define print(x) cerr << '\n' << #x << " equals to " << x << '\n';
#define IOFrom(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);
#define int long long int
#define N (int) (2e6 + 7)
#define W (int) (5e3 + 7)
#define M (int) (1e9 + 7)
#define INF (int) (2e18)
#define F first
#define S second

int ans, cur, cnt, ind, sum, mn = INF, mx = -INF;
int n, m, k, s, q, t, a, b, c, d, e;
int ar[N], p[N], dp[N], pre[N], suf[N];
pair <int, int> P[N];
bool flag, h[N];
vector <int> v;
string str;
map <int, int> mp;

int32_t main (int32_t argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);

  // IOFrom("../in.txt", "../out.txt");

  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];  
    pre[i] = (pre[i - 1] + ar[i]) % k;
  }
  mp.insert({0, 1});
  for (int i = 1; i <= n; i++) {
    if(i >= k)
      mp[((i - k) - pre[i - k] + k) % k]--;
    ans += mp[(i - pre[i] + k) % k];
    mp[(i - pre[i] + k) % k]++;
  }
  cout << ans; 
}

Measured memory_bytes: 20992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,m,a,b,ans=0,k=0;
  pair<ll,ll> p[100010];
  cin>>n>>m;
  fr(i,n){cin>>a>>b;p[i]=make_pair(a,b);}
  sort(p,p+n);
  fr(i,n){
    if(k+p[i].second>=m){
      ans+=p[i].first*(m-k);
      break;
    }
    k+=p[i].second;
    ans+=p[i].first*p[i].second;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int m[][]={
				{1,2,1,2,1,4,1,4},
				{1,2,1,4,1,4,1,2},
				{1,4,1,2,1,2,1,4},
				{1,4,1,4,1,2,1,2},
				{2,1,2,1,4,1,4,1},
				{2,1,4,1,4,1,2,1},
				{4,1,2,1,2,1,4,1},
				{4,1,4,1,2,1,2,1},
		};
		while(in.hasNext())
		{
			int a[]=new int[8];
			for(int i=0;i<8;i++)
				a[i]=in.nextInt();
			
			int id=-1;
			int min=Integer.MAX_VALUE;
			for(int i=0;i<8;i++)
			{
				int sam=0;
				for(int j=0;j<8;j++)
				{
					int cnt=m[i][j]-a[j];
					if(cnt>0)
						sam+=cnt;
				}
				if(sam<min)
				{
					min=sam;
					id=i;
				}
			}
			for(int i=0;i<7;i++)
				System.out.print(m[id][i]+" ");
			System.out.println(m[id][7]);
		}
	}

	static public void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

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

int main() {
  int n,k; cin>>n>>k;
  int tmp = 1;
  for (int i = 0; i < n; i++) {
    if (tmp<k) tmp*=2;
    else tmp+=k;
  }
  cout<<tmp<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char S1[11];
  char S2[11];
  char S3[11];
  scanf("%s %s %s",S1,S2,S3);
  printf("%c%c%c",S1[0]-0x20,S2[0]-0x20,S3[0]-0x20);
  return 0;
}


Measured memory_bytes: 256
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif


void solve()
{
	int n,k ;
	cin >> n >> k; 
	vector<int> a(n);
	for(auto &it : a) cin >> it;
	vector<int> dp(k+1,0);
	dp[0] = 0;
	for(int j = 0 ; j < k ; ++j){
		for(int i = 0 ; i < n; ++i){
			if(j + a[i] > k) break ;
			dp[j+a[i]] |= (!dp[j]);
		}
	}
	cout << (dp[k] ? "First": "Second") ; 
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		int num = scanner.nextInt();
		
		scanner.close();
		
		if (num < 5) {
			System.out.println(0);
		} else {
			
			int a = num / 500;
			
			int c = num - (500 * a);
			
			int b = c / 5;
			
			System.out.println((1000 * a) + (5 * b));
		}
		
	}

}


Measured memory_bytes: 22604
################
class UnionFind():
    """
    parents : 親要素(findしない場合は根ではないことの注意)，根の場合は"-(要素数）"
    find(x):要素xの属するグループの根を返す
    size(x):要素xの属するグループの要素数を返す
    same(x,y):x,yが同じグループに属しているか返す
    members(x):要素xが属するグループに属する要素をリストで返す
    roots:全ての根の要素を返す
    group_counte():グループの数を返す
    all_group_members():{根要素：[そのグループに含まれる要素のリスト]}の辞書を返す
    """
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    
################






N,M=map(int,input().split())
p=list(map(int,input().split()))

uf = UnionFind(N)

for i in range(M):
    x,y=map(int,input().split())
    uf.union(x-1,y-1)
    
ans=0
for i in range(N):
    a=i
    b=p[i]-1
    if uf.same(a,b):
        ans+=1
print(ans)
    





Measured memory_bytes: 89196
#include <stdio.h>
#include <algorithm>
using namespace std;
int h[100005];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &h[i]);
    }
    for (int i = n; i >= 1; --i)
    {
        if (h[i] < h[i - 1])
            h[i - 1]--;
    }
    bool ok = true;
    for (int i = 1; i < n; ++i)
    {
        if (h[i] > h[i + 1])
            ok = false;
    }
    if (ok)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 512
I = [int(_) for _ in open(0).read().split()]
H, W = I[:2]
A = I[2:2 + H * W]
B = I[2 + H * W:]
D = [abs(a - b) for a, b in zip(A, B)]
dp = [set([])] + [set([0])] + [set([])] * (W - 1)
for h in range(H):
    dpo = dp
    dp = [set([])] + [None] * W
    for w, d in enumerate(D[W * h:W * (h + 1)]):
        s = dp[w] | dpo[w + 1]
        dp[w + 1] = {v + d for v in s} | {abs(v - d) for v in s}
print(min(dp[-1]))


Measured memory_bytes: 223588
#include <bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<n;i++)
#define MOD 1e9+7
#define EPS 1e-8
#define INF 1e9+10
typedef long long ll;
using namespace std;
int main()
{
    int H,W;
    cin >> H >> W;
    vector<vector<int>>c(10,vector<int>(10,0));
    rep(i,0,10){
        rep(j,0,10){
            cin >> c[i][j];
        }
    }
   rep(k,0,10){
       rep(i,0,10){
           rep(j,0,10){
               c[i][j]=min(c[i][k]+c[k][j],c[i][j]);
           }
       }
   }

    ll ans=0;
    rep(i,0,H){
        rep(j,0,W){
            int A;
            cin >> A;
            if(abs(A)==1){continue;}
            ans+=c[A][1];
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
// luogu-judger-enable-o2
#include<iostream>
#include<algorithm>
using namespace std;
long long n;
long long  a[90];
int miku(long long n){
		a[0]=2;
		a[1]=1;
		if(n>=2){
			for(int i=2;i<=n;i++){
				a[i]=a[i-1]+a[i-2];
			}
		}return a[n];
	}


int main()
{
	cin>>n;
	miku(n);
	cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 384
#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

#[allow(unused_macros)]
macro_rules! trace {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    };
    ($($args:expr),*) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($($args),*), ($($args),*));
    };
}

#[allow(unused_macros)]
macro_rules! swap {
    ($x:expr, $y:expr) => {
        let tmp = x;
        x = y;
        y = tmp;
    };
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut xs = vec![0; n];
    for i in 0..n { xs[i] = sc.cin::<usize>() - 1; }
    let mut ans = 0;
    {
        let mut i = 0;
        while i < n {
            // trace!((i, xs[i]));
            if i == n - 1 {
                if i == xs[i] {
                    ans += 1;
                }
                i += 1;
            } else if i == xs[i] {
                ans += 1;
                i += 2;
            } else {
                i += 1;
            }
        }
    }
    println!("{}", ans);
}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}


Measured memory_bytes: 11508
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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; }

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll n, m, q;
ll res = 0;
vll a(55), b(55), c(55), d(55);
vll A(15);

void dfs(int id, int cur) {
        if (id == n) {
            ll mem = 0;
            REP(i, q) {
                if (A[b[i]] - A[a[i]] == c[i]) mem += d[i];
            }
            chmax(res, mem);
        }
        else {
            // A[id + 1] を [cur, m] から自由に決めることを再帰的に繰り返す
            for (int nxt = cur; nxt <= m; nxt++) {
                A[id + 1] = nxt;
                dfs(id + 1, nxt);
            }
        }
    };

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    cin >> n >> m >> q;
    REP(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--, b[i]--;
    }
    A[0] = 1;
    dfs(0, 1);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std ;
const int N = 1e7 + 4;
void FastInputOutput()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline ll LLD()
{
    ll ret;
    scanf("%lld", &ret);
    return ret;
}
inline int D()
{
    int ret;
    scanf("%d", &ret);
    return ret;
}
void bin( int x )
{
    if(!x)
        return;
    bin( x / 2 );
    cout << x % 2 ;
}
bool checkPrimeNumber(int n)
{
    bool flag = true;
    for(int j = 2 ; j <= n ; ++j)
    {
        if (n % j == 0)
        {
            flag = false;
            break;
        }
    }
    return flag;
}
bool cmp(string last, string first)
{
    if(last.size() < first.size())
        return 1;
    return 0;
}
int calculateDigit(int n)
{
    double temp = (double)(n);
    double a = 0.39908-(0.434294 * n);
    double b = log10( n ) ;
    double c = ( n + 0.5 ) * b ;
    double ans = c - abs( a ) ;
    return ceil(ans) ;
}
int findDigits(int n)
{
    double E = 2.71828182845904523536;
    double PI = 3.141592654;

    if (n < 0)
        return 0;
    if (n <= 1)
        return 1;

    double x = ((n * log10(n / E) +
                 log10(2.0 * PI * n) /
                 2.0));

    return floor(x) + 1;
}
ll fact(ll n)
{
    ll ans = 1 ;
    for(ll i = 1 ; i <= n ; ++i)
        ans *= i ;
    return ans ;
}
unsigned long long Factorial(int n)
{
    const unsigned int M = 1000000007;
    unsigned long long f = 1;
    for (int i = 1; i <= n; i++)
        f = (f*i) % M;

    return f;
}
int a[ N ], b[ N ];
int arr[ N ] , cm[ N ] ;
int n, k ;
int ans , ansL, ansR ;
bool can(int x)
{
    for(int i = 1, j = x ; j <= n ; ++j, ++i)
    {
        if(cm[ j ] - cm[i - 1] + k >= x)
        {
            ansL = i, ansR = j ;
            return true ;
        }
    }
    return false ;
}
int BS(int n)
{
    int low = 0, high = n ;
    while(low < high)
    {
        int mid = (low + high + 1) >> 1 ;
        if(can(mid))
            low = mid ;
        else
            high = mid - 1 ;
    }
    return low ;
}
int main()
{
    FastInputOutput() ;
    cin >> n ;
    for(int i = 0 ; i < n ; ++i)
        cin >> arr[ i ] ;
    sort(arr , arr + n , greater< int >()) ;
    //ll cnt1 = 0 , cnt2 = 0 ;
    for(int i = 0 ; i < n ; i += 2)
        ans += arr[ i ] - arr[i + 1] ;
    cout << ans << endl ;
}


Measured memory_bytes: 2304
#include <iostream>

using namespace std;
using ll = long long;

const int K = 1e5 + 10;
const int mod = 1e9 + 7;

ll dp[K];

ll qmi(int m, int k, int p) {
    ll res = 1 % p, t = m;
    while (k) {
        if (k & 1) res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}

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

    int n, k;
    cin >> n >> k;

    dp[k] = 1;
    for (int i = k; i >= 1; --i) {
        dp[i] = qmi(k / i, n, mod);
        for (int j = 2 * i; j <= k; j += i) {
            dp[i] -= dp[j];
            dp[i] = (dp[i] % mod + mod) % mod;
        }
    }

    ll res = 0;
    for (int i = 1; i <= k; i++) (res += dp[i] * i % mod) %= mod;
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 4420
#include <stdio.h>

int main() {
  int i, j, numdata, swapcount = 0, data[100], tmp, flag;

  scanf("%d",&numdata);

  for(i = 0; i < numdata; i++) {
    scanf("%d",&data[i]);
  }

  flag = 1;
  i = 0;
  while(flag) {
    flag = 0;
    for(j = numdata - 1; j >= i + 1; j--) {
      if(data[j] < data[j-1]) {
	tmp = data[j];
        data[j] = data[j-1];
	data[j-1] = tmp;
	swapcount++;
	flag = 1;
      }
    }
    i++;
  }

  for(i = 0; i < numdata; i++) {
    if(i) printf(" ");
    printf("%d",data[i]);
  }
  printf("\n%d\n",swapcount);
  
  return 0;
}



Measured memory_bytes: 2048
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;

int N, K, vl[3], ans;
string t;
int dp[MAX][3];

int val( char x ) {
    if( x == 'r' ) return 0;
    if( x == 's' ) return 1;
    return 2;
}

// 0 - Rock - 1 - Scissors - 2 - Paper

int res( int a , int b ) {
    if( ! a ) return ( b == 1 ? vl[a] : 0 );  
    if( a == 1 ) return ( b == 2 ? vl[a] : 0 );
    if( a == 2 ) return ( ! b ? vl[a] : 0 );
}


int solve( vector < int > & v ) {
    int T = v.size() - 1;
    
    for( int i = 1; i <= T; i ++ )
        for( int j = 0; j < 3; j ++ ) {
            dp[i][j] = 0;
            int comp = v[i];
            for( int k = 0; k < 3; k ++ )
                if( k != j ) {
                    dp[i][j] = max( dp[i][j] , dp[i - 1][k] + res( j , comp ) );
                }
        }
    return max( dp[T][0] , max( dp[T][1] , dp[T][2] ) );
}



int main()
{
    optimiza_io
    cin >> N >> K;
    cin >> vl[0] >> vl[1] >> vl[2];
    cin >> t;
    for( int i = 0; i < K; i ++ ) {
        vector < int > v;
        v.push_back( 0 );
        for( int j = i; j < N; j += K )
            v.push_back( val( t[j] ) );
        ans = ans + solve( v );
    }
    
    cout << ans << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 2040
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  iota(a.begin(), a.end(), 1);
  do {
    for(int i = 0; i < n; ++i) cout << a[i] << " \n"[i==n-1];
  } while(next_permutation(a.begin(), a.end()));
  return 0;
}



Measured memory_bytes: 3100
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

struct factorial
{
    vector<ll> fac, finv, inv;

    factorial(int n) : fac(2, 1), finv(2, 1), inv(2, 1)
    {
        int i;

        rep(i, 2, n + 1)
        {
            fac.push_back(fac[i - 1] * i % MOD);
            inv.push_back(MOD - inv[MOD % i] * (MOD / i) % MOD);
            finv.push_back(finv[i - 1] * inv[i] % MOD);
        }
    }

    ll comb(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    ll perm(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * finv[n - k] % MOD;
    }
};

int main(void)
{
    ll n;

    cin >> n;

    if (n == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    ll ans = power(10, n) - power(9, n) - power(9, n) + power(8, n);

    ans = (ans + MOD * 10) % MOD;

    cout << ans << endl;
}


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

int f(int x) {
  int ret = 0;
  while (x % 2 == 0) {
    ret += 1;
    x /= 2;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ans += f(x);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    unsigned long long city[5], N;

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

    unsigned long long min_value = 10000000000000001;
    int min_index;
    for(int i=0;i<5;i++){
        if(city[i] < min_value){
            min_value = city[i];
            min_index = i;
        }
    }

    cout << 5 + (N-1) / min_value << endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W = map(int, input().split())
    A = list(list(input()) for _ in range(H))

    res = []
    remove = 0
    for h in range(H):
        for w in range(W):
            if A[h][w] == "#":
                res.append(A[h])
                break
        else:
            remove += 1
    H -= remove

    res2 = [[] for _ in range(H)]
    for w in range(W):
        for h in range(H):
            if res[h][w] == "#":
                for i in range(H):
                    res2[i].append(res[i][w])
                break

    for i in res2:
        print("".join(i))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
char a[100];
int main()
{
	scanf("%s",a);
	if(a[0]=='M')cout<<6;
	if(a[2]=='E')cout<<5;
	if(a[2]=='D')return cout<<4,0;
	if(a[2]=='U')return cout<<3,0;
	if(a[0]=='F')return cout<<2,0;
	if(a[2]=='T')return cout<<1,0;
	if(a[1]=='U'&&a[2]=='N')cout<<7;
	return 0;
}


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

using namespace std;

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

  int sum,sum2;
  for(int i = 0;i < N;++i){
    int h_price,p_price,h_men,p_men;
    cin>>h_price;
    cin>>p_price;
    cin>>h_men;
    cin>>p_men;

    int sum,sum2;
    sum = (h_price * h_men) + (p_price * p_men);

    if(h_men < 5 && p_men < 2){
      sum2 = ((h_price * 0.8) * 5) + ((p_price * 0.8) * 2);
    }
    else if(h_men >= 5 && p_men >= 2){
      sum2 = ((h_price * 0.8) * h_men) + ((p_price * 0.8) * p_men);
    }
    else if(h_men >= 5 && p_men < 2){
      sum2 = ((h_price * 0.8) * h_men) + ((p_price * 0.8) * 2);
    }
    else if(h_men < 5 && p_men >= 2){
      sum2 = ((h_price * 0.8) * 5) + ((p_price * 0.8) * p_men);
    }

    if(sum > sum2){
      cout<<sum2<<endl;
    }
    else{
      cout<<sum<<endl;
    }
  }

  return 0;
}


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

void solve(long long R)
{
    if (R < 1200)
    {
        cout << "ABC" << endl;
    }
    else if (R < 2800)
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "AGC" << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long R;
    scanf("%lld", &R);
    solve(R);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define N 200005
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
 
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		if(i%3 && i%5)
			ans+=i;
	}
	cout<<ans<<endl;
 
 	return 0;
}


Measured memory_bytes: 3612
import sys
input = sys.stdin.readline
n,w = map(int,input().split())
wv = [tuple(map(int,input().split())) for i in range(n)]

dp = [0]*(w+1)
for i in range(n):
    for j in range(w,wv[i][0]-1,-1):
        dp[j] = max(dp[j],dp[j-wv[i][0]]+wv[i][1])

print(max(dp))

Measured memory_bytes: 68208
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int H, W, K;
	int minimum = INF;
	vector<string> S;
	
	cin>>H>>W>>K;
	
	S.resize(H);
	
	for(int i = 0; i < H; i++){
		cin>>S[i];
	}
	
	for(int i = 0; i < (1<<(H-1)); i++){
		int con = 0;
		bool flag = true;
		vector<int> sum(H);
		
		// cout<<endl;
		// cout<<"i = "<<i<<endl;
		for(int j = 0; j < (H-1); j++){
			if((i>>j)&1) con++;
		}
		
		for(int j = 0; j < W; j++){
			bool flag2 = true;
			
			for(int k = 0, l = 0, s = 0; k < H; k++){
				if(S[k][j] == '1') s++;
				
				if(((i>>k)&1) || k == H-1) {
					if(s > K){
						flag = false;
						break;
					}
					
					// sum[l] += s;
					
					if(sum[l] + s > K) {
						flag2 = false;
					}
					s = 0;
					l++;
				}
			}
			
			if(flag == false) break;;
			if(flag2 == true) {
				for(int k = 0, l = 0, s = 0; k < H; k++){
					if(S[k][j] == '1') s++;
					
					if(((i>>k)&1) || k == H-1) {
						sum[l] += s;
						s = 0;
						l++;
					}
				}
			} else {
				con++;
				
				for(int k = 0, l = 0, s = 0; k < H; k++){
					if(S[k][j] == '1') s++;
					
					if(((i>>k)&1) || k == H-1) {
						sum[l] = s;
						s = 0;
						l++;
					}
				}
			}
			// for(int i = 0; i < H; i++){
				// cout<<sum[i]<<" " ;
			// }cout<<endl;
			
		}
		
		if(flag == true)minimum = min(con, minimum);
		
	}
	
	cout<<minimum<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << a - (a > b) << '\n';
}


Measured memory_bytes: 256
import java.util.*;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      int b = sc.nextInt();
      String c = "";
		
	    
	        if(a >= b) {
              for(int i=0;i<a;i++){
                c+=String.valueOf(b);
              }
	        	
	        } else {
              for(int i=0;i<b;i++){
                c+=String.valueOf(a);
              }
              
            }
      System.out.println(c);
	  
 
 
 
		sc.close();
	}
}

Measured memory_bytes: 20304
#include<stdio.h>
int par[200001];//親
int siz[200001];//サイズ

void unifind(int n){ //初期化
  for(int i=1;i<=n;i++){
    par[i] = i;
    siz[i] = 1;
  }
}
int root(int x){ //根を返す
  if(par[x] == x) return x;
  else return par[x] = root(par[x]);
}

int same(int x, int y){ //??
  return root(x) == root(y);
}

void uni(int x, int y){ //くっつける
  x = root(x);
  y = root(y);
  if(x != y){
    siz[x] += siz[y];
    par[y] = x;
  }
}

int size(int x){ //サイズを返す
  return siz[root(x)];
}

int max(int x, int y){
  if(x>=y) return x;
  else return y;
}

int main(void){
  int n,m,a,b,ma=0;
  scanf("%d %d",&n,&m);
  unifind(n);
  for(int i=0;i<m;i++){
    scanf("%d %d",&a,&b);
    uni(a,b);
  }
  for(int i=1;i<=n;i++){
    ma = max(ma,size(i));
  }
  printf("%d",ma);
  return 0;
}

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

const int MAXN = 105;

int N, a[MAXN], c[MAXN];

int main(){
	scanf("%d", &N);
	
	int D = 0;
	for(int i = 0; i < N; i++){
		scanf("%d", &a[i]);
	
		D = max(D, a[i]);
		c[a[i]]++;
	}
	
	int d = D;
	while(2 * d >= D){
		if(2 * d == D){
			if(c[d] < 1){
				printf("Impossible\n");
				return 0;
			}
			c[d]--;
		}else{
			if(c[d] < 2){
				printf("Impossible\n");
				return 0;	
			}
			c[d] -= 2;
		}
		d--;
	}
	
	for(int i = 1; i <= (D + 1) / 2; i++){
		if(c[i] > 0){
			printf("Impossible\n");
			return 0;		
		}
	}
	
	printf("Possible\n");
	
	return 0;
}


Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad.State

main :: IO ()
main = solve <$> words <$> getLine >>= print

solve :: [String] -> Int
solve ss = evalState (foldr1 (>>) $ map rpn ss) []

rpn :: String -> State [Int] Int
rpn "+" = do
  (x:y:ys) <- get
  let r = y + x
  put (r:ys)
  return r

rpn "-" = do
  (x:y:ys) <- get
  let r = y - x
  put (r:ys)
  return r

rpn "*" = do
  (x:y:ys) <- get
  let r = y * x
  put (r:ys)
  return r

rpn x = do
  let r = read x
  modify (r:)
  return r



Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(k,n) for(int i=k;i<(n);i++)
#define REP(n) for(int i=0;i<(n);i++)
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(all(v),0l)


int main() {
  double a,b,x;
  cin>>a>>b>>x;
  cout<<setprecision(12);
  if(x<a*a*b/2){
    cout<<atan(a*b*b/(2*x))/3.14159265358979323846*180;
  }else{
    cout<<atan(2*b/a-2*x/pow(a,3))/3.14159265358979323846*180;
  }
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, x;
  cin >> n >> x;
  vi32 L(n);
  cin >> L;
  int now = 0;
  int ans = 1;
  rep(i, n) {
    now += L[i];
    if (now > x) break;
    ans += 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vv = vector<vector<int>>;
using P = pair<int,int>;

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h.at(i);
  rep(i,n){
    if( i == 0 ){
      h.at(i)--;
      continue;
    }
    if( h.at(i-1) < h.at(i) ) h.at(i)--;
    if(  h.at(i-1) > h.at(i) ){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

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

    if(c-(a-b)<0)
        cout<<0;
    else
        cout<<c-(a-b);

    cout<<"\n";
    return 0;   //:D
}




Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;


int main() {
	LL N;
	cin >> N;
	set<LL> a;
	REP(i, N) {
		LL b;
		cin >> b;
		a.insert(b);
	}
	if (a.size() % 2 == 0) {

		cout << a.size()-1 << endl;
	}
	else {
		cout << a.size()  << endl;

	}
}


Measured memory_bytes: 4992
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

template<typename T> bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

template<typename T> bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll H,W,N;
    cin>>H>>W>>N;
    vll a(N);
    for(ll i=0;i<N;i++)cin>>a[i];
    
    vvll ans(H,vll(W));
    ll index=0;
    ll count=0;
    for(ll i=0;i<H;i++){
        if(i%2==0){
            for(ll j=0;j<W;j++){
                ans[i][j]=index+1;
                count++;
                if(count==a[index]){
                    index++;
                    count=0;
                }
            }
        }
        else{
            for(ll j=W-1;j>=0;j--){
                ans[i][j]=index+1;
                count++;
                if(count==a[index]){
                    index++;
                    count=0;
                }
            }
        }
    }
    
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            printf("%lld ",ans[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<stdlib.h>
#include<math.h>



int main()
{
    long long int a,b;
    char c;

    while(scanf("%lld %c %lld",&a,&c,&b)!=EOF)
    {


    if(c=='+'){printf("%lld\n",a+b);}
    else if(c=='-'){printf("%lld\n",a-b);}

    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
void main_sub(void);
int main(int argc, char* argv[]) {
    main_sub();
    return 0;
}
// int を int64_t にする
// g++ に -DUSE_STRICT_INT をつけるか、
// 下のコメントアウトを外すと無効化
// #define USE_STRICT_INT
using i64 = int64_t;
#ifndef USE_STRICT_INT
#define int i64
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = (1 << 30);
constexpr i64 INFL = (1LL << 62);
constexpr i64 MOD = 1000000007;
int a[30];
bool rec(int i, int s) {
    if (i == 0) {
        return s == 0;
    }
    return rec(i - 1, s) || rec(i - 1, s - a[i - 1]);
}

void main_sub(void) {
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    int q;
    cin >> q;
    rep(i, q) {
        int m;
        cin >> m;
        cout << (rec(n, m) ? "yes" : "no") << endl;
    }

    return;
}



Measured memory_bytes: 3112
#include <iostream>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a,b,c,k,ans=0; cin>>a>>b>>c>>k;
	if(a >= k){ans += k; k=0;}
	else{ans += a; k-=a;}
	if(b >= k){k=0;}
	else{k-=b;}
	if(c >= k){ans -= k; k=0;}
	else{ans -= c; k=0;}
	cout<<ans;

}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  priority_queue<ll> pque;
  rep(i,n){ 
    int a;
    cin >> a;
    pque.push(a);
  }
  for(int i=0;i<m;i++){
    int m = pque.top();
    pque.pop();
    m/=2;
    pque.push(m);
  }
  ll sum = 0;
  for(int i=0;i<n;i++){ 
    int tmp = pque.top();
    pque.pop();
    sum += tmp;
  }
  cout << sum << "\n"; 
  
}



Measured memory_bytes: 1400
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
 int a,b,c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256