akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long x, ans = LONG_LONG_MAX;
    cin >> x;
    while(x > 99) {
        ans = min(abs(753-(x%1000)), ans);
        x /= 10;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

fun main(args: Array<String>) {

    // IO Templates
    val br = BufferedReader(InputStreamReader(System.`in`))
    val out = PrintWriter(System.out)

    var x = br.readLine()!!.toInt()

    out.println(1 - x)

    out.flush()
}

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

#define ll long long
#define SZ(x) ((int) (x).size())
#define mk make_pair
#define pb push_back
#define debug(x) cerr << #x << " : " << x << endl;

using namespace std;

int main() {
       ios::sync_with_stdio(false); 
       cin.tie(0);
       int k, a, b;
       cin >> k >> a >> b;
       for (int i = a; i <= b; i++) {
              if (i % k == 0) {
                     cout << "OK" << '\n';
                     return 0;
              }
       }
       cout << "NG" << '\n';
       return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;
const double pi = 3.141592653589;

int N, M;
string S;
vi va, vb;

long double a, b, x;
void input() {
  cin >> a >> b >> x;
  ;
  ;
}
void solve() {
  // double h;
  // long double a1 =
  //     acos((double)a * a /
  //          sqrt(4.0 * (double)(b - x) * (b - x) + (double)a * a * a * a));
  // a1 = a1 * 180.0 / pi;
  // long double a2 =
  //     asin(b / sqrt((2.0 * a * a * b - 2.0 * x) * (2.0 * a * a * b - 2.0 * x)
  //     /
  //                       (a * a * b * b) +
  //                   b * b));

  // a2 = a2 * 180.0 / pi;
  // cout << a1 << endl;
  // cout << a2 << endl;

  long double a3 = atan((2 * a * a * b - 2 * x) / (a * a * a));
  long double a4 = atan((a * b * b) / (2 * x));
  a3 = a3 * 180.0 / pi;
  a4 = a4 * 180.0 / pi;

  double th = a * a * b / 2.0;

  cout << setprecision(8);
  if (th < x) {
    cout << a3 << endl;
  } else {
    cout << a4 << endl;
  }

  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
	double x1,y1,x2,y2,kyori;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	kyori=pow((x2-x1),2.0)+pow((y2-y1),2.0);
	printf("%f\n",sqrt(kyori));
	return 0;
}

Measured memory_bytes: 2684
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

vector<ll> opt(100010, 1000000000000000000);

int main() {
	opt[0] = 0;
	int n, w; scanf("%d %d", &n, &w);
	for (int i = 0; i < n; ++i) {
		ll iw, iv; scanf("%lld %lld", &iw, &iv);
		for (int cv = 100009; cv >= iv; --cv) opt[cv] = min(opt[cv], opt[cv - iv] + iw);
	}
	ll ans = 0;
	for (int i = 0; i < 100010; ++i) if (opt[i] <= w) ans = i;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

struct TREE{
   int ID;
   int L;
   int R;
};



void Preorder(struct TREE nord, struct TREE T[], int n, int memo[][2]) {
   printf(" %d", nord.ID);
   if (nord.L != -1) {
	  Preorder(T[memo[nord.L][0]], T, n, memo);
   }
   if (nord.R != -1) {
	  Preorder(T[memo[nord.R][0]], T, n, memo);
   }
}

void Inorder(struct TREE nord, struct TREE T[], int n,int memo[][2]) {
   if (nord.L != -1) {
	  Inorder(T[memo[nord.L][0]], T, n, memo);
   }
   printf(" %d", nord.ID);
   if (nord.R != -1) {
	  Inorder(T[memo[nord.R][0]], T, n, memo);
   }
}

void Postorder(struct TREE nord, struct TREE T[], int n, int memo[][2]) {
   if (nord.L != -1) {
	  Postorder(T[memo[nord.L][0]], T, n, memo);
   }
   if (nord.R != -1) {
	  Postorder(T[memo[nord.R][0]], T, n, memo);
   }
   printf(" %d", nord.ID);
}

int main() { 
   struct TREE T[30];
   int memo[30][2];
   int n, start;
   int i = 0;

   scanf("%d", &n);
   while (i < n) {
	  memo[i][1] = -1;
	  ++i;
   }

   i = 0;

   while (i < n) {
	  scanf("%d %d %d", &T[i].ID, &T[i].L, &T[i].R);
	  memo[T[i].ID][0] = i;
	  if (T[i].L != -1)
	     memo[T[i].L][1] = T[i].ID;
	  if (T[i].R != -1)
	     memo[T[i].R][1] = T[i].ID;
	  ++i;
   }
   i = 0;
   while (i < n) {
	  if (memo[i][1] == -1)
		 start = memo[i][0];
	  ++i;
   }

   printf("Preorder\n");
   Preorder(T[start], T, n, memo);
   putchar('\n');
   printf("Inorder\n");
   Inorder(T[start], T, n, memo);
   putchar('\n');
   printf("Postorder\n");
   Postorder(T[start], T, n, memo);
   putchar('\n');

   return 0;
}

Measured memory_bytes: 1852
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		set.add(s);
		for (int i = 2; i <= 1000000; i++) {
			s = func(s);
			if (set.contains(s)) {
				System.out.println(i);
				break;
			}
			set.add(s);
		}
	}
	
	static int func(int n) {
		if (n % 2 == 0) {
			return n / 2;
		} else {
			return n * 3 + 1;
		}
	}
}


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

int main()
{
    long long int n, total = 0;
    cin >> n;
    for (long long int i = 1; i <= n; i++)
    {
        if (i % 3 && i % 5)
            total += i;
    }
    cout << total;
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int inf = (1<<28);
const ll infl = (1LL<<60);
const int mod = 1e9+7;
struct mint {
  ll x;
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (t == 0) 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 {
    mint res(*this);
    return res /= a;
  }
};
const mint ONE(1);

mint comb(int n, int x) {
  mint N(n), X(x);
  mint nn = ONE, xx = ONE;
  for (int i = 0; i < x; i++) {
    mint I(i);
    nn *= N - I;
    xx *= X - I;
  }
  return nn * xx.inv();
}

int main() {
  int n, a, b; cin >> n >> a >> b;
  mint ans(2);
  ans = ans.pow(n) - ONE;
  ans -= comb(n, a);
  ans -= comb(n, b);
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if (n>k){
        cout<<k*x+(n-k)*y<<endl;
    }
    else{
        cout<<n*x<<endl;
    }
}

Measured memory_bytes: 256
def dfs(N,s,a,b,c):
    if int(s)>N:
        return 0
    ret  = dfs(N,s+'3',True,b,c)
    ret += dfs(N,s+'5',a,True,c)
    ret += dfs(N,s+'7',a,b,True)
    return ret + (a and b and c)

print(dfs(int(input()),'0',False,False,False))


Measured memory_bytes: 3060
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;




int main(){

	int table[32769];

	for(int i = 0; i <= 32768; i++)table[i] = 0;

	for(int i = 1; i <= 181; i++){
		table[i*i]++;
		for(int k = i; k <= 181; k++){
			if(i*i+k*k > 32768)break;
			table[i*i+k*k]++;
			for(int p = k; p <= 181;p++){
				if(i*i+k*k+p*p > 32768)break;
				table[i*i+k*k+p*p]++;
				for(int a = p; a <= 181; a++){
					if(i*i+k*k+p*p+a*a > 32768)break;
					table[i*i+k*k+p*p+a*a]++;
				}
			}
		}
	}

	int n;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		printf("%d\n",table[n]);

	}

	return 0;
}

Measured memory_bytes: 2712
#include<stdio.h>
#include<string.h>
int main() {

	char n[200001];
	int i, sum = 0;

	scanf("%s", n);

	for (i = 0; i < strlen(n); i++) {
		sum = sum + (n[i] - 48);
	}

	if (sum % 9 == 0)
		printf("Yes");
	else
		printf("No");

	return 0;
}

Measured memory_bytes: 2268
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
  int x;
  scanf("%d",&x);
  int k = 0;
  if(2<x) {
    if(x<8) {
      if(x%2==1) {
        k = 1;
      }
    }
  }
  if(k > 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

const int Max = 100001;
bool d[Max];
int cnt[Max];

bool is_prime(int x) {
    for (int i = 2; i*i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

void solve() {
    int Q;
    cin >> Q;
    vector<pair<int, int>> query(Q);
    REP(i, Q) cin >> query[i].first >> query[i].second;

    REP(i, Max) d[i] = false;

    for (int i = 2; i < Max; i++) {
        d[i] = is_prime(i);
    }

    REP(i, Max) cnt[i] = 0;
    for (int i = 1; i < Max; i++) {
        if (i%2 != 0 && d[i] && d[(i+1)/2]) {
            cnt[i] = cnt[i-1] + 1;
        } else {
            cnt[i] = cnt[i-1];
        }
    }

    REP(i, Q) {
        print(cnt[query[i].second] - cnt[query[i].first-1]);
    }

}

signed main() {
    solve();
}


Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
  public static void main(String args[]){
    Scanner s = new Scanner(System.in);
    String str = s.next();
    char[] c = str.toCharArray();
    if(c.length == 3){
      char temp = c[0];
      c[0] = c[2];
      c[2] = temp;
    }
    System.out.println(c);
  }
}

Measured memory_bytes: 22996
n = int(input())
a = [int(x) for x in input().split()]

a.append(0)
a.insert(0,0)

ans = 0

for i in range(1,n+2):
    ans += abs(a[i-1]-a[i])

for i in range(1,n+1):
    print(ans + abs(a[i-1] - a[i+1]) - (abs(a[i] - a[i-1]) + abs(a[i] - a[i+1])))


Measured memory_bytes: 14048
#include<iostream>
#include<vector>
#include<set>
#include<unordered_set>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<climits>
#define ll long long int
#define mod 1000000007
#define pi acos(-1)
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n ,k,r , p, s;
  cin>>n>>k>>r>>s>>p;
  string str;
  cin>>str;
  int hash[n]={0};
  string tmp="";
  // for(int i=0;i<n;i++)
  // {
  //   tmp[i] ="";
  // }
  ll ans=0;
  for(int i=0;i<n;i++)
  {
    // if(i<=3)
    //   cout<<ans<<" ";
    if(i-k>=0&&hash[i-k]==1&&str[i-k]==str[i])
    {
      hash[i]=0;
      tmp+="@";
    }
    else
    {
      hash[i]=1;
      if(str[i]=='r')
      {
        tmp+="p";
        ans+=p;
      }
      else if(str[i]=='p')
      {
        tmp+="s";
        ans+=s;
      }
      else
      {
        tmp+="r";
        ans+=r;
      }
      
    }
    
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 100005
#define NIL -1
 
struct Node{
  int l;
  int p;
  int r;
};
struct Node T[MAX]; 
int n;

int getDepth(int u){
 int d=0;
  for(;T[u].p != NIL; d++){
 u=T[u].p;

  }
  return d;
}
void print(int u){
 
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,getDepth(u));
    
  if( T[u].p == NIL) printf("root, [");
  
else if(T[u].l == NIL) printf("leaf, [");
  
else printf("internal node, [");
    
  if( T[u].l != NIL){
    while(1){
      
if(T[T[u].l].r == NIL){
    printf("%d",T[u].l);
    break;
      }
      
else {
    printf("%d, ",T[u].l);
    T[u].l = T[T[u].l].r;
      }
    }
  }
   
  printf("]\n");
}
 
int main(){
  int i;
  int j;
  int d;
  int v;
  int c;
  int l;
  int t;

   
  scanf("%d", &n);
   
  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = NIL;
  }
   
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
       
      if(j == 0){
    T[v].l = c;
    T[c].p = v;
    t = c;
      }
      else{
    T[t].r = c;
    T[c].p = v;
    t = c;
      }
    }
  }
   
  for ( i = 0; i < n; i++ ){

 print(i);
  }  
return 0;
}

Measured memory_bytes: 1784
#include <stdio.h>
int main(void){
    
    int a,b,max1,max2,max;
    scanf("%d",&a);
    scanf("%d",&b);
    
    if(a<b){
        max1 = b;
        b--;
    }else{
        max1 = a;
        a--;
    }
    
      if(a<b){
        max2 = b;
    }else{
        max2 = a;
    }
    
    max =max1 + max2;
    
    printf("%d",max);
    

    return 0;
}

Measured memory_bytes: 128
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	d := make(pairs, n)
	for i := 0; i < n; i++ {
		a, b := scanInt(), scanInt()
		d[i] = pair{a, b}
	}
	sort.Sort(d)

	ans := 0
	for i := 0; i < n; i++ {
		if m-d[i].b >= 0 {
			ans += d[i].b*d[i].a
			m -= d[i].b
		} else {
			ans += m*d[i].a
			break
		}
	}
	fmt.Fprintln(wr, ans)
}

type pair struct {
	a, b int
}

type pairs []pair

func (a pairs) Len() int           { return len(a) }
func (a pairs) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a pairs) Less(i, j int) bool { return a[i].a < a[j].a }


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

int main()
{
	ios_base::sync_with_stdio(false);
	int num, final = 0;
	cin>>num;
	for(int j = 1; j <= num;)
{
	int ans = 0;
	for(int i = 1; i <= j; i++)
{
	if(j % i == 0)
	ans++;
}
	if(ans == 8)
	final++;
	j+=2;
}
	cout<<final<<"\n";
	return 0;
}

Measured memory_bytes: 256
/* Coached by Dukkha */
#include <stdio.h>

#define N 300000

int main() {
	static char s[N + 1];
	static int pp[N], qq[N];
	int n, i, k, ans;

	scanf("%d%s", &n, s);
	k = 0;
	for (i = 0; i < n; i++) {
		pp[i] = k;
		if (s[i] == 'W')
			k++;
	}
	k = 0;
	for (i = n - 1; i >= 0; i--) {
		qq[i] = k;
		if (s[i] == 'E')
			k++;
	}
	ans = n;
	for (i = 0; i < n; i++) {
		k = pp[i] + qq[i];
		if (ans > k)
			ans = k;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define maxn 1005
using namespace std;
string s[15];
int col[15],sum[15];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k;
	cin >> n >> m >> k;
	for(int i=0;i<n;i++)
		cin >> s[i];
	int ans = n * m;
	int limit = max(1,(1<<(n-1)));
	for(int state=0;state<limit;state++) {
		int tem = state;
		int tmp = 0;
		for(int i=0;i<n;i++,tem>>=1) {
			col[i] = tmp;
			if(tem & 1)	tmp++;
		}
		int now = tmp;
		memset(sum,0,sizeof sum);
		for(int j=0;j<m;j++) {
			for(int i=0;i<n;i++)
				sum[col[i]] += s[i][j] - '0';
			bool tag = false;
			for(int i=0;i<=tmp;i++)
				if(sum[i] > k) {
					tag = true;
					break;
				}
			if(tag) {
				now++;
				memset(sum,0,sizeof sum);
				for(int i=0;i<n;i++)
					sum[col[i]] += s[i][j] - '0';
			}
		}
		tem = 0;
		for(int i=0;i<=tmp;i++)
			tem = max(tem,sum[i]);
		if(tem <= k)
			ans = min(ans,now);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }







int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    reverse(all(s));
    
    int now = 0;
    vector<int> ans;
    
    while (1) {
        for (int i = m; i >= 1; --i) {
            if (now + i <= n && s[now + i] == '0') {
                now += i;
                ans.eb(i);
                break;
            }
            if (i == 1) { cout << -1 << endl; return 0; }
        }
        if (now == n) break;
    }
    reverse(all(ans));
    rep(i, sz(ans)) cout << ans[i] << " "; cout << endl;
}




Measured memory_bytes: 1096
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

ll a[200001];
ll sum[200001];
map<ll, ll> M;
int main() {
	int n;
	scanf("%d", &n);
	M[0] = 1;
	fup(i, 1, n, 1)
	{
		scanf("%lld", a + i);
		sum[i] = sum[i - 1] + a[i];
		M[sum[i]]++;
	}
	ll ans = 0;
	for (auto it = M.begin(); it != M.end(); it++)
	{
		ll t = it->Y;
		ans += t*(t - 1);
	}
	printf("%lld", ans/2);
}

Measured memory_bytes: 15872
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		int result=0;

		for (int i = 0; i < n; i++) {
			int p= sc.nextInt();
			list.add(p);
		}

		for (int i = 1; i < n-1; i++) {
			int pi =list.get(i);
			int pIminus =list.get(i-1);
			int pIplus =list.get(i+1);
			// System.out.println("i " + i);
			// System.out.println("pi " + pi);
			if((pIminus<pi && pi<pIplus)|| (pIplus<pi&& pi<pIminus)){
				result++;
			}
		}

			System.out.println(result);

	}

}


Measured memory_bytes: 23764
a = int(input())  # 数値入力
str = list(map(int, input().split()))  # リスト入力（数値）  map関数はリストの各要素に対して関数を適用してくれる

max = 0
ans = 0
for i in range(a):
    if max <= str[i]:
        ans += 1
        max = str[i]

print(ans)


Measured memory_bytes: 2940
n,k = map(int, input().split())
p=list(map(int, input().split()))

for i in range(n):
    p[i]=(p[i]+1)/2
cnt=sum(p[0:k])
ans=[]
ans.append(cnt)
for i in range(n-k):
    cnt=cnt-p[i]+p[i+k]
    ans.append(cnt)



print(max(ans))

Measured memory_bytes: 78600
import sys
from collections import deque
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from bisect import bisect, bisect_left

def solve():
    input = sys.stdin.readline
    N = int(input())
    P = [int(p) for p in input().split()]
    minN = P[0]
    count = 1
    for p in P[1:]:
        if minN > p:
            count += 1
            minN = p

    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 23828
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;

int main() 
{
    int a,b,c; cin >> a >> b >> c;
    int ans = 0;
    for(int i = a; i <= b; i++){
        if(c % i == 0) ans++;
    }
    cout << ans << endl;
}



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

int H, W, C, M, Nw, Nc, Nm, s, t, res;
int Win, Wout, Cin, Cout, Mio, V;
int cap[310][310];
bool used[310];
enum { source = 300, sink, nwin, nwout, ncin, ncout, nmio };

bool dfs(int v, int t)
{
	if(v == t) return true;
	used[v] = true;
	for(int i = 0; i < 310; ++i)
		if(cap[v][i] > 0 && !used[i])
			if(dfs(i, t)) {
				--cap[v][i]; ++cap[i][v]; return true;
			}
	return false;
}

int main()
{
	while(cin >> H >> W >> C >> M >> Nw >> Nc >> Nm && H >= 0)
	{
		Win  = H;
		Wout = Win  + W;
		Cin  = Wout + W;
		Cout = Cin  + C;
		Mio  = Cout + C;

		memset(cap, 0, sizeof(cap));
		for(int i = 0; i < H; ++i) {
			cap[source][i] = 1;
			cap[i][nwin] = 1;
		}
		for(int i = 0; i < W; ++i) {
			cin >> s;
			for(int j = 0; j < s; ++j) { cin >> t; cap[t-1][Win+i] = 1; }
			cap[Win+i][Wout+i] = 1;
			cap[Wout+i][ncin] = 1;
		}
		for(int i = 0; i < C; ++i) {
			cin >> s;
			for(int j = 0; j < s; ++j) { cin >> t; cap[Wout+t-1][Cin+i] = 1; }
			cap[nwout][Cin+i] = 1;
			cap[Cin+i][Cout+i] = 1;
			cap[Cout+i][nmio] = 1;
		}
		for(int i = 0; i < M; ++i) {
			cin >> s;
			for(int j = 0; j < s; ++j) { cin >> t; cap[Cout+t-1][Mio+i] = 1; }
			cap[ncout][Mio+i] = 1;
			cap[Mio+i][sink] = 1;
		}
		cap[nwin][nwout] = Nw;
		cap[ncin][ncout] = Nc;
		cap[nmio][sink]  = Nm;

		res = 0;
		while(true)
		{
			fill_n(used, 310, false);
			if(!dfs(source, sink)) break;
			++res;
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 1248
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  int X, A, B;
  cin >> X >> A >> B;
  if (B <= A) {
    cout << "delicious" << endl;
  } else if (X + A >= B) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
  return 0;
}

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


vector<ll> divisor(ll n) {
  vector< ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret), greater<ll>());
  return (ret);
}

int main(){
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    ll sum = 0;
    for(int i = 0; i < N ; i++){
        cin >> A[i];
        sum += A[i];
    }
    sort(A.begin(), A.end());
    vector<ll> D = divisor(sum);
    for(int i = 0; i < D.size(); i++){
        vector<int> B(N);
        ll tmpsum = 0;
        for(int j = 0; j < A.size(); j++){
            B[j] = A[j] % D[i];
            tmpsum += B[j];
        }
        sort(B.begin(), B.end(), greater<ll>());
        ll cnt = 0;
        for(int j = 0; j < tmpsum /D[i] ; j++){
            cnt += D[i]-B[j];
        }
        if(cnt <= K){
            cout << D[i] << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
    bool ans = false;
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < M; i++) cin >> B[i];
    for (int i = 0; i < N - M + 1; i++) {
        for (int j = 0; j < N - M + 1; j++) {
            int cnt = 0;
            for (int k = j; k < j + M; k++) if (A[k].substr(i, M) == B[k-j]) cnt++;
            if (cnt == M) ans = true;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}

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

int main() {
  lint N, K;
  cin >> N >> K;
  vector<lint> A(N);
  for(auto& elem : A) cin >> elem;

  for(lint i=K; i<N; i++) {
    cout << (A[i-K] < A[i] ? "Yes" : "No") << endl;
  }
}

Measured memory_bytes: 4824
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, k = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    A = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    Unique = list(set(A))
    Dic = {x:0 for x in set(A)}

    if len(set(A)) <= k:
        print(0)
    else:
        for x in A:
            Dic[x] += 1
        Dicsort = sorted(Dic.items(), key=lambda x: x[1])

        cnt = 0
        for i in range(len(set(A)) - k):
            cnt += Dicsort[i][1]
        print(cnt)
resolve()

Measured memory_bytes: 119488
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  int n, m;
  cin >> n >> m;

  if (n == m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;

    bool ans[3] = {true, true, true};
    ans[A] = false;
    ans[B] = false;
    for (int i = 0; i < 3; i++) {
        if (ans[i]) {
            cout << i + 1 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    map<ll, ll> M;
    vector<ll> A;
    rep (i, N) {
        ll a;
        cin >> a;
        ++M[a];
        if (M[a] == 2) {
            M[a] = 0;
            A.pb(a);
        }
    }
    sort(rall(A));
    if (A.size() < 2) {
        cout << 0 << endl;
    } else {
        cout << A[0] * A[1] << endl;
    }
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;


int main(void){
    int X[3];

    cin>>X[0]>>X[1]>>X[2];

    sort(X, X+3 );

    cout<<X[0]+X[1]<<endl;


    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

void dfs(vector<vector<pair<int, int>>> &tree, int u, int bf, vector<int> &ans, bool mode){
	for(auto p : tree.at(u)){
		if(p.first == bf) continue;
		bool c = !(mode ^ (p.second % 2 == 0));
		if(c){
			ans.at(p.first) = 0;
			dfs(tree, p.first, u, ans, true);
		}else{
			ans.at(p.first) = 1;
			dfs(tree, p.first, u, ans, false);
		}
	}
}

int main(){
	int n;
	cin >> n;
	vector<vector<pair<int, int>>> tree(n);
	rep(i, n-1){
		int u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		tree.at(u).push_back(make_pair(v, w));
		tree.at(v).push_back(make_pair(u, w));
	}
	vector<int> ans(n);
	ans.at(0) = 0;
	dfs(tree, 0, -1, ans, true);
	rep(i, n){
		cout << ans.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 9728
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int k;
    string s;
    cin >> k;
    cin >> s;
    if (SZ(s) > k) {
        FOR(i,0,k-1) cout << s[i];
        cout << "...";
    }
    else cout << s;
    return 0;
}


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

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

    vector<int> check(m, 0);
    vector<int> k(n);
    for(int i=0; i<n; i++){
        cin >> k[i];
        for(int j=0; j<k[i]; j++){
            int a;
            cin >> a;
            a -= 1;
            check[a] += 1;
        }
    }

    int count = 0;
    for(int i=0; i<m; i++){
        if(check[i] == n) count += 1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  array<int, 32> ar = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << ar[K-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <functional>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(x) begin(x), end(x)
using namespace std;

int solve(int n, vector<int> const & a, vector<int> const & b) {
    if (a == b) {
        return 0;
    }
    int sum_a = accumulate(whole(a), 0, bit_xor<int>());
    {
        map<int, int> cnt;
        for (int a_i : a) {
            cnt[a_i] += 1;
        }
        cnt[sum_a] += 1;
        for (int b_i : b) {
            if (cnt.count(b_i)) {
                cnt[b_i] -= 1;
                if (cnt[b_i] == 0) {
                    cnt.erase(b_i);
                }
            }
        }
        assert (not cnt.empty());
        if (cnt.size() >= 2 or cnt.begin()->second >= 2) {
            return -1;  // impossible
        }
    }
    int mismatch = 0;
    repeat (i, n) {
        mismatch += (a[i] != b[i]);
    }
    int component = 0; {
        map<int, set<int> > g;
        repeat (i, n) {
            if (a[i] != b[i]) {
                g[b[i]].insert(a[i]);
            }
        }
        set<int> used;
        function<void (int)> go = [&](int a_i) {
            used.insert(a_i);
            for (int a_j : g[a_i]) if (not used.count(a_j)) {
                go(a_j);
            }
        };
        component += 1;
        if (g.count(sum_a)) {
            go(sum_a);
        }
        repeat (i, n) if (not used.count(a[i])) {
            if (g.count(a[i])) {
                component += 1;
                go(a[i]);
            }
        }
    }
    return mismatch + (component - 1);
}

int main() {
    int n; scanf("%d", &n);
    vector<int> a(n); repeat (i, n) scanf("%d", &a[i]);
    vector<int> b(n); repeat (i, n) scanf("%d", &b[i]);
    int result = solve(n, a, b);
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 25984
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1 << 30;
int mat[15][15];
int cost[1 << 15][15];
int dp[1 << 15][15];
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		mat[a][b] = mat[b][a] = c;
	}
	for (int mask = 0; mask < (1 << N); mask++) {
		for (int i = 0; i < N; i++) {
			dp[mask][i] = INF;
			for (int j = 0; j < N; j++) {
				if (mask&(1 << j)) cost[mask][i] += mat[i][j];
			}
		}
	}
	dp[1][0] = 0;
	for (int mask = 0; mask < (1 << N); mask++) {
		for (int i = 0; i < N; i++) {
			if (mask&(1 << i) == 0 || dp[mask][i] == INF) continue;
			for (int j = 0; j < N; j++) {
				if (mask&(1 << j) || mat[i][j] == 0) continue;
				int add = cost[mask][j] - mat[i][j];
				dp[mask | (1 << j)][j] = min(dp[mask | (1 << j)][j], dp[mask][i] + add);
			}
			int nmask = mask ^ (1 << i);
			int comp = ((1 << N) - 1) ^ mask;
			for (int bit = comp; bit > 0; bit = (bit - 1)&comp) {
				int add = 0;
				for (int j = 0; j < N; j++) {
					if (bit&(1 << j)) add += cost[nmask][j];
				}
				dp[mask | bit][i] = min(dp[mask | bit][i], dp[mask][i] + add);
			}
		}
	}
	cout << dp[(1 << N) - 1][N - 1] << endl;
}


Measured memory_bytes: 4096
use std::io;
use std::str::FromStr;

fn read<T: FromStr + Default>() -> T {
    let mut x = String::with_capacity(5);
    io::stdin().read_line(&mut x).unwrap();
    if x.as_bytes()[x.len() - 1] == b'\n' {
        x.pop();
    }
    x.parse().unwrap_or_default()
}

fn main() {
    let mut ac: i32 = 0;
    let mut wa: i32 = 0;
    let mut tle: i32 = 0;
    let mut re: i32 = 0;
    for _ in 0..read() {
        *match &read::<String>()[..] {
            "AC" => &mut ac,
            "WA" => &mut wa,
            "TLE" => &mut tle,
            _ => &mut re,
        } += 1;
    }
    println!("AC x {}", ac);
    println!("WA x {}", wa);
    println!("TLE x {}", tle);
    println!("RE x {}", re);
}

Measured memory_bytes: 2128
import java.util.*;

class Main {

    static void solve (double f) {
        double [] seq = new double[10];
        seq[0] = f;
        for(int i = 1; i < 10; i++) {
            if (i % 2 == 0) seq[i] = seq[i-1] / 3;
            else            seq[i] = seq[i-1] * 2;
        }

        double sum = 0.0;
        for (int i = 0; i < 10; i++) {
            sum += seq[i];
        }

        System.out.println(sum);
    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {
            double first = sc.nextDouble();
            solve(first);
        }

    }
}

Measured memory_bytes: 12000
#include<iostream>

using namespace std;

int main()
{  int A,B,C,D;
 
   cin>>A;
   cin>>B;
   cin>>C;
   cin>>D;
   if((A*B)>=(C*D))
      cout<<(A*B);
   else
      cout<<(C*D);
    return 0;

}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func contains(target int, list []int) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInt64() int64 {
	sc.Scan()

	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}
func abs(i int64) int64 {
	if i < 0 {
		return -i
	}
	return i
}

func f(n int) int {
	if n%2 == 0 {
		return n / 2
	}
	return 3*n + 1
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	// a := make([][]int, 3)
	// for i := 0; i < 3; i++ {
	// 	a[i] = make([]int, 3)
	// }
	// for i := 0; i < 3; i++ {
	// 	for j := 0; j < 3; j++ {
	// 		a[i][j] = nextInt()
	// 	}
	// }

	s := nextInt()
	var a []int

	for i := 0; true; i++ {
		if i == 0 {
			a = append(a, s)
		} else if i > 0 {
			if contains(f(a[i-1]), a) {
				fmt.Println(i + 1)
				break
			}
			a = append(a, f(a[i-1]))
		}
	}

}


Measured memory_bytes: 1776
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.nextLine();
        if (a.equals("A"))
            System.out.println("T");
        if (a.equals("T"))
            System.out.println("A");
        if (a.equals("C"))
            System.out.println("G");
        if (a.equals("G"))
            System.out.println("C");
    }
}

Measured memory_bytes: 21588
#include<stdio.h>
#include<string.h>
#include<iso646.h>

int main(){
  char N[2];

  scanf("%s",N);

  if(N[0] == '9' or N[1] == '9'){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

return 0;
}


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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> m(N);
  for (int i = 0; i < N; ++i) {
    cin >> m.at(i);
  }
  int sum = accumulate(m.begin(), m.end(), 0);
  int mn = *min_element(m.begin(), m.end());
  int ans = N + (X - sum) / mn;
  cout << ans << endl;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              unsigned int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x);
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll m,ll mod);
ll pow2(ll n,ll k);
ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
void solve(){
        ll i,j,k,l,n,m,y,z,r;
        
        ll A,B,H,M;
        cin>>A>>B>>H>>M;
        
        ld ang1=(ld)H*(30.0);
        ang1+=(ld)((ld)M/2.0);
        ld ang2=(ld)M*(6.0);
        
        ld ang=abs(ang2-ang1);
        ang=min(ang,abs(360.0-ang1)+ang2);
        ang=min(ang,abs(360.0-ang2)+ang1);
        // cout<<setprecision(12)<<fixed<<ang<<endl;
        // cout<<(2.0)*((ld)(A*B))*cos(3.1415927*ang/180.0);
        ld ans=(ld)(A*A)+(ld)(B*B) -   (2.0)*((ld)(A*B))*cos(acos(-1)*(ang/180.0));
        cout<<setprecision(12)<<fixed<<sqrt(ans)<<endl;
        
        
        
}
int main(){
        FS;
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}
ll ceil1(ll n,ll x){
        return (n-1)/x+(n>0);
}
ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}
ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 4164
# -*- coding: utf-8 -*-
from sys import stdin
import math

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

N, M = ds_in()
MOD = 10**9 + 7

def factorize(n):
    if n == 1:
        return []
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

fct = factorize(M)

def recursive_square(n, m, p):
    """ n**p (mod m) """
    if p == 0:
        return 1 % m
    if p % 2 == 0:
        root = recursive_square(n, m, p//2) % m 
        return (root ** 2) % m
    else:
        return ((n % m) * recursive_square(n, m, p-1)) % m

Inv = dict([[1,1]]) # 逆元

# 組み合わせ
def combination(n, r):
    val = 1
    for i in range(1, r+1):
        if i not in Inv.keys():
            Inv[i] = recursive_square(i, MOD, MOD-2)
        val = (((val * (n-i+1)) % MOD) * Inv[i]) % MOD
    return val

ans = 1
for f in fct:
    ans = (ans * combination(N-1+f[1], f[1])) % MOD
print(ans)




Measured memory_bytes: 3064
N, M = map(int, input().split())
A = [[int(x) for x in input().split()] for y in range(N)]
ans = set(int(z) for z in range(1, 31))
for i in range(N):
    A[i].pop(0)
    ans = ans & set(A[i])
print(len(ans))

Measured memory_bytes: 3060
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for(ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> table(1000001, 0);

    REP (i, N) {
        cin >> A[i];
    }

    for (int a : A) {
        for (int i = a; i < 1000001; i += a) {
            if (i == a && table[i] > 0){
                table[i]++;
                break;
            }
            table[i]++;
        }
    }

    int ans = 0;
    for (int a : A) {
        if (table[a] == 1) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7516
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long t = 1;
        long ret = t;
        for(int i=0;Math.pow(2,i+1)<=h;i++){
          t *= 2;
          ret += t;
        }

        System.out.println(ret);
    }
}

Measured memory_bytes: 22612
n = int(input())
s = [input()for  _ in range(n)]
cnt = {}
for x in s:
    p = list(x)
    p.sort()
    b = "".join(p)
    if "".join(p) not in cnt:cnt[b] = 1
    else:cnt[b] +=1
ans = 0
for key in cnt:
    v = cnt[key]
    ans +=v*(v-1)//2
print(ans)
    
 
    




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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a * b % 2 != 0 ? "Yes" : "No") << "\n";
}

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

using namespace std;

int main() {

    int n, sol = 0, c = 0;
    cin >> n;

    int h[n];

    for(int i = 0; i < n; i++) {
        cin >> h[i];
        if(i > 0) {
            if(h[i] <= h[i-1]) c++;
            else {
                sol = max(sol, c);
                c = 0;
            }
        }
    }

    cout << max(sol, c) << endl;

    return 0;
}

Measured memory_bytes: 640