akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define For(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)
#define INF 1000000000;
int N,K;

int main() {
    cin >> K >>N;
    vector<int> a(N),b(N);
    rep(i,N) cin >> a.at(i);
    int mi=INF;
    rep(i,N) {
        int dis;
        if(i==0 || i==N-1) {
            dis=a.at(N-1)-a.at(0);
            mi=min(mi,dis);
        }
        else {
            dis=K-(a.at(i+1)-a.at(i));
            mi=min(mi,dis);
            dis=K-(a.at(i)-a.at(i-1));
            mi=min(mi,dis);
        }
    }
    cout << mi << endl;
}

Measured memory_bytes: 1792
use std::io;

fn solve(){

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let t = buf.trim().split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect::<Vec<i32>>();
    let (n,m) = (t[0],t[1]);
    println!("{}",n*(n-1)/2+m*(m-1)/2);
}


fn main(){
    let mut t_cases = 1;
    // let mut buf = String::new();
    // io::stdin().read_line(&mut buf);
    // t_cases = buf.trim().parse::<i32>();
    for _ in 0..t_cases{
        solve();
    }
}

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

int main(){
  int n, m;
  cin >> n >> m;
  if(n == m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

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

Measured memory_bytes: 1156
using System;
using System.Linq;
using System.Collections.Generic;

class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        int min = int.MaxValue;
        int p = 0;
        for (int i = 0; i < n; i++)
        {
            var item = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(min>item[1])
            {
                p = item[0];
                min = item[1];
            }
        }
        Console.WriteLine(p+min);
    }

}


Measured memory_bytes: 17448
# -*- coding: utf-8 -*-
from collections import Counter, defaultdict, deque
import math

import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def f(a, b):
    if a == 0 and b == 0:
        return (1, 0, 0)
    if b == 0:
        return (1, 1, 0)
    g = math.gcd(a, b)
    a //= g
    b //= g
    if a == 0 and b < 0:
        s = 1
    else:
        s = 1 if a * b >= 0 else -1
    a = abs(a)
    b = abs(b)
    return s, a, b


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(N, AB):
    adb = Counter()
    for a, b in AB:
        s, a, b = f(a, b)
        adb[(s*a, b)] += 1
    M = Mod(1000000007)
    ans = 1
    done = set()
    for k, v in adb.items():
        if k in done:
            continue
        if k == (0, 0):
            continue
        a, b = k
        if a < 0:
            s = 1
            a = abs(a)
        elif a == 0:
            s = 1
        else:
            s = -1
        n = adb[(s*b, a)]
        done.add(k)
        done.add((s*b, a))
        t = M.sub(M.pow(2, v) + M.pow(2, n), 1)
        ans = M.mul(ans, t)

    return M.add(M.sub(ans, 1), adb[(0, 0)])


def main():
    N = read_int()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 168104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m,ans=0,x;
	priority_queue<ll> q;
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		q.push(x);
	}
	for(int i=1;i<=m;i++)
	{
		ll jk=q.top();
		q.pop();
		jk/=2;
		q.push(jk);
	}
	while(q.size())
	{
		ans+=q.top();
		q.pop();
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  double x[2000];
  double n,t,a,ans,tem=33333;
  cin>>n;
  cin>>t>>a;
  for(int i=0;i<n;i++){
    cin>>x[i];
    x[i]=t-x[i]*0.006;
  }
  for(int j=0;j<n;j++){
    double aa=abs(a-x[j]);
    if(aa<tem){
      ans=j+1;
      tem=aa;
    }
  }
  cout<<ans<<endl;
}

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

int main()
{
    double pi = 3.14159265358979323846264338327950L;
    double A, B, H, M, ans, h, m, Z;
    cin >> A >> B >> H >> M;
    h = 30 * H + 0.5 * M;
    m = 6 * M;
    Z = abs((30 * H + 0.5 * M) - 6*M);
    ans = (A * A) + (B * B) - 2 * A * B * cos(Z * pi / 180.0);
    cout << fixed << setprecision(12) << sqrt(ans) << endl;
    return 0;
}


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

#define ll long long

ll x;

int main(){
	scanf("%lld", &x);
	ll l = 0, r = 1e9, ans;
	while(l <= r){
		ll m = l + r >> 1;
		if(m * (m + 1) / 2 >= x){
			ans = m;
			r = m - 1;
		}
		else{
			l = m + 1;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
program abc147c
      implicit none
      integer,allocatable,dimension(:,:)::x,y
      integer,allocatable,dimension(:)::a
      integer::n
      integer::i,j,k
      integer::ans
      logical::check

      ! btest(i,j)// logical function //if a bit is set at position 'j' in 'i', return TRUE ; otherwise FALSE

         read *, n
         allocate(a(n),x(n,n-1),y(n,n-1))  ! x(n人の,最大n-1個の証言)

         a=0; x=-1; y=-1
         do i=1,n
            read *, a(i)
            do j=1,a(i)
               read *, x(i,j),y(i,j)
            end do
         end do

         ans=0
         do i=0,2**n-1        ! 正直者,不親切のパターンを提示
            check=.true.
            do j=1,n
               if (.not. btest(i,j-1)) cycle           ! 提示で正直者なら次へ
               do k=1,a(j)
                  if ( btest(i,x(j,k)-1) .and. y(j,k)==0) check=.false.         ! if(提示では正直者 .and. 証言では否 )
                  if ( .not. btest(i,x(j,k)-1) .and. y(j,k)==1) check=.false.  ! if(提示では不親切 .and. 証言は正直者 )
               end do
            end do
            if (check) ans=max(ans,cnt(i))
         end do

         print *, ans
         stop

   contains
      function cnt(k)
         implicit none
         integer,intent(in)::k
         integer::cnt
         integer::i

            cnt=0
            do i=1,bit_size(k)
               if (btest(k,i-1)) cnt=cnt+1
            end do
            return
      end function cnt

   end program abc147c

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

namespace AABC
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] ist = { int.Parse(s[0]) , int.Parse(s[1]) , int.Parse(s[2]) };

            Array.Sort(ist);

            int t1 = Math.Abs(ist[0]-ist[1]);
            int t2 = Math.Abs(ist[2]-ist[1]);

            Console.WriteLine(t1 + t2);
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=105;

int n, l;
string a[N];

int32_t main()
{
	IOS;
	cin>>n>>l;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1, a+n+1);
	for(int i=1;i<=n;i++)
		cout<<a[i];
	return 0;
}


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

using namespace std;

typedef long long in;

in pow(in x, in n){
    while(n!=0){
        x*=2;
        n--;
        x%=(1000000000LL+7LL);
    }
    return x;
}

int main(){
    in n;
    cin >> n;
    vector<in> a(n);
    for(in i=0;i<n;i++)
        cin >> a[i];
    sort(a.begin(),a.end());
    if(a.size()%2==0){
        if(a[0]!=1){
            cout << 0 << endl;
            return 0;
        }
        for(in i=1;i<n;i+=2){
            if(a[i]!=a[i-1]){
                cout << 0 << endl;
                return 0;
            }
            if(i>1&&a[i]!=a[i-2]+2){
                cout << 0 << endl;
                return 0;
            }
        }
        in pot=1;
        in l=a.size()/2;
        pot=pow(pot,l);
        cout << pot << endl;
        return 0;
    }
    else{
        if(a[0]!=0){
            cout << 0 << endl;
            return 0;
        }
        for(in i=2;i<n;i+=2){
            if(a[i]!=a[i-1]||a[i]!=a[i-2]+2){
                cout << 0 << endl;
                return 0;
            }
        }
        in pot=1;
        in l=a.size()/2;
        pot=pow(pot,l);
        cout << pot << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 1024
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <unordered_set>
#include <math.h>
#include <cstring>
#include <bitset>
#include <set>
#include <sstream>
#include <queue>
#define PI 3.14159265358979
#define mp make_pair
#define inf 1e9
//#define M 1000000007
#define M 8888888888
//#define N 1000000009

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;

	n = n % 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		cout << "hon" << endl;
	} else if (n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon" << endl;
	} else if (n == 3) {
		cout << "bon" << endl;
	}
}



Measured memory_bytes: 3660
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    //SUN,MON,TUE,WED,THU,FRI,SAT
    String[] week = {"","SAT","FRI","THU","WED","TUE","MON","SUN"};
    for(int i=0;i<8;i++){
      if(week[i].equals(s))System.out.println(i);
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <list>
#include<vector>
#include <sstream>
#include <stdio.h>
using namespace std;


string A;
string B;


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

	if (A==B)
	{
		cout << 0 << endl;
		return 0;
	}

	int DiffCount = 0;

	for (int i=0;i<A.length();i++)
	{
		DiffCount = A[i] != B[i] ? DiffCount + 1 : DiffCount;
	}


	cout << DiffCount << endl;

	return 0;
}

Measured memory_bytes: 3472
package main

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func printSlice(x []int) {
	for i := range x {
		fmt.Printf("%d", x[i])
		if i < len(x)-1 {
			fmt.Printf(" ")
		}
	}
	fmt.Printf("\n")
}

type sub struct {
	ir int
	il int
	nr int
	nl int
}

func main() {
	input := bufio.NewReader(os.Stdin)

	var S string
	fmt.Fscanf(input, "%s\n", &S)

	nr := 1
	nl := 0
	prev := S[0]
	var subs []sub
	for i := 1; i < len(S); i++ {
		if S[i] == 'R' {
			if prev == S[i] {
				nr++
			} else {
				subs = append(subs, sub{
					il: i - nl,
					ir: i - nl - 1,
					nl: nl,
					nr: nr,
				})
				nr = 1
			}
		} else if S[i] == 'L' {
			if prev == S[i] {
				nl++
			} else {
				nl = 1
			}
		}
		prev = S[i]
	}
	subs = append(subs, sub{
		il: len(S) - nl,
		ir: len(S) - nl - 1,
		nl: nl,
		nr: nr,
	})

	var ans []int
	curr := 0
	for i := range subs {
		ir := subs[i].ir
		il := subs[i].il
		nr := subs[i].nr
		nl := subs[i].nl
		var vr, vl int
		for j := curr; j < curr+nr+nl; j++ {
			if abs(j-ir)%2 == 0 {
				vr++
			} else {
				vl++
			}
		}
		for j := curr; j < curr+nr+nl; j++ {
			if j == ir {
				ans = append(ans, vr)
			} else if j == il {
				ans = append(ans, vl)
			} else {
				ans = append(ans, 0)
			}
		}
		curr += nr + nl
	}
	printSlice(ans)
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
map<ll, ll> prime_factorization(long long n) {
  // map<ll,ll> first=素因数 second=first素因数の数
  map<ll, ll> res;
  for (int i = 2; i  <= n/i; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
int main() {
  ll N;
  cin >> N;
  map<ll, ll> mp = prime_factorization(N);
  ll ans = 0;
  for (auto s : mp) {
    for (int i = 1; i <= s.second; i++) {
      ans++;
      s.second -= i;
    }
  }
  cout << ans << endl;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define Ans(s) cout << s << endl

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> inv;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	map<int, bool> check;

	rep(i, n)
	{
		int val;
		cin >> val;

		if (check[val]) check[val] = false;
		else check[val] = true;
	}

	int ans = 0;

	for (auto i = check.begin(); i != check.end(); i++)
	{
		if (i->second) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4992
N,M=map(int,input().split())
dist=[[9999 for _ in range(N)]for _ in range(N)]
cost=[[9999 for _ in range(N)]for _ in range(N)]
for _ in range(M):
    a,b,c=map(int,input().split())
    cost[a-1][b-1]=c
    cost[b-1][a-1]=c
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c

for k in range(N):
    for i in range(N):
        if i == k:
            continue
        for j in range(N):
            if j == k or j == i:
                continue
            if i <= j:
                continue
            if dist[i][j]>dist[i][k]+dist[k][j]:
                dist[i][j]=dist[i][k]+dist[k][j]
                dist[j][i]=dist[i][k]+dist[k][j]

ans =0
for i in range(N):
    for j in range(N):
        if i <= j:
            continue
        if cost[i][j] ==9999:
            continue
        if cost[i][j] != dist[i][j]:
            ans +=1

print(ans)


Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#define rep(i,n) for(double i=0;i<n;i++)
#define rep1(i,n) for(double i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
vector<double> v;
double bina(int l,int r,double x){
  while(r-l>1){
    int mid=(l+r)/2;
    if(v[mid]<=x){
      l=mid;
    }
    else{
      r=mid;
    }
  }
  if(l==-1) return 0;
  return v[l];
}
double a,b,c,d,e,f;
int main(){
  cin>>a>>b>>c>>d>>e>>f;
  rep(i,1501){
    rep(j,751){
      double g=c*i+d*j;
      if(g<=1500&&g<=f){
	v.push_back(g);
      }
    }
  }
  sort(v.begin(),v.end());
  //  prin(v.size());
  /* rep(i,v.size()){
    cout<<v[i]<<" ";
    }*/
  //  cout<<"\n";
  double res=0,resw=0,ress=0;
  rep(i,31){
    rep(j,31){
      double h=100*a*i+100*b*j;
      if(h<=f){
	double k=bina(-1,v.size(),min(f-h,h*e/100));
	double l=k/(h+k);
	//	prin2(h,k);
	if(res<=l){
	  res=l;resw=h;ress=k;
	}
      }
    }
  }
  prin2(resw+ress,ress);
  

  

  return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

vector<char> odd = {'R', 'U', 'D'};
vector<char> even = {'L', 'U', 'D'};

int main() {

    string S;
    cin >> S;

    bool good = true;

    for (int i = 1; i <= S.length(); ++i) {

        bool ok = false;

        if (i % 2 == 0) {

            for (int j = 0; j < even.size(); ++j) {
                if (S[i-1] == even[j]) {
                    ok = true;
                }
            }

        } else {
            for (int j = 0; j < odd.size(); ++j) {
                if (S[i-1] == odd[j]) {
                    ok = true;
                }
            }
        }

        if (!ok) {
            good = false;
            break;
        }
    }

    if (good) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	int cnt = 0;
	vector<long long> w;
	for (int i = 0; i < s.size(); i++)
	{
		if(s[i] == 'W') {
			w.push_back(i - cnt);
			cnt++;
		}
	}

	long long res = 0;
	for (auto p : w)
	{
		res += p;
	}

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


Measured memory_bytes: 5388
import math
n = int(raw_input())
while(n):
    score = map(int, (raw_input()).split(" "))
    m = sum(score)*1.0/n
    dev = [(s-m)*(s-m) for s in score]
    print math.sqrt(sum(dev)*1.0/n)
    n = int(raw_input())

Measured memory_bytes: 6440
#include <iostream>
#include <vector>
 
using namespace std;
 
int abs(int a){
  return a >= 0 ? a: -a;
}
 
int main(){
  int N;
  vector<int> w;
  cin >> N;
  for(int i=0;i<N;i++){
    int input;
    cin >> input;
    w.push_back(input);
  }
  int ans=10000000000;
  int S1=0,S2=0;
  for(int i=1;i<N;i++){
    for(int j=0;j<=i;j++){
        S1+=w[j];
    }
    for(int j=i+1;j<N;j++){
        S2+=w[j];
    }
  
    int X=abs(S1-S2);
    if(X<ans){
      ans=X;
    }
    S1=S2=0;
  }
  cout << ans;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
 
const int MAX = 1e5+5;
vector<int> graph[MAX];
int visited[MAX];
vector<int> res;
int N, M;
 
void dfs(int cur) {
    res.push_back(cur);
    visited[cur] = true;
    for (int& child : graph[cur]) {
        if (!visited[child]) {
            dfs(child);
            return;
        }
    }
}
 
int main() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    dfs(1);
    reverse(res.begin(), res.end());
    res.pop_back();
    dfs(1);
    cout << res.size() << endl;
    for (int& i : res) cout << i << " ";
    return 0;
}

Measured memory_bytes: 10104
#include <stdio.h>

int main(void) {

	int H = 0;			//??????????????°??????????????°
	int i = 0;
	int W = 0;			//?¨????????????°??????????????°
	int j = 0;

	do{
		scanf("%d",&H);
		scanf("%d",&W);
		for(i = 1 ; i <= H ; i++){
			for(j = 1 ; j <= W ; j++){
				printf("#");
			}
			printf("\n");
		}

		if(W || H){			//0,0??????????????????????????????????????????????????¨????????¨???????????????
			printf("\n");
		}

	}while(W || H);

	return 0;
}

Measured memory_bytes: 572
import math
A,B,H,M=map(int,input().split())
thetaA=360/12*H+360/12*M/60
thetaB=360/60*M
theta=thetaA-thetaB
print(math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(theta))))



Measured memory_bytes: 9392
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative
import           Debug.Trace
import           Text.Printf


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons
getInt = readLn :: IO Int
getIntTuple = (\vec -> (vec VU.! 0, vec VU.! 1)) <$> getIntVector

main = do
  (k,n) <- getIntTuple
  as <- getIntVector
  print $ ans k n as

ans :: Int -> Int -> VU.Vector Int -> Int
ans k n as = k - (loop n 0)
  where
    loop 0 maximumPath = maximumPath
    loop n maximumPath = loop (n-1) $ max maximumPath $ lengthPath n
    lengthPath 1 = k - as VU.! (n-1) + as VU.! 0
    lengthPath n = as VU.! (n-1) - as VU.! (n-2)


Measured memory_bytes: 9340
#include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
int main() {
	double a, b, h, m; cin >> a >> b >> h >> m;
	double a1 = abs(5.0 * (h + m / 60.0) - m);
	double a2 = 60.0 - a1;
	double a3 = 2.0 * PI * min(a1, a2) / 60.0;
	printf("%.9f", sqrt(a * a + b * b - 2 * a * b * cos(a3)));
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll n,a,b,c,d;
string s;
vector<pair<ll,ll>> ren_dot;

int main(){
    cin >> n >> a >> b >> c >> d;
    cin >> s;
    ll cou = 0,cou_dot = 0,cou_dot_first=0;
    bool f = false;
    ll double_sharp_pos = -1;
    for(int i = a-1; i < max(d,c); i++){
        if(s[i] == '#'){
            ++cou;
            if(cou_dot >= 3){
                pair<ll,ll> tmp;
                tmp.first = cou_dot_first;
                tmp.second = i-1;
                ren_dot.push_back(tmp);
            }
            cou_dot = 0;
        }
        else{
            if(cou_dot == 0)    cou_dot_first = i;
            cou = 0;
            ++cou_dot;
        }
        if(cou >= 2){
            double_sharp_pos = i;
            f = true;
            break;
        }
    }
    if(cou_dot >= 3){
        pair<ll,ll> tmp;
        tmp.first = cou_dot_first;
        tmp.second = n-1;
        ren_dot.push_back(tmp);
    }

    if(f && (double_sharp_pos <= c-1 || double_sharp_pos <= d-1)){
        cout << "No\n";
        return 0;
    }

    bool goal_flag = false;

    if(c < d)   cout << "Yes\n";
    else{
        for(int i = 0; i < ren_dot.size(); i++){
            if(ren_dot[i].first <= d-1 && ren_dot[i].first+1 >= b-1){
                if(ren_dot[i].first <= d-1 && ren_dot[i].second >= d-1){
                    if(ren_dot[i].first == d-1) continue;
                }
                cout << "Yes\n";
                return 0;
            }
        }
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 640
# coding:utf-8
n = input()
card = []
for i in range(1,14):
    card.append(('S', str(i)))
for i in range(1,14):
    card.append(('H', str(i)))
for i in range(1,14):
    card.append(('C', str(i)))
for i in range(1,14):
    card.append(('D', str(i)))
array = [raw_input().split() for i in range(n)]
src_set = set(card)
array_set = set(map(tuple, array))
answer = sorted(src_set ^ array_set, key=card.index)
for v1,v2 in answer:
    print v1,v2



Measured memory_bytes: 4676
#include<bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    LL N;
    cin >> N;
    vector<LL>  a(N), b(N);
    for(int i = 0;i < N;i++)    cin >> a[i] >> b[i];
    LL sum = 0;
    for(int i = N-1;i >= 0;i--){
        a[i] += sum;
        LL r = a[i]%b[i];
        if(r)   sum += b[i]-r;
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

int main(){
  int n,k;
  cin >> n >> k;
  cout << (int)pow(k-1,n-1)*k;
  return 0;
}

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

int n;
int a[100100];

main()
{
	int sym=0,ans=1;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(i)
		{
			if(a[i]>a[i-1])
			{
				//printf("%d %d %d\n",a[i],a[i-1],sym);
				if(sym==-1)
				{
					ans++;
					sym=0;
				}
				else
					sym=1;
			}
			else if(a[i]<a[i-1])
			{
				if(sym==1)
				{
					ans++;
					sym=0;
				}
				else
					sym=-1;
			}
		}
	}
	printf("%d",ans);
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>

using namespace std;

int main() {
	long long int n;
	cin >> n;
	long long int i = 100;
	int j = 0;
	while (true) {
		if (n <= i) {
			cout << j;
			return 0;
		}
		i = i * 1.01;
		j++;
	}
}


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

int main() {
  int N,K,X,Y;
  cin >> N>>K>>X>>Y;
  int s=0;
  if(N>K){
  s=K*X+(N-K)*Y;
  cout << s <<endl;
  }
  else{
  s=N*X;
  cout << s <<endl;
  }
}


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

int main() {
	int H, W; cin >> H >> W;

	vector<vector<int>> board(H + 2, vector<int>(W + 2));


	deque<pair<int, int>> dq;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			char c; cin >> c;
			if (c == '#') {
				board[i + 1][j + 1] = 0;
				dq.push_back(make_pair(i + 1, j + 1));
			}
			else board[i+1][j+1] = -1;
		}
		board[i+1][0] = -2;
		board[i+1][W + 1] = -2;
	}

	for (int j = 0; j < W+2; j++) {
		board[0][j] = -2;
		board[H + 1][j] = -2;
	}

	while (dq.size() != 0) {
		pair<int, int> p;
		p = dq.front();
		int h, w;
		h = p.first; w = p.second;
		if (board[h][w - 1] == -1) {
			board[h][w - 1] = board[h][w] + 1;
			dq.push_back(make_pair(h, w - 1));
		}
		if (board[h][w + 1] == -1) {
			board[h][w + 1] = board[h][w] + 1;
			dq.push_back(make_pair(h, w + 1));
		}
		if (board[h - 1][w] == -1) {
			board[h - 1][w] = board[h][w] + 1;
			dq.push_back(make_pair(h - 1, w));
		}
		if (board[h + 1][w] == -1) {
			board[h + 1][w] = board[h][w] + 1;
			dq.push_back(make_pair(h + 1, w));
		}
		dq.pop_front();
	}

	int ans = 0;
	for (int i = 1; i < H+1; i++) {
		for (int j = 1; j < W+1; j++) {
			ans = max(ans, board[i][j]);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 12432
n = int(input())
a = list(map(int, input().split()))
l = [0] * 30
b = []
for i in range(n):
  x = a[i]
  t = ''
  j = 29
  while j >= 0:
    if x < 2**j:
      t += '0'
    else:
      x -= 2**j
      t += '1'
      l[j] += 1
    j -= 1
  b.append(t)
ans = []
for i in range(n):
  t = b[i]
  d = 0
  for j in range(30):
    k = l[j]
    if t[-(j+1)] == '1':
      k += 1
    k %= 2
    d += k * 2**j
  ans.append(d)
print(*ans)


Measured memory_bytes: 129644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    int l,r,d;
    cin >> l >> r >> d;

    int ans =0;
    for(int i = l; i<r+1; i++ ) {
        if(i%d == 0)    ans++;
    }
    
    cout<< ans <<endl;


 return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define N 100009
#define INF 1000000009
#define MOD 1000000007
typedef long long int ll;
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define pf(x) printf("%d",x);
#define pf2(x,y) printf("%d %d\n",x,y);
#define pf3(x,y,z) printf("%d %d %d\n",x,y,z);
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define tr(x) cout<<x<< endl;
#define tr2(x,y) cout<<x<<" "<<y<<" " << endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(x,y,z,a) cout<<x<<" "<<y<<" "<<z<<  " " << a << " " << endl;
ll dp[N][2];
vector<int> v[N];
void dfs(int i,int p){
    dp[i][0]=1;
    dp[i][1]=1;
    for(auto j:v[i]){
        if(j==p)continue;
        dfs(j,i);
        dp[i][0]*=dp[j][1];
        dp[i][1]*=(dp[j][1]+dp[j][0]);
        dp[i][0]%=MOD;
        dp[i][1]%=MOD;
    }
    // tr3(i,dp[i][0],dp[i][1]);
}
int main(){
    int i,j,n,m,t,k,x,y;
    sd(n);
    for(i=1; i<n; i++){
        sd2(x,y);
        v[x].pb(y);
        v[y].pb(x);
    }
    dfs(1,0);
    ll ans=dp[1][0]+dp[1][1];
    tr(ans%MOD);
}


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

int main() {
    ll x, y;
    cin >> x >> y;

    int ans = 1;
    while(x * 2 <= y) {
        x *= 2;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

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

    int a[3*N], i;
    for(i=0; i<3*N; i++) {
        cin >> a[i];
    }

    sort(a, a+3*N, greater<int>());

    long int sum=0;
    int b[2*N];
    memcpy(b, a, sizeof(b));

    for(i=0; i<2*N; i++) {
        if(i%2==1) {
            sum += b[i];
        }
    }

    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 2176
fun main(args: Array<String>) {
  val n = readLine()!!.toLong()
  var q = 1L
  var sum = 0L
  while (q * q <= n) {
    if (n % q != 0L) {
      q++
      continue
    }
    val m = n / q - 1L
    if (q < m) {
      sum += m
    }
    q++
  }
  println(sum)
}

Measured memory_bytes: 31648
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

int main() {
	ll a, b, k, m;
	cin >> a >> b >> k;
	m = b - a + 1;
	if (2 * k >= m) repi(i, a, b + 1) wrln(i);
	else {
		repi(i, a, a + k) wrln(i);
		repi(i, b - k + 1, b + 1) wrln(i);
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[]args){
  	Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = -1;
    if(a<=9&&b<=9)ans = a*b;
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
import java.util.Scanner;
class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] ans = new int[n];

    for(int z = 0; z < n; z++){
      String[] sa;
      String inputa = sc.next();
      sa = inputa.split("");
      int lena = sa.length;

      String[] sb;
      String inputb = sc.next();
      sb = inputb.split("");
      int lenb = sb.length;

      int[][] DP;
      DP = new int[lena][lenb];

      for(int i=0; i<lena; i++){
        for(int j=0; j<lenb; j++){
          DP[i][j] = 0;
        }
      }

      for(int i=0; i < lena; i++){
        if(sa[i].equals(sb[0])){
            for(int j = i; j < lena; j++){
              DP[j][0] = 1;
            }
            break;
        }
      }

      for(int i=0; i < lenb; i++){
        if(sb[i].equals(sa[0])){
            for(int j=i; j < lenb; j++){
              DP[0][j] = 1;
            }
            break;
        }
      }

      for(int i=1; i<lena; i++){
        for(int j=1; j<lenb; j++){
          if(sb[j].equals(sa[i])){
              DP[i][j] = DP[i-1][j-1]+1;
          }
          else if(DP[i-1][j] > DP[i][j-1]){
              DP[i][j] = DP[i-1][j];
          }
          else{
              DP[i][j] = DP[i][j-1];
          }
        }
      }
      ans[z] = DP[lena-1][lenb-1];
    }
    for(int z = 0; z < n; z++){
      System.out.println(ans[z]);
    }
  }
}



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

#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define INF 1000000000

struct Node { int i; int j; int d; };
bool operator<(const Node& m, const Node& n) { return m.d > n.d; }

int H, W, sh, sw, gh, gw;
char S[1001][1001];
int  D[1001][1001];
int  dh[4]{ 0, 1, 0, -1};
int  dw[4]{ 1, 0, -1, 0};

int cannot_move(Node& n) {
  if (n.i < 0 || H <= n.i) return true;
  if (n.j < 0 || W <= n.j) return true;
  if (S[n.i][n.j] == '#')  return true;
  if (D[n.i][n.j] <= n.d)  return true;
  return false;
}

int main() {
  cin >> H >> W >> sh >> sw >> gh >> gw;
  sh--; sw--; gh--; gw--;

  REP(i, H) REP(j, W) cin >> S[i][j];
  REP(i, H) REP(j, W) D[i][j] = INF;

  priority_queue<Node> Q;
  D[sh][sw] = 0;
  Q.push(Node{ sh, sw, 0 });

  while (!Q.empty()) {
    Node m = Q.top(); Q.pop();
    if (D[m.i][m.j] < m.d) continue;

    // cout << endl;
    // REP(i, H) { REP(j, W) { printf("%10d ", D[i][j]); } cout << endl; }

    REP(i, 4) {
      Node n{ m.i + dh[i], m.j + dw[i], m.d };
      if (cannot_move(n)) continue;
      D[n.i][n.j] = n.d;
      Q.push(n);
    }
    REP(i, 5) REP(j, 5) {
      if (i == 2 && j == 2) continue;
      Node n{ m.i + i - 2, m.j + j - 2, m.d + 1 };
      if (cannot_move(n))  continue;
      D[n.i][n.j] = n.d;
      Q.push(n);
    }
  }

  cout << (D[gh][gw] != INF ? D[gh][gw] : -1) << endl;

  return 0;
}

Measured memory_bytes: 8620
#![allow(unused)]

use std::{cmp, collections, fmt, io, iter, ops, str};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($arg: tt)*) => { eprintln!($fmt, $($arg)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt: expr) => {};
    ($fmt: expr, $($arg: tt)*) => {};
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let (a, b, x) = {
        let v = parse_vec::<i32>();
        (v[0], v[1], v[2])
    };

    if a <= x && x <= a + b {
        println!("YES");
    } else {
        println!("NO");
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
package main

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

func main() {
	const valueMax = int(1e5)
	const inf = int(1e18)
	N, W := readI(), readI()
	w, v := make([]int, N+1), make([]int, N+1)
	for i := 1; i <= N; i++ {
		w[i], v[i] = readI(), readI()
	}

	//dp[i][j] = iまでの商品を価値j以上で選んだ際の最小の重量
	dp := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		dp[i] = make([]int, valueMax+1)
		for j := 0; j <= valueMax; j++ {
			dp[i][j] = inf
		}
	}
	dp[0][0] = 0
	for i := 0; i <= N; i++ {
		if i == 0 {
			continue
		}
		for j := 0; j <= valueMax; j++ {
			if j-v[i] >= 0 {
				dp[i][j] = min(dp[i-1][j-v[i]]+w[i], dp[i-1][j])
			} else {
				dp[i][j] = dp[i-1][j]
			}
		}
	}
	ans := valueMax
	for dp[N][ans] > W {
		ans--
	}
	fmt.Println(ans)
}

func min(a ...int) int {
	m := a[0]
	for i := 1; i < len(a); i++ {
		if m > a[i] {
			m = a[i]
		}
	}
	return m
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


Measured memory_bytes: 83808
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;
Node *nil;
Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}
void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}
void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}
void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}
void deleteFirst(void) {
  deleteNode(nil->next);
}
void deleteLast(void) {
  deleteNode(nil->prev);
}
void deleteKey(int key) {
  deleteNode(listSearch(key));
}
void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}
int main(void) {
  int key, n, i;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') insert(key);
    else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L') deleteLast();
      } else deleteKey(key);
    }
  }
  printList();
  return 0;
}


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

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

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    ll ans = 1;
    bool flag = false;
    rep(i, N) {
        ll temp;
        cin >> temp;
        if(temp == 0) {
            cout << 0 << endl;
            return 0;
        }
        if(1000000000000000000 / temp / ans == 0) {
            flag = true;
        } else {
            ans *= temp;
        }
    }
    if(flag) cout << -1;
    else cout << ans;
    cout << endl;
    return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
const int N = 2e4 + 5;
int a[N], b[N], p[N];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++ i) {
		scanf("%d", &p[i]); p[i] --;
		a[i] += i * n;
		b[i] += (n - 1 - i) * n;
		a[p[i]] += i;
	}
	for (int i = 0; i < n; ++ i) printf("%d%c", a[i] + 1, " \n"[i == n - 1]);
	for (int i = 0; i < n; ++ i) printf("%d%c", b[i] + 1, " \n"[i == n - 1]);
	//for (int i = 1; i < n; ++ i) assert(a[p[i - 1]] + b[p[i - 1]] < a[p[i]] + b[p[i]]);
}



Measured memory_bytes: 896
#include <cstdio>

using namespace std;

char s[111];

int main(void) {
  scanf("%s", s);
  bool ok = true;
  const char* y = "YAKI";
  for (int i = 0; i < 4; i++) {
    if (s[i] == 0) {
      ok = false;
      break;
    }
    ok &= s[i] == y[i];
  }
  puts(ok ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <bitset>
#include <map>
#include <list>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <tuple>
#include <utility>

#include <cstdio>
#include <cstdint>

using namespace std;

namespace shamal{
	template<typename F, typename IndexType, typename TargetType>
	pair<bool, IndexType> lower_bound(F const& func, IndexType left, IndexType right, TargetType const& t){
		while(left <= right){
			auto const mid = left + (right - left) / 2;
			auto const val = func(mid);
			if(val > t){
				right = mid - 1;
			}else if(val < t){
				left = mid + 1;
			}else{ //if(left == right)
				right = mid;
			}
		}

		return {func(left) == t, left};
	}

	template<typename F, typename IndexType, typename TargetType>
	pair<bool, IndexType> binary_search(F const& func, IndexType left, IndexType right, TargetType const& t){
		while(left <= right){
			auto const mid = left + (right - left) / 2;
			auto const val = func(mid);
			if(val > t){
				right = mid - 1;
			}else if(val < t){
				left = mid + 1;
			}else{ //if(left == right)
				return {true, mid};
			}
		};

		return {false, left};
	}
};


bool search(int const n, vector<int> const& q, int const bp, int const t){
	if(n == t)
		return true;
	if(bp >= q.size())
		return false;
	return search(n, q, bp+1, t) || search(n + q[bp], q, bp+1, t);
}

int main(void)
{
	int n0, n1;
	cin >> n0;
	vector<int> v0(n0);
	for(int i = 0; i < n0; i++)
		cin >> v0[i];
	sort(v0.begin(), v0.end());
	v0.push_back(0);

	cin >> n1;
	for(int i = 0; i < n1; i++){
		int temp;
		cin >> temp;
		cout << (search(0, v0, 0, temp) ? "yes" : "no" )<< endl;
	}

	return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc129_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int memo(vector<ll>& dp, int i, vector<ll>& c) {
  if (i == 0) return 1;
  if (i < 0) return 0;
  if (dp[i] != -1) return dp[i];

  if (!c[i]) {
    dp[i] = memo(dp, i - 1, c) + memo(dp, i - 2, c);
  } else {
    dp[i] = 0;
  }
  return dp[i] %= MOD;
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M;
  cin >> N >> M;

  vector<ll> c(N + 1, 0);
  rep(i, M) {
    ll j;
    cin >> j;
    c[j]++;
  }

  vector<ll> dp(N + 1, -1);

  ll ans = memo(dp, N, c);
  cout << ans << endl;
}

Measured memory_bytes: 11040
s = list(input())
n = len(s)
c = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        if s[i] == '0':
            s[i + 1] = '1'
        else:
            s[i + 1] = '0'
        c += 1
print(c)

Measured memory_bytes: 3956