akhauriyash/Code-Regression huggingface dataset:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>


int main() {
	int r, g, ans;
	scanf("%d", &r);
	scanf("%d", &g);
	ans = 2 * g - r;
	printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<cstdio>
#include<string>
#include<cstring>
typedef long long  LL;
using namespace std;
const LL INF = 0x3f3f3f3f;

LL n,A,B;
LL d[100009];
bool judge(LL mid)
{
    LL ans=mid;
    for(int i = 1;i<=n;i++)
    {
        LL cn=d[i]-mid*B;
        if(cn>0)
        {
            LL temp=cn/(A-B)+(cn%(A-B)==0?0:1);//TEMP表示当一个怪物被所求值的B打后 是否还需要被A打   这里就差不多应该是来判断A具体攻击谁 攻击几次
            ans-=temp;//ans是一共A攻击的次数，如果A攻击次数归零 还没攻击完 说明这个次数是无法消灭全部的，所以返回falsh
            if(ans<0)
                return false;
        }

    }
    return true;
}

int main()
{


   scanf("%lld%lld%lld",&n,&A,&B);
    LL l=0;
    LL r= INF;
    LL ans=INF;
   for(int i = 1;i<=n;i++)
        cin>>d[i];
    while(l<=r)
    {
        LL mid=(l+r)>>1;
        if(judge(mid)) ans=mid,r=mid-1;
        else l=mid+1;
    }

    printf("%lld\n",ans);

    return 0;


}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int get_group(int x) {
    if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
        return 0;
    } else if (x == 4 || x == 6 || x == 9 || x == 11) {
        return 1;
    } else {
        return 2;
    }
}

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

    cout << (get_group(x) == get_group(y) ? "Yes" : "No") << endl;
    return 0;
};


Measured memory_bytes: 256
N=int(input())

for n in range(N):
    gx,gy =map(int,input().split())
    T=[[0 for i in range(gy+1)] for j in range(gx+1)]
    left=[[0 for i in range(gy+1)] for j in range(gx+1)]
    upper=[[0 for i in range(gy+1)] for j in range(gx+1)]
    p=int(input())
   
    for i in range(p):
        x1,y1,x2,y2=map(int,input().split())
        if x1==x2:
            upper[x1][max(y1,y2)]=1
        if y1==y2:
            left[max(x1,x2)][y1]=1

    for i in range(gx+1):

        for j in range(gy+1):
            if i==0 and j==0:
                T[i][j]=1
                continue

            if i==0 and j>=1 and upper[i][j]==0 and left[i][j]==0:
                T[i][j]=T[i][j-1]
                continue

            if i>=1 and j==0 and upper[i][j]==0 and left[i][j]==0:
                T[i][j]=T[i-1][j]
                continue
                
            if left[i][j]==1 and upper[i][j]==1:
                    T[i][j]=0
            elif left[i][j]==0 and upper[i][j]==1:
                    T[i][j]=T[i-1][j]
            elif left[i][j]==1 and upper[i][j]==0:
                    T[i][j]=T[i][j-1]
            else:
                T[i][j]=T[i-1][j]+T[i][j-1]

    if T[gx][gy]==0:
        print("Miserable Hokusai!")
    else:
        print(T[gx][gy])


Measured memory_bytes: 5628
using System;
using System.Linq;
class P{
  static void Main(){
    var n=Console.ReadLine().Split().Select(int.Parse).ToArray();
    var s=new char[n[0]][];
    for(int i=0;i<n[0];i++)s[i]=Console.ReadLine().ToCharArray();
    for(int i=0;i<n[0];i++){
      if(s[i].Any(x=>x!='.')){
        for(int g=0;g<n[1];g++){
          bool b=false;
          for(int f=0;f<n[0];f++)b=b|(s[f][g]=='#');
          if(b)Console.Write(s[i][g]);
        }
      Console.Write("\n");
      } 
    }
  }
}

Measured memory_bytes: 13396
#! python3
# print_a_chessboard.py

while True:
    H, W = [int(x) for x in input().split(' ')]
    if H == 0 and W == 0: break

    for i in range(H):
        row = ''
        for j in range(W):
            if ((i%2) + (j%2))%2:
                row += '.'
            else:
                row += '#'
        print(row)
    print('')



Measured memory_bytes: 5624
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define INT_DMAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


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

    std::vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    int sum = 0;
    int temp = 0;
    for (int i = 0; i < n; i++) {
        if (temp > 0 && p[i] != i) {
            sum += temp / 2 + temp % 2;
            temp = 0;
        } else if (p[i] == i) {
            temp++;
        }
    }
    if (temp > 0) {
        sum += temp / 2 + temp % 2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cassert>
using namespace std;

void read(int &x)
{
    int f=1;x=0;char s=getchar();
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    x*=f;
}

const int N = 5000;
char a[N+3];
char ans[N+3][N+3];
char mnc;
int n,m,num;

bool cmp(int x,int y)
{
    for(int i=1; i<=n; i++)
    {
        if(ans[x][i]<ans[y][i]) return true;
        if(ans[x][i]>ans[y][i]) return false;
    }
    return false;
}

int main()
{
    scanf("%d%d",&n,&m);
    scanf("%s",a+1);
    mnc = 'z'; for(int i=1; i<=n; i++) mnc = min(mnc,a[i]);
    if(m>=14) {for(int i=1; i<=n; i++) printf("%c",mnc); return 0;}
    int len = 0,mxl = 0;
    for(int i=1; i<=n; i++)
    {
        if(a[i]!=mnc) len = 0;
        else len++;
        if(len>mxl) {mxl = len;}
    }
    len = 0; num = 0;
    for(int i=1; i<=n; i++)
    {
        if(a[i]!=mnc) len = 0;
        else len++;
        if(i==n)
        {
            num++;
            int tmp = min(n,len*(1<<m));
            for(int j=1; j<=tmp; j++) ans[num][j] = mnc;
            for(int j=tmp+1,k=n-len; j<=n; j++,k--) ans[num][j] = a[k];
        }
        if(len==mxl)
        {
            num++;
            int tmp = min(n,len*(1<<m-1));
            for(int j=1; j<=tmp; j++) ans[num][j] = mnc;
            for(int j=tmp+1,k=i+1; j<=n; j++,k++)
            {
                ans[num][j] = a[k<=n?k:2*n+1-k];
            }
        }
    }
//  for(int i=1; i<=num; i++) {for(int j=1; j<=n; j++) printf("%c",ans[i][j]); puts("");}
    int fans = 1;
    for(int i=1; i<=num; i++)
    {
        if(cmp(i,fans))
        {
            fans = i;
        }
    }
    for(int j=1; j<=n; j++) printf("%c",ans[fans][j]); puts("");
    return 0;
}

Measured memory_bytes: 8448
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int P=sc.nextInt();
		int Q=sc.nextInt();
		int R=sc.nextInt();
		int[] min= {P,Q,R};
	
	
	if(min[0]>=min[1]) {
		int temp=min[1];
		min[1]=min[0];
		min[0]=temp;
	}
	if(min[1]>=min[2]) {
		int temp=min[2];
		min[2]=min[1];
		min[1]=temp;
	}
	if(min[0]>=min[1]) {
		int temp=min[1];
		min[1]=min[0];
		min[0]=temp;
	}
	System.out.println(min[0]+min[1]);

	}
}



Measured memory_bytes: 21844
#include <stdio.h>
int main(void)
{
  int i,x,y,flag;
  scanf("%d%d",&x,&y);
  switch(x)
  {
    case 2:
      flag=0; break;
    case 4:
    case 6:
    case 9:
    case 11:
      if(y>x)
      {
        if(y==6 || y==9 || y==11)
        {
          flag=1;
        }
        else
        {
          flag=0;
        }
      }
      else
      {
        flag=0;
      }
      break;
    default :
      if(y>x)
      {
        if(y==3 || y==5 || y==7 || y==8 || y==10 || y==12)
        {
          flag=1;
        }
        else
        {
          flag=0;
        }
      }
      else
      {
        flag=0;
      }
      break;
  }
  if(flag)
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

struct Card
{
  char suit;
  int number;
};

/*--- Quick sort ---*/
int partition(Card cards[], int begin_i, int end_i)
{
  int x = cards[end_i].number;
  int i = begin_i;

  for (int j = begin_i; j < end_i; ++j)
  {
    if (cards[j].number <= x)
    {
      std::swap(cards[i], cards[j]);
      ++i;
    }
  }

  std::swap(cards[i], cards[end_i]);

  return i;
}

void quick_sort(Card cards[], int begin_i, int end_i)
{
  if (begin_i < end_i)
  {
    int point_i = partition(cards, begin_i, end_i);
    quick_sort(cards, begin_i, point_i - 1);
    quick_sort(cards, point_i + 1, end_i);
  }
}
/*--- Quick sort ---*/

/*--- Merge sort ---*/
void merge(Card cards[], int left, int mid, int right)
{
  int n1 = mid - left;
  int n2 = right - mid;

  Card L[n1 + 1];
  for (int i = 0; i < n1; ++i)
  {
    L[i] = cards[left + i];
  }
  L[n1].number = 1000000000 + 1;

  Card R[n2 + 1];
  for (int i = 0; i < n2; ++i)
  {
    R[i] = cards[mid + i];
  }
  R[n2].number = 1000000000 + 1;

  int i = 0;
  int j = 0;
  for (int k = left; k < right; ++k)
  {
    if (L[i].number <= R[j].number)
    {
      cards[k] = L[i];
      ++i;
    }
    else
    {
      cards[k] = R[j];
      ++j;
    }
  }
}

void merge_sort(Card cards[], int left, int right)
{
  if (left + 1 < right)
  {
    int mid = (left + right) / 2;
    merge_sort(cards, left, mid);
    merge_sort(cards, mid, right);
    merge(cards, left, mid, right);
  }
}
/*--- Merge sort ---*/

bool match_cards(Card cards1[], Card cards2[], int n)
{
  for (int i = 0; i < n; ++i)
  {
    if (cards1[i].suit != cards2[i].suit ||
        cards1[i].number != cards2[i].number)
    {
      return false;
    }
  }
  return true;
}

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

  Card cards_qs[n];
  for (int i = 0; i < n; ++i)
  {
    std::cin >> cards_qs[i].suit >> cards_qs[i].number;
  }

  Card cards_ms[n];
  for (int i = 0; i < n; ++i)
  {
    cards_ms[i] = cards_qs[i];
  }

  quick_sort(cards_qs, 0, n - 1);
  merge_sort(cards_ms, 0, n);

  if (match_cards(cards_qs, cards_ms, n))
  {
    std::cout << "Stable" << std::endl;
  }
  else
  {
    std::cout << "Not stable" << std::endl;
  }

  for (int i = 0; i < n; ++i)
  {
    std::cout << cards_qs[i].suit
              << ' '
              << cards_qs[i].number
              << std::endl;
  }

  return 0;
}



Measured memory_bytes: 5404
use proconio::{fastout, input};
use std::cmp;

#[fastout]
fn main() {
    input! {
        n: usize,
        r#as: [f64; n],
    }

    let r#as = r#as
        .into_iter()
        .map(|a| {
            let mut a = (10f64.powi(9) * a + 0.1).floor() as u64;
            let e1 = a.trailing_zeros() as usize;
            let mut e2 = 0;
            while a % 5 == 0 {
                a /= 5;
                e2 += 1;
            }
            (e1, e2)
        })
        .collect::<Vec<_>>();

    let mut count = vec![vec![0; 19]; 19];
    for (e1, e2) in r#as {
        count[cmp::min(e1, 18)][cmp::min(e2, 18)] += 1u64;
    }

    let mut ans = 0;
    for i1 in 0..=18 {
        for i2 in 0..=18 {
            for j1 in 0..=18 {
                for j2 in 0..=18 {
                    if i1 + i2 >= 18 && j1 + j2 >= 18 {
                        ans += if (i1, j1) == (i2, j2) {
                            let count = count[i1][j1];
                            count * count.saturating_sub(1)
                        } else {
                            count[i1][j1] * count[i2][j2]
                        };
                    }
                }
            }
        }
    }

    debug_assert_eq!(ans % 2, 0);
    ans /= 2;

    println!("{}", ans);
}


Measured memory_bytes: 9768
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

string target;
int ts;
bool check(string& s1) {
	rep(j, s1.size()) {
		if (s1[j] == target[0]) {
			for (int k = 1; j + k*(ts - 1) < s1.size(); k++) {
				bool correct = true;
				REP(l, 1, ts) {
					if (s1[j + k*l] != target[l]) {
						correct = false;
						break;
					}
				}
				if (correct) return true;
			}
		}
	}
	return false;
}

signed main(void)
{
	int N;
	cin >> N;
	cin >> target;
	int cnt = 0;
	ts = target.size();
	rep(i, N) {
		string s1;
		cin >> s1;
		if (check(s1)) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1220
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char c[1000000];
int main(){
  
  int o,flag,ma=0;
  scanf("%s",c);

  for(int i=1;i<strlen(c)-1;i++){
    if(c[i] == 'O'){
      o = 1;
      for(int j=i+1;j<strlen(c)-1;j++){
	if(c[j] == 'O') o++;
	else break;
      }
      flag = 0;
      for(int j=1;j<=o;j++){
	if(!(c[i-j]=='J'&&c[i+o-1+j]=='I')){
	  flag++;
	  break;
	}
      }
      if(flag == 0){
	ma = max(ma,o);
      }
      i += o-1;
    }
  }

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

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

long long spf[1000009];

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mn=LLONG_MAX;
        long long cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;


        /*long long x,y,z,mx=1000002,lp,lim,tp; lim=sqrt(mx)+9; spf[1]=1; spf[2]=2;

        for(lp=3; lp<=mx; lp+=2)
        {
        if(spf[lp]==0)
        {
            spf[lp]=lp;

            if(lp<=lim)
            {
                y=lp << 1;

                for(tp=lp+y; tp<=mx; tp+=y)
                {
                    if(spf[tp]==0){  spf[tp]=lp;  }
                }

            }

        }

       }*/


        scanf("%lld %lld",&a,&b);
        //fr=min(a,b); sc=max(a,b);

        n=__gcd(a,b);

        if(n%2==0)
        {
            ans++;
            while(n%2==0)
            {
                n=n/2;
            }
        }

        for(i=3;i*i<=n;i++)
        {

            if(n%i==0)
            {
                ans++;

                while(n%i==0){  n=n/i;  }

            }


        }

        if(n>1)ans++;

        ans++;  printf("%lld\n",ans);


        /*for(i=1;i*i<=fr;i++)
        {
            if(fr%i==0)
            {
                cnt++;

                j=fr/i;

                if(sc%i==0){ mp[i]++;  if(i<=mx){   if(spf[i]==i && mp[i]==1)ans++;  }  }
                if(sc%j==0){ mp[j]++;  if(j<=mx){   if(spf[j]==j && mp[j]==1)ans++;  }  }

            }

        }

        if(fr==sc && fr>mx && cnt==1)ans++;

        printf("%lld\n",ans);*/










    return 0;
}





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

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

if(max(a,c)-min(a,c)<=d){
  cout << "Yes" << endl;
}else if(max(a,b)-min(a,b)<=d && max(c,b)-min(c,b)<=d ){
  cout << "Yes" << endl;
}else{
  cout << "No" << endl;
}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int		H, W;

	for (;;)
	{
		cin >> H >> W;

		if ((H == 0) && (W == 0))
			break;

		string		str("###");
		for (int i = 3; i < W; i++)
			str += "#";
		str += "\n";

		string		str2("#.");
		for (int i = 2; i < W - 1; i++)
			str2 += ".";
		str2 += "#\n";

		cout << str;
		for (int i = 1; i < H - 1; i++)
		{
			cout << str2;
		}
		cout << str << "\n";
	}

	return 0;
}

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

int a[60], b[60], c[60], d[60], N, M, Q;

int dfs(int u, vector<int> v) {
    v.push_back(u);

    if (v.size() == N) {
        // rep(i, 0, N) cout << v[i] << " ";
        // cout << endl;

        int ret = 0;
        rep(i, 0, Q) {
            if (v[b[i]] - v[a[i]] == c[i]) ret += d[i];
        }
        return ret;
    }

    // if (v.back() + 1 == M) return 0;

    int ret = 0;
    for (int i = v.back(); i < M; i++) {
        chmax(ret, dfs(i, v));
    }
    return ret;
}

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

    cin >> N >> M >> Q;
    rep(i, 0, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--, b[i]--;
    }

    int ans = 0;
    rep(i, 0, M) chmax(ans, dfs(i, vi{}));

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
from heapq import heappush, heappop

H = []
while True:
    com = input().split()
    if com[0] == 'insert':
        key = int(com[1])
        heappush(H, -key)
    elif com[0] == 'extract':
        print(-heappop(H))
    elif com[0] == 'end':
        break


Measured memory_bytes: 45304
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  int N, M;
  cin >> N >> M;
  priority_queue<ll> pq;
  REP(i, N) {
    ll A;
    cin >> A;
    pq.push(A);
  }

  REP(i, M) {
    ll A = pq.top(); pq.pop();
    A /= 2;
    pq.push(A);
  }

  ll ans = 0;
  REP(i, N) {
    ans += pq.top(); pq.pop();
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1400
from collections import deque

h, w = map(int, input().split())
m = [list(input()) for _ in range(h)]
D = [(-1, 0), (0, -1), (1, 0), (0, 1)]


def bfs(i, j):
    dist = [[0] * w for _ in range(h)]
    que = deque()
    que.append((i, j))
    dist[i][j] = 1

    while que:
        nx, ny = que.pop()
        for dx, dy in D:
            if nx + dx < 0 or ny + dy < 0 or nx + dx >= h or ny + dy >= w:
                continue
            if m[nx + dx][ny + dy] == "#":
                continue
            if dist[nx + dx][ny + dy] != 0:
                continue

            que.appendleft((nx + dx, ny + dy))
            dist[nx + dx][ny + dy] = 1 + dist[nx][ny]
    mx = 0
    for i in dist:
        mx = max(mx, max(i))
    return mx


ans = 0
for i in range(h):
    for j in range(w):
        if m[i][j] == ".":
            ans = max(ans, bfs(i, j))

print(ans - 1)


Measured memory_bytes: 74532
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <sstream>
#include <fstream>
#include <float.h>
#include <cmath>
#include <cstring>

using namespace std;

#define FOR(i,n) for(i=0;i<n;++i)
#define INF 1e9

int i,j;

int main(void){
    
    int n;
    cin >> n;
    unsigned long long power=1;
    for(i=2;i<=n;++i){
        power*=i;
        power%=1000000007;
    }
    //unsigned long long ans = power%(1e9+7);
    cout<<power;
    
    
    return 0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=1;i<N;i++)

signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  int ans=0;
  if(A*C<=B)ans=C;
  else ans=B/A;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	char cloud[1000][1000];
	int i,j,m,n,sum=0;
	scanf("%d %d",&m,&n);
	for(i=0;i<=m-1;i++){
		scanf("%s",cloud[i]);
	}
	for(i=0;i<=m-1;i++){
		sum=1000000;
		for(j=0;j<=n-1;j++){
			if(cloud[i][j]=='c')  sum=0;
			  else sum++;
			  if(sum>1000000) printf("-1");
			  else printf("%d",sum);
			  if(j<n-1) printf(" ");
		}
		printf("\n");
	} 
	return 0;
}

Measured memory_bytes: 1136
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 1e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int arr[N];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);	
	int n, k, ans = 0, sum = 0;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> arr[i];
	}
	for(int i = 50; i >= 0; i--){
		int count = 0;
		for(int j = 1; j <= n; j++){
			if((arr[j] >> i) & 1){
				count++;
			}
		}
		if(2LL * count < n && (sum + (1LL << i)) <= k){
			sum += (1LL << i);
		}
	}
	for(int i = 1; i <= n; i++){
		ans += (arr[i] ^ sum);
	}
	cout << ans;
}

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

int main()
{
	int n, cnt = 0;
	vector<int> p;

	cin >> n;
    
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		p.push_back(x);
	}

	for (int i = 1; i < n - 1; i++) {
		if (max({ p.at(i - 1), p.at(i), p.at(i + 1) }) != p.at(i) && min({ p.at(i - 1), p.at(i), p.at(i + 1) }) != p.at(i))
			cnt++;
	}

	cout << cnt << endl;

	return 0;
	
}

Measured memory_bytes: 256
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>

int readint()
{
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}

const int maxn=100005;
int n,m;
ll ans=(ll)INF*(ll)INF;
int ar[maxn];
pll coef[maxn*8],cons[maxn*8];//first tree.value second tree.tag

void Push(int node,pll tree[]){
	ll add=tree[node].se;
	if(add){
		tree[node*2].se+=add;
		tree[node*2+1].se+=add;
		tree[node].fi+=add;
		tree[node].se=0;
	}
}

void Pull(int node,pll tree[]){
	tree[node].fi=tree[node*2].fi+tree[node*2+1].fi;
}

void update(int l,int r,int vl,int vr,int node,pll tree[],int val){
	if(l>vr||r<vl)return;
	if(l>=vl&&r<=vr){
		tree[node].se+=val;
		Push(node,tree);
		return;
	}
	Push(node,tree);
	int mid=(l+r)>>1;
	update(l,mid,vl,vr,node*2,tree,val);
	update(mid+1,r,vl,vr,node*2+1,tree,val);
	Pull(node,tree);
}

ll query(int l,int r,int vl,int vr,int node,pll tree[]){
	if(l>vr||r<vl)return 0;
	if(l>=vl&&r<=vr)return tree[node].fi+tree[node].se;
	int mid=(l+r)>>1;
	Push(node,tree);
	return query(l,mid,vl,vr,node*2,tree)+query(mid+1,r,vl,vr,node*2+1,tree);
}

void add_ans(int a,int b){
	if(a<b){
		update(1,m,1,a,1,coef,b-a);
		update(1,m,a+1,b,1,cons,-1);
		update(1,m,a+1,b,1,coef,1+b);
		update(1,m,b+1,m,1,coef,b-a);
	}
	else{
		update(1,m,a+1,m,1,coef,1+m+b);
		update(1,m,a+1,m,1,cons,-1);
		update(1,m,1,b,1,coef,1+b);
		update(1,m,1,b,1,cons,-1);
		update(1,m,b+1,a,1,coef,m-a+b);
	}
}

int main(){
	scanf("%d%d",&n,&m);
	rep(i,n)scanf("%d",&ar[i]);
	rep(i,n-1)add_ans(ar[i],ar[i+1]);
	REP(i,m){
		ll co=query(1,m,i,i,1,coef);
		ll cs=query(1,m,i,i,1,cons);
		ll cur=co+cs*i;
//		cout<<co<<" "<<cs<<" "<<cur<<endl;
		ans=min(cur,ans);
	}
	printf("%lld",ans);
	return 0;
}

/*
4 6
1 5 1 4
10 10
10 9 8 7 6 5 4 3 2 1
*/

Measured memory_bytes: 21120
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

ll power(ll n, ll k) {
    if(k == 0) {
        return 1;
    } else if(k % 2 == 1) {
        return power(n, k - 1) * n;
    } else {
        ll t = power(n, k / 2);
        return t * t;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    while(power(k, ans) <= n) {
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//
// Created by kashi on 27-07-2020.
//
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl
#define int long long
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss<p2.ss;
}
int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

int32_t main() {
    int N=1e9 +7;
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++) {
        cin >> a[i];
        sum += a[i];
    }
    sum%=N;
    int ans=0;
    for(int i=0;i<n-1;i++){
        sum-=a[i];
        if(sum<0)
            sum+=N;
        ans+=a[i]*sum;
        ans=ans%N;
    }
    cout<<ans<<Endl;
    return 0;
}


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

int main(){
  int h,w;
  cin >> h >> w;
  
  string board[h];
  for(int i=0;i<h;i++) cin >> board[i];
   int dx[8] = {1,0,-1,0,1,-1,-1,1};
   int dy[8] = {0,1,0,-1,1,1,-1,-1};
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(board[i][j] == '#')continue;
      
      int num = 0;
      for(int d=0;d<8;++d){
         int ni = i+dy[d];
         int nj = j + dx[d];
        
        if(ni<0 || h <=ni)continue;
        if(nj<0 || w <= nj)continue;
        if(board[ni][nj] == '#')num++;
      }
      
      board[i][j] = char(num + '0');
    }
  }
  for(int i=0;i<h;i++){
    cout << board[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	long long int arr[105];
	long long int temp = 0;
	int ctr =  0;
	scanf("%d", &n);
	for(int i = 0; i < n;i++){
		scanf("%lld", &arr[i]);
	}
	for(int j = 0;j < n - 1;j++){
		for(int k = 0;k < n - j - 1;k++){
			if(arr[k] > arr[k+1]){
				temp = arr[k];
				arr[k] = arr[k+1];
				arr[k+1] = temp;
			}
		}
	}
for(int i = 0; i < n;i++){
	for(int j = i + 1;j<n;j++){
		for(int k = j + 1;k < n;k++){
			if(arr[i] != arr[j] && arr[j] != arr[k] && arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] && arr[k] + arr[j] > arr[i]){
				ctr++;
			}
		}
}
}
printf("%d", ctr);
return 0;
}


Measured memory_bytes: 1732
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;


const int N = 123;
int a[N];
int main()  {
	int n;
	RD(n);
	for(int i = 1; i <= n; i ++) RD(a[i]);
	LL ans = 1LL << 60;
	for(int num = -100; num <= 100; num ++) {
		LL sum = 0;
		for(int i = 1; i <= n; i ++) sum += (num - a[i]) * (num - a[i]);
		ans = min(ans, sum);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int>v;
int main(){
  int a,b,c,k,p,ans;
  cin >>a>>b>>c>>k;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  sort(v.begin(),v.end());
  p=1;
  for(int i=1;i<=k;i++){
    p*=2;
  }
  ans=v.at(0)+v.at(1)+(p*v.at(2));
  cout <<ans<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf (1e9+10)
using namespace std;
const int maxn=810;
int n,m,k;
char cmap[maxn][maxn];
pair<int,int> start;
queue<pair<int,int> > q;
bool firach[maxn][maxn];
int step[maxn][maxn];
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
bool isvalid(int x,int y)
{
	return x>=0&&x<n&&y>=0&&y<m;
}
void bfs()
{
	while(!q.empty())
	{
		pair<int,int> t=q.front();
		q.pop();
		int nx=t.first,ny=t.second;
		for(int i=0;i<4;i++)
		{
			int tx=nx+dx[i],ty=ny+dy[i];
			if(!isvalid(tx,ty))
				continue;
			if(firach[tx][ty])
				continue;
			if(cmap[tx][ty]=='#')
				continue;
			if(step[nx][ny]==k)
				continue;
			firach[tx][ty]=true;
			q.push(make_pair(tx,ty));
			step[tx][ty]=step[nx][ny]+1;
		}
	}
}
int MinDir(int x,int y)
{
	int a1=x/k;
	if(x%k)
		++a1;
	int a2=(n-x-1)/k;
	if((n-x-1)%k)
		++a2;
	int a3=y/k;
	if(y%k)
		++a3;
	int a4=(m-y-1)/k;
	if((m-y-1)%k)
		++a4;
	return min(a1,min(a2,min(a3,a4))); 
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++)
		scanf("%s",cmap[i]);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		{
			if(cmap[i][j]=='S')
			{
				start=make_pair(i,j);
			}
			step[i][j]=inf;
		}
	q.push(start);
	firach[start.first][start.second]=true;
	step[start.first][start.second]=0;
	bfs();
	int ans=inf;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			if(firach[i][j])
				ans=min(ans,MinDir(i,j));
	printf("%d",ans+1);
	return 0;
}

Measured memory_bytes: 4096
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define debug(x) cout<<#x<<": "<<x<<endl
#define MOD 1000000007

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

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    const int MAX_N = 100000;
    int H, W, N;
    int a[MAX_N], b[MAX_N];
    cin >> H >> W >> N;
    map<P, bool> isblack;
    REP(i, N) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        isblack[P(a[i], b[i])] = true;
    }
    ll ret[10];
    REP(i, 10) ret[i] = 0;
    REP(k, N) {
        REP(i_, 3) {
            REP(j_, 3) {
                int y = a[k] - i_;
                int x = b[k] - j_;
                if (y < 0 || y + 2 >= H || x < 0 || x + 2 >= W) {
                    continue;
                }
                int nblack = 0;
                REP(i, 3) {
                    REP(j, 3) {
                        int ny = y + i;
                        int nx = x + j;
                        if (isblack.count(P(ny, nx)) == 1) {
                            nblack++;
                        }
                    }
                }
                ret[nblack]++;
            }
        }
    }

    FOR(i, 1, 10) ret[i] /= i;
    ret[0] = ll(H - 2) * (W - 2);
    FOR(i, 1, 10) ret[0] -= ret[i];
    REP(i, 10) cout << ret[i] << endl;

    return 0;
}


Measured memory_bytes: 7296
N = int(input())
H = list(map(int, input().split()))

INF = 10 ** 18

dp = [0] + [INF] * (N - 1)

for n in range(1, N):
	dp[n] = min(dp[n], dp[n - 1] + abs(H[n] - H[n - 1]))
	if 1 < n:
		dp[n] = min(dp[n], dp[n - 2] + abs(H[n] - H[n - 2]))
	#print(dp)
print(dp[N - 1])


Measured memory_bytes: 13924
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static class Edge {
        int u;
        int v;
        int w;
        int id;

        public Edge(int u, int v, int w, int id) {
            this.u = u;
            this.v = v;
            this.w = w;
            this.id = id;
        }
    }

    public static class Node {
        List<Edge> edge = new LinkedList<>();
    }

    public static void main(String[] args) {

        int N;
        Node[] node;
        int[] vst;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            node = new Node[N];
            vst = new int[N - 1];
            for (int i = 0; i < N; i++) {
                node[i] = new Node();
            }
            for (int i = 0; i < N - 1; i++) {
                int u = sc.nextInt();
                int v = sc.nextInt();
                int w = sc.nextInt();
                Edge e = new Edge(u, v, w, i);
                node[u - 1].edge.add(e);
                node[v - 1].edge.add(e);
            }
        }
        int[] distans = new int[N];
        Deque<Integer> queue = new LinkedList<>();
        queue.push(1);
        distans[0] = 0;
        Integer target;
        while ((target = queue.pollFirst()) != null) {
            List<Edge> list = node[target - 1].edge;
            for (Edge e : list) {
                if (vst[e.id] != 0) {
                    continue;
                } else {
                    int d = (distans[target - 1] + e.w) % 2;
                    int i;
                    if (e.u != target) {
                        i = e.u;
                    } else {
                        i = e.v;
                    }
                    queue.addLast(i);
                    distans[i - 1] = d;
                    vst[e.id] = 1;
                }
            }
        }
        for (int i : distans) {
            System.out.println(i % 2);
        }
    }

}


Measured memory_bytes: 112376
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef long long lld;
typedef long double lf;
typedef unsigned long long uld;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}
namespace IO{
    char nc(){ static char bf[100000],*p1=bf,*p2=bf; return p1==p2&&(p2=(p1=bf)+ fread(bf,1,100000,stdin),p1==p2)?EOF:*p1++; }
    int rd(){ int res=0; char c=getchar(); while(!isdigit(c))c=getchar(); while(isdigit(c))res=res*10+c-'0',c=getchar(); return res; }
}/*}}}*/
/******************heading******************/
const int SZ=1000039;

struct point{
    int x,y;
    point(int _x=0,int _y=0){x=_x,y=_y;}
    void read(){scanf("%d%d",&x,&y);}
}p[100];
int n;

struct hash_map{
    struct data{int nex;lld u;int v;};
    data e[SZ];
    int h[SZ],le;
    int hash(lld u){ return (u%SZ+SZ)%SZ; }
    int & operator[](lld u){
        int hu=hash(u);
        for(int i=h[hu];i;i=e[i].nex)
            if(e[i].u==u)return e[i].v;
        e[++le]=(data){h[hu],u,0},h[hu]=le;
        return e[le].v;
    }
}h;
lld td(int x,int y){
    return 1ll*x*1000000001+y;
}

int go(int a,int b){
    int res=n;
    FOR(i,1,n){
        if(h[td(p[i].x+a,p[i].y+b)])res--;
    }
    return res;
}

int main(){
    int ans=0x3f3f3f3f;
    scanf("%d",&n);
    FOR(i,1,n)p[i].read();
    if(n==1)return puts("1"),0;
    FOR(i,1,n)h[td(p[i].x,p[i].y)]++;
    FOR(i,1,n)FOR(j,1,n){
        if(i==j)continue;
        int a=p[i].x-p[j].x,b=p[i].y-p[j].y;
        ans=min(ans,go(a,b));
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 6528
#ifdef DBG1
#define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>

#ifdef DBG1
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
#define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

bool solve() {
  int x;
  if (scanf("%d", &x) != 1) return false;

  int d = __gcd(x, 360);
  printf("%d\n", 360 / d);
  return true;
}

int main() {
  while (solve());
  return 0;
}


Measured memory_bytes: 3820
/// author: Mr.Hakimov

#include <bits/stdc++.h>
#include <chrono>

#define fi first
#define se second
#define pb push_back
#define pf push_front
#define Pb pop_back
#define Pf pop_front
#define all(x) (x).begin(), (x).end()
#define fin(s) freopen(s, "r", stdin);
#define fout(s) freopen(s, "w", stdout);

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll;
typedef long double ld;

int TN = 1;

void solve() {
	int n;
	ll k;
	
	cin >> n >> k;
	
	vector<int> a(n + 1);
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	
	int i = 1;
	vector<int> used(n + 1, false);
	vector<int> b;
	while (!used[i]) {
		b.pb(i);
		used[i] = true;
		
		i = a[i];
	}
	
	vector<int> c;
	int j = 0;
	int m = (int) b.size();
	while (j < m && b[j] != i) {
		c.pb(b[j++]);
	}
	
	vector<int> d;
	while (j < m) {
		d.pb(b[j++]);
	}
	
	// for (auto aa : c) {
		// cout << aa << ' ';
	// }
	// cout << endl;
	// for (auto aa : d) {
		// cout << aa << ' ';
	// }
	// cout << endl;
	
	int s1 = (int) c.size();
	int s2 = (int) d.size();
	
	if (k < s1) {
		cout << c[((k - 1) + 1) % s1];
	} else {
		k -= s1;
		
		cout << d[(((k - 1) % s2) + 1) % s2];
	}
}

int main() {
    auto start = chrono::steady_clock::now();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    /// =========================================
    /// fin("input.txt"); fout("output.txt");
    /// fin("file.in"); fout("file.out");
    /// cin >> TN;
    /// =========================================

    while (TN--) {
        solve();
    }

    auto finish = chrono::steady_clock::now();
    auto elapsed_ms = chrono::duration_cast<chrono::milliseconds>(finish - start);
    cerr << endl << "Time: " << elapsed_ms.count() << " ms\n";

    return 0;
}


Measured memory_bytes: 7132
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<string>
#include<iomanip>

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n-1) {
		int buffer;
		cin >> buffer;
		a[buffer - 1]++;
	}
	rep(i, n) {
		cout << a[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3996
N = int(input())

max_num = -1
max_count = -1
for num in range(1,N+1):
    num_orig = num
    count = 0
    while 1:
        amari = num%2
        if amari == 0:
            num = num // 2
            count += 1
        else:
            break
    if count > max_count:
        max_num = num_orig
        max_count = count

print(max_num)

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

int GetDigit(int num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}


int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1; i<=n; i++){
        if(GetDigit(i)%2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    vector<int> a(3);
    rep(i, 3) cin >> a[i];
    int K;
    cin >> K;
    sort(all(a), greater<int>());
    rep(i, K){
        a[0] *= 2;
    }
    cout << a[0] + a[1] + a[2] << endl;
}

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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int a, b; cin >> a >> b;
  if(a <= b) {
    cout << a << endl;
  } else {
    cout << a - 1 << endl;
  }
}


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

int main() {

    int N;
    std::cin >> N;
    std::vector<std::vector<int>> T(N);
    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        std::cin >> a >> b;
        T[a - 1].push_back(b - 1);
        T[b - 1].push_back(a - 1);
    }
    std::vector<int> c(N);
    for (auto& v : c)std::cin >> v;
    std::vector<int> ans(N);
    std::sort(c.begin(), c.end());
    int M = std::accumulate(c.begin(), std::prev(c.end()), 0);
    std::vector<int> parent(N, -1);
    std::stack<int> s;
    s.push(0);
    while (!s.empty()) {
        int now = s.top();
        s.pop();
        ans[now] = c.back();
        c.pop_back();
        for (auto& next : T[now]) {
            if (next == parent[now])continue;
            parent[next] = now;
            s.push(next);
        }
    }
    std::cout << M << "\n";
    for (auto& v : ans)std::cout << v << " "; std::cout << std::endl;
}

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

using namespace std;

//#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int x, t;

int main(int argc, char const* argv[])
{
        cin >> x >> t;
        cout << (x - t < 0 ? 0 : x - t) << endl;
        return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int M = sc.nextInt();

    if (M > 24 ){
      System.out.println(24 + Math.abs(24 - M)) ;
    }
    else {
      System.out.println(Math.abs(M - 24) + 24);
    }
  }
}


Measured memory_bytes: 21332
using System;
class goldenapple{
  public static void Main(){
    String[] str = Console.ReadLine().Split(' ');
    int n = int.Parse(str[0]);
    int d = int.Parse(str[1]);
    int comp = 2*d+1;
    int count=0,human=0;
    while(count < n){
      count+=comp;
      human++;
    }
    Console.WriteLine(human);
  }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
const int maxn = 100005;
const int mod = 998244353;

int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(0);
    int n;
    cin >> n;
    ll pre[n + 5] = {};
    ll x[n + 5] = {};
    f1 (n) {
        ll add;
        cin >> add;
        pre[i] = pre[i - 1] + add;
        x[i] = x[i - 1] ^ add;
    }
    int l = 0;
    ll ans = 0;
    for (int i = 1 ; i <= n ; i++) {
        while(pre[i] - pre[l] != (x[i] ^ x[l])) {
            l++;
        }
        ans += i - l;
    }
    cout << ans << '\n';
}

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	cout << s[0] << n-2 << s[n-1] << endl;
	
	return 0;
}

Measured memory_bytes: 256