akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cout << #a << " = " << a << endl

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

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

int N, M;
int H[100001] = {0};
int A, B;

int main() {
    cin >> N >> M;
    FOR(n, 0, N) {
        cin >> H[n];
    }
    vector<bool> good(N, true);
    FOR(m, 0, M) {
        cin >> A >> B;
        int hight_diff = H[A-1] - H[B-1];
        if (hight_diff > 0) {
            good[B-1] = false;
        } else if (hight_diff < 0) {
            good[A-1] = false;
        } else {
            good[A-1] = false;
            good[B-1] = false;
        }
    }

    int result = count_if(good.begin(), good.end(), [](bool g) { return g; });
    cout << result << endl;
}


Measured memory_bytes: 4000
#include<iostream>
using namespace std;
int main()//冒泡
{	int A[100],n,j,flag=1,change=0,x;
	cin>>n;
	for(j=0;j<n;j++)
			cin>>A[j];
	while(flag)
	{	flag=0;
		for(j=n-1;j>0;j--)
			if(A[j]<A[j-1])
			{
				x=A[j];
				A[j]=A[j-1],A[j-1]=x;
				change++;
				flag=1;
			}	
	}
	for(j=0;j<n;j++)
	{	cout<<A[j];
		if(j==n-1)
			cout<<endl;
		else if(j!=n-1)
			cout<<" ";
	}	
	cout<<change<<endl;
}



Measured memory_bytes: 3104
program bbb
implicit none

integer :: i, j, k, n, dumy
integer, allocatable, dimension(:) :: p
logical :: found

read(*,*) n
allocate(p(n))
read(*,*) p

do i=1,n
 do J=i,n
 dumy=p(i)
 p(i)=p(j)
 p(j)=dumy
 found=.True.
  do k=1,n-1
  if(p(k)>=p(k+1)) then
  found=.False.
  end if
  end do
 if (found) then
 write(*,'(a3)') 'YES'
 return
 end if
 dumy=p(i)
 p(i)=p(j)
 p(j)=dumy
 end do
end do

write(*,'(a2)') 'NO'

end program

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		string s,t;
		cin>>s>>t;
		t.pop_back();
		cout <<(s==t ? "Yes":"No");

	
	
	}
	return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		Arrays.sort(a);
		boolean b = true;
		for(int i = 1; i < n; i++) {
			if(a[i-1] == a[i]) {
				b = false;
				break;
			}
		}
		if(b)System.out.println("YES");
		else System.out.println("NO");
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 47548
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	string s;
	cin >> s;
	s[5] = ' ';
	s[13] = ' ';
	cout << s;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ll N,M;
    priority_queue<ll> que;
    cin >> N >> M;
    REP(i,N){
        ll tmp;
        cin >> tmp;
        que.push(tmp);
    }
    REP(i,M){
        if(que.top() == 0){
            break;
        }
        ll tmp = que.top();que.pop();
        tmp = tmp/2;
        que.push(tmp);
    }
    ll ans = 0;
    REP(i,N){
        ans += que.top();que.pop();
    }
    cout << ans << endl;
    return 0;
}

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

int i, n, ans;

int main (){
	int A[200];
	cin >> n;

	for (i = 0; i < 2 * n; i++){
		cin >> A[i];
	}
	
	sort (A, A + 2 * n);
	reverse (A, A + 2 * n);
	
	for (i = 0; i < n; i++){
		ans += A[2 * i + 1];
	}

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


Measured memory_bytes: 256
use proconio::input;
use std::cmp::{max, min};

const MAX_L: usize = 100_000;
const BASE_SIZE: usize = 1 << 10;

fn main() {
    input! {
        n: usize,
        vw: [(u32, u32); n],
        q: usize,
        ul: [(usize, usize); q],
    }
    let dp = make_dp(&vw);
    for (u, l) in ul {
        println!("{}", calc(&dp, &vw, u - 1, l));
    }
}

fn make_dp(vw: &Vec<(u32, u32)>) -> Vec<Vec<u32>> {
    let mut dp = Vec::<Vec<u32>>::new();

    dp.push(
        (0..=MAX_L)
        .map(|i| if i < vw[0].1 as usize { 0 } else { vw[0].0 })
        .collect()
    );

    let n = min(vw.len(), BASE_SIZE - 1);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push(
            (0..=MAX_L)
            .map(|i| {
                let w = vw[c].1 as usize;
                let v = if i < w { 0 } else { dp[p][i - w] + vw[c].0 };
                max(dp[p][i], v)
            })
            .collect()
        );
    }

    dp
}

fn calc(
    dp: &Vec<Vec<u32>>,
    vw: &Vec<(u32, u32)>,
    u: usize, 
    l: usize,
) -> u32 {
    if u < dp.len() {
        dp[u][l]
    } else {
        let p = (u - 1) / 2;
        let w = vw[u].1 as usize;
        let pv1 = calc(dp, vw, p, l);
        let pv2 = if l < w { 0 } else { calc(dp, vw, p, l - w) + vw[u].0 };
        max(pv1, pv2)
    }
}


Measured memory_bytes: 410976
# ABC171 C 

from collections import deque

num2alpha = lambda c: chr(c+64)

n = int(input())
ans_dq = deque()

for i in range(1,12):
    _tmp = n%26
    if _tmp == 0:
        _tmp = 26
        n = n//26 - 1
    else:
        n = n//26
    ans_dq.appendleft(num2alpha(_tmp).lower())
    if n == 0:
        break
print(*ans_dq, sep="")

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


void solve(){
    ll n,m,d,c=0,p=999999,f=0;
    cin>>n>>m;
    if(n<4) c+=(4-n)*100000;
    if(m<4) c+=(4-m)*100000;
    if(c==600000) c+=400000;
    cout<<c;
}
     
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int q;
    //cin>>q;
    //for(int i=0;i<q;i++)
	    solve();
	return 0;
}

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

int main() {
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> t(n);
    int i;
    for(i = 0; i < n; i++) {
        cin >> t[i];
    }

    sort(t.begin(), t.end());

    int ans = 0;
    for(i = 0; i < n; i++) {
        int start = i;
        while(i < n && t[i] - t[start] <= k && i - start < c) {
            i++;
        }
        ans++;
        i--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N;
  cin>>N;
  int F=0;
  rep(i,N){
    int X=N+i;
    int F=1;
    rep(j,X-2){
      if(X%(j+2)==0){
        F=0;
        break;
      }
    }
    if(F){
      cout<<X<<endl;
      break;
    }
  }
}

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

  int n,m,suma=0,sumb=0,x,sa[100],sb[100],i,j,blank,a,sumx;

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

  suma=0;
  sumb=0;
  for(i = 0; i < n; i++){

    scanf("%d",&sa[i]);
    suma += sa[i];

  }
  
  for(j = 0; j < m; j++){

    scanf("%d",&sb[j]);
    sumb += sb[j];

  }

  x=suma-sumb;
  if(x%2 == 1 || x*-1%2 == 1){

    printf("-1\n");
    continue;

  }
  
  x /= 2;

  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(sa[j] > sa[j+1]){

        blank=sa[j];
        sa[j]=sa[j+1];
        sa[j+1]=blank;

      }

    }

  }
  
 for(i = 0; i < m-1; i++){

    for(j = 0; j < m-1; j++){

      if(sb[j] > sb[j+1]){

        blank=sb[j];
        sb[j]=sb[j+1];
        sb[j+1]=blank;

      }

    }

  }

 // for(i = 0; i < n; i++) printf("%d\n",sa[i]);
 //for(i = 0; i < m; i++) printf("%d\n",sb[i]);
 //printf("\n");
 // printf("%d %d %d\n",x,suma,sumb);
 
 a=0;
 if(x <= 0){
 
   for(i = 0; i < n; i++){

     for(j = 0; j < m; j++){

       if(sa[i]-sb[j] == x){

         printf("%d %d\n",sa[i],sb[j]);
         a=1;
         break;

       }

     }

     if(a == 1) break;

   }

 } else {

   for(i = 0; i < n; i++){

     for(j = 0; j < m; j++){

       if(sa[i]-sb[j] == x){

         printf("%d %d\n",sa[i],sb[j]);
         a=1;
         break;

       }

     }

     if(a == 1) break;

   }

 }

 

 if(a == 0) printf("-1\n");

  }

 return 0;

}

 

Measured memory_bytes: 2608
package main

import (
	"fmt"
)

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

func main() {
	var p,q,r int
	fmt.Scan(&p,&q,&r)

	ans := min(p+q,q+r)
	ans = min(ans,r+p)

	fmt.Println(ans)

}




Measured memory_bytes: 512
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]).sort();
    auto ok = a.group.count == n;
    writeln(ok ? "YES" : "NO");
}










void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

long long int N, fact[10010101], ifact[10010101], ans;
constexpr long long int M = 1000000007;

int main(){
    scanf("%lld", &N);
    *fact = 1;
    for(int i = 1; i < N; ++i){
        fact[i] = fact[i - 1] * i % M;
    }
    long long n = M - 2, r = fact[N - 1];
    ifact[N - 1] = 1;
    while(n){
        if(n & 1){
            ifact[N - 1] = ifact[N - 1] * r % M;
        }
        n /= 2;
        r = r * r % M;
    }
    for(int i = N - 1; i > 0; --i){
        ifact[i - 1] = ifact[i] * i % M;
    }
    for(int i = N / 2; i < N - 1; ++i){
        ans += fact[i] * fact[i - 1] % M * ifact[i * 2 - N] % M;
    }
    ans = fact[N - 1] * (N - 1) - ans;
    ans %= M;
    cout << (ans < 0 ? M + ans : ans) << endl;
    return 0;
}


Measured memory_bytes: 18688
#include <bits/stdc++.h>
using namespace std;
int H, W;
int main() {
    cin >> H >> W;
    vector<vector<char>> s(H+2, vector<char>(W+2, '.'));
    for(int i = 1; i < H+1; ++i) {
        for(int j = 1; j < W+1; ++j) {
            cin >> s.at(i).at(j);
        }
    }

    // 2個ずつ隣接してるかを確認していくのか
    for(int i = 0; i < H+2; ++i) {
        for(int j = 0; j < W+2; ++j) {
            int wcnt = 0;
            if(s.at(i).at(j) == '#') {
                if(s.at(i-1).at(j) == '.') {
                    wcnt++;
                }
                if(s.at(i).at(j-1) == '.') {
                    wcnt++;
                }
                if(s.at(i+1).at(j) == '.') {
                    wcnt++;
                }
                if(s.at(i).at(j+1) == '.') {
                    wcnt++;
                }
            }
            if(wcnt == 4) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;


}

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

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

  string S;
  cin >> S;
  vector<int> char_cnt(26);
  for(int i = 0; i < S.length(); i++){
    char_cnt[S[i] - 'a']++;
  }
  long long ans = 1;
  const long long mod = 1e9 + 7;
  for(int i = 0; i < 26; i++){
    ans *= char_cnt[i] + 1;
    ans %= mod;
  }
  cout << ans - 1 << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a == b) System.out.println(c);
        if(a == c) System.out.println(b);
        if(b == c) System.out.println(a);
    }
}

Measured memory_bytes: 35640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

long long int num[1000001];
long long int used[1000001];
long long int sum[1000001];

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

	cin >> N;
	int all_sum = 0;
	vector<vector<int>>div(1000001);
	long long int ans = 0;
	for (int a = 0; a < N; a++) {
		int i;
		cin >> i;
		ans += MOD - i;
		num[i]++;
	}
	ans %= MOD;
	for(int i=0;i<=1000000;i++){
		if (!num[i])continue;
		for (int j = 1; j*j <= i; j++) {
			if (i%j)continue;
			sum[j] += i * num[i];
			div[i].push_back(j);
			if (j*j != i) {
				sum[i / j] += i * num[i];
				div[i].push_back(i / j);
			}
		}
		sort(div[i].begin(), div[i].end());
	}
	for (int i = 0; i <= 1000000; i++)sum[i] %= MOD;
	for (int i = 0; i <= 1000000; i++) {
		if (!num[i])continue;
		long long int add = 0;
		for (int j = (int)div[i].size() - 1; j >= 0; j--) {
			long long int cn = sum[div[i][j]];
			for (int k = j + 1; k < div[i].size(); k++) {
				if(div[i][k]%div[i][j]==0)cn += MOD - used[div[i][k]];
			}
			cn %= MOD;
			used[div[i][j]] = cn;
			add += (cn * power(div[i][j], MOD - 2, MOD))%MOD;
			if (add >= MOD)add -= MOD;
		}
		add *= i;
		add %= MOD;
		add *= num[i];
		add %= MOD;
		ans += add;
		ans %= MOD;
		for (auto j : div[i])used[j] = 0;
	}
	ans *= power(2, MOD - 2, MOD);
	ans %= MOD;
	cout << ans << endl;
}

Measured memory_bytes: 67328
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int res=0;
    int right=0;
    while(1){
        if(res==0) right+=k;
        else right += k-1;
        res++;

        if(right >= n) break;
    }
    cout << res << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

#define INF 1234567890
#define MIN -1

int N, Z, W;
vector<int> v;
int dp[2005][2];

int dfs(int pos, int turn){
  if(dp[pos][turn] != -1) return dp[pos][turn];

  int ret = (turn==0)?MIN:INF;
  REP(i,pos+1,N){
    int tmp;
    if(i == N-1){
      tmp = abs(v[pos]-v[i]);
    }else{
      tmp = dfs(i,1-turn);
    }

    if(turn == 0){
      ret = max(ret, tmp);
    }else{
      ret = min(ret, tmp);
    }
  }
  return dp[pos][turn] = ret;
}


int dfs2(int pos, int turn){

  if(turn == 0){
    if(dp[pos][turn]!=-1) return dp[pos][turn];
    int mx = MIN;
    REP(i,pos+1,N){
      int tmp;
      if(i == N-1){
        tmp = abs(v[pos]-v[i]);
      }else{
        tmp = dfs(i,1-turn);
      }
      if(tmp > mx){
        mx = tmp;
      }
    }
    return dp[pos][turn] = mx;
  }else{
    if(dp[pos][turn]!=-1) return dp[pos][turn];    
    int mn = INF;
    REP(i,pos+1,N){
      int tmp;
      if(i == N-1){
        tmp = abs(v[pos]-v[i]);
      }else{
        tmp = dfs(i,1-turn);
      }
      if(tmp < mn){
        mn = tmp;
      }
    }
    return dp[pos][turn] = mn;
  }
}


int main(){
  cin >> N >> Z >> W;
  v.push_back(Z);
  v.push_back(W);
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }
  
  N += 2;

  rep(i,2005){
    rep(j,2){
      dp[i][j] = -1;
    }
  }
  
  cout << dfs(1,0) << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

int sum_int(vector<int> &a){
  int sum=0;
  rep(i,a.size()) sum+=a.at(i);
  return sum;
}

int main(){
  string s;
  cin>>s;
  int n=s.size();
  vector<int> a(10);
  rep(i,n){
    a.at(10-n+i)=(int)s.at(i)-(int)'0';
  }
  for(int i=0;i<10-n;i++){
    a.at(i)=0;
  }
  //rep(i,10)
    //cout<<a.at(i)<<" ";
  //cout<<endl;
  //cout<<n<<endl;
  
  long long sum_ans=0;
  rep(trs,(1<<n-1)){
    bitset<9> r = trs;
    //cout<<r<<" ";
    long long sum=0;
    long long p=a.at(0);
    rep(i,9){
      if(r.test(8-i)){
        sum+=p;
        p=a.at(i+1);
        if(i+1==9)
          sum+=p;
      }
      else{
        p=p*10+a.at(i+1);
        if(i+1==9)
          sum+=p;
      }
      
    }
    //if(sum!=0)
      //cout<<sum<<endl;
    sum_ans+=sum;
    
  }
  cout<<sum_ans<<endl;
  //cout<<(1<<n-1)<<endl;
  
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		if(a.equals("Sunny")) {
			System.out.print("Cloudy");
		}
		if(a.equals("Cloudy")) {
			System.out.print("Rainy");
		}
		if(a.equals("Rainy")) {
			System.out.print("Sunny");
		}
	}

}


Measured memory_bytes: 35532
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

tuple<int64_t, int64_t, int64_t> xgcd(int64_t a, int64_t b) {
  if (b == 0) {
    return make_tuple(1, 0, a);
  }
  int64_t z, w, d;
  tie(z, w, d) = xgcd(b, a % b);
  return make_tuple(w, z - a / b * w, d);
}

int main() {
  int64_t a, b;
  cin >> a >> b;

  int64_t x, y, d;
  tie(x, y, d) = xgcd(a, b);

  int64_t s = b / d, t = a / d;
  int64_t x0 = (x % s + s) % s, y0 = (y % t + t) % t;
  if (x0 + abs(d - a * x0) / b <= y0 + abs(d - b * y0) / a) {
    cout << x0 << " " << (d - a * x0) / b << endl;
  } else if (x0 + abs(d - a * x0) / b > y0 + abs(d - b * y0) / a) {
    cout << (d - b * y0) / a << " " << y0 << endl;
  }

  return 0;
}


Measured memory_bytes: 3116
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a[3];
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]==a[1])
	cout<<a[2];
	else
	cout<<a[0];
	return 0;
}


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

int moneymax(int x, int y)
{
    if(x==1 && y==1) return 1000000;
    else if(x==1 && y==2) return 500000;
    else if(y==1 && x==2) return 500000;
    else if(x==2 && y==2) return 400000;
    else if(x==1 && y==3) return 400000;
    else if(y==1 && x==3) return 400000;
    else if(x==3 && y==3) return 200000;
    else if(x==2 && y==3) return 300000;
    else if(y==2 && x==3) return 300000;
    else if(x==3 && y==2) return 300000;
    else if(y==3 && x==2) return 300000;
    else if(x==3 && y==1) return 400000;
    else if(y==1 && x==3) return 400000;
    else if(x==1 && y>3) return  300000;
    else if(x==2 && y>3) return  200000;
    else if(x==3 && y>3) return  100000;
    else if(y==1 && x>3) return  300000;
    else if(y==2 && x>3) return  200000;
    else if(y==3 && x>3) return  100000;
    else if(x>3 && y>3) return 0;

}

void solve()
{
  int m, n;
  cin>>m>>n;

  int res = moneymax(m,n);
  cout<<res<<endl;
}
int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();

    }
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int o = Integer.parseInt(sc.next());
        System.out.println(o + " " + n + " " + m);

    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;
    cin >> S;

    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#
# coding: utf-8

n, quantum = map(int, raw_input().split())

process_time = []
tim = 0

for x in xrange(n):
    pros, tt = raw_input().split()
    process_time.append([pros, int(tt)])

while True:
    if len(process_time) == 0: break
    pp = process_time.pop(0)
    if pp[1] > quantum :
        pp[1] = pp[1] - quantum
        process_time.append(pp)
        tim += quantum
    else:
        tim += pp[1]
        print pp[0] + " " +str(tim)

Measured memory_bytes: 14000
#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 = 1e5 + 5;

int32_t main()
{
	IOS;
	set<int> s;
	int a, b, c;
	cin >> a >> b >> c;
	s.insert(a);
	s.insert(b);
	s.insert(c);
	if(s.size() == 2)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 256
SA = input()
SB = input()
SC = input()

card = SA[0]
SA = SA[1:]

while True:
    if card == "a":
        if SA == "":
            print("A")
            exit()
        card = SA[0]
        SA = SA[1:]
    if card == "b":
        if SB == "":
            print("B")
            exit()
        card = SB[0]
        SB = SB[1:]
    if card == "c":
        if SC == "":
            print("C")
            exit()
        card = SC[0]
        SC = SC[1:]

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    string name;
	int morning, afternoon;
	
	while(cin >> name >> morning >> afternoon)
	{
		cout << name << " " << morning + afternoon << " " << morning * 200 + afternoon * 300 << endl;
	}
}

Measured memory_bytes: 0
count, way = list(map(int, input().split()))
height = list(map(int, input().split()))
isGood = [True] * count

for i in range(way):
    obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))
    if(height[obs_a] > height[obs_b]):
        isGood[obs_b] = False
    elif(height[obs_b] > height[obs_a]):
        isGood[obs_a] = False
    else:
        isGood[obs_a] = False
        isGood[obs_b] = False


print(len([ i for i in isGood if i ]))

Measured memory_bytes: 20128
package main

import (
	"fmt"
	"os"
	"bufio"
	"strings"
	"strconv"
)
var MAX = 1000000
type Vertex struct{
	Value int
	Routes map[int]int
	Done bool
}
func NewVertex(value int) *Vertex{
	routes := make(map[int]int)
	// for i, _ := range routes {
	// 	routes[i] = MAX
	// }
	return &Vertex{ value, routes, false }
}

func (v *Vertex) SetRoute(key, weight int) {
	v.Routes[key] = weight
}

type Path struct {
	Key int
	Weight int
}

var count = 0
func ShortestRoutes(list []*Vertex) []int {
	// create result table
	result  := make([]int, len(list))
	// fmt.Println(result)
	for i, _ := range result {
		result[i] = MAX
	}

	queue := make([]Path, 0)
	queue = append(queue, Path{0, 0})
	result[0] = 0

	for len(queue) != 0 {
		count++
		path := queue[0]
		queue = queue[1:]
		for key, weight := range list[path.Key].Routes {
			// fmt.Println(list[path.Key].Routes)
			// set to result
			// fmt.Printf("Path(%d, %d) ? result[%d] => %d, wieght: %d\n", path.Key, path.Weight, key, result[key], weight)
			if path.Weight + weight < result[key] {
				result[key] = path.Weight + weight 
				queue = append(queue, Path{key, result[key]})
			// } else if !list[key].Done {
			// 	queue = append(queue, Path{key, result[key]})
			}
		}
		list[path.Key].Done = true
	}
	return result
}
func main() {
	var n int
	fmt.Scanf("%d", &n)
	list := make([]*Vertex, n)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < n; i++ {
		scanner.Scan()
		elements := strings.Split(scanner.Text(), " ")
		value, _ := strconv.Atoi(elements[0])
		list[i] = NewVertex(value)
		for j := 2; j < len(elements); j += 2 {
			key, _    := strconv.Atoi(elements[j])
			weight, _ := strconv.Atoi(elements[j + 1])
			list[i].SetRoute(key, weight)
		}
	}

	result := ShortestRoutes(list)
	for i := 0; i < len(result); i++ {
		fmt.Printf("%d %d\n", i, result[i]);
	}
	// fmt.Printf("count: %d\n", count)
}


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


int main(){
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++)
  {
    cin >> p[i];
  }
  int ans=0;
  for (int i = 0; i < (N-2); i++)
  {
    if( p[i] > p[i+1] && p[i+1] > p[i+2]){
      ans++;
    }else if( p[i] < p[i+1] && p[i+1] < p[i+2]){
      ans++;
    }
  }
    
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

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

        int max = -1000001;
        int min = 1000001;
        long sum = 0;
        int n = scanner.nextInt();
        int i= 0;
        while(i < n){
            int x = scanner.nextInt();
            sum += x;
            if( max < x ){
                max = x;
            }
            if(min > x){
                min = x;
            }
            i++;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}



Measured memory_bytes: 41424
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define pb(x) push_back(x)
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
    READ(n);
    READ(m);
    
    multiset <int> a[m + 1];
    int x, y;
    FOR (i, 1, n)
    {
        cin >> x >> y;
        if (x > m) continue;
        a[x].insert(y);
    }
    
    multiset <pi> cur;
    int sum = 0;
    FOR (i, 1, m)
    {
        if (!a[i].empty()) cur.insert({*(--a[i].end()), i});
        
        if (cur.empty()) continue;
        pi x =  *(--cur.end());
        sum += x.fi;
        
        int v = x.se;
        a[v].erase(a[v].lower_bound(x.fi));
        if (!a[v].empty()) cur.insert({*(--a[v].end()), v});
        cur.erase(--cur.end());
    }
    
    cout << sum;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


template<typename T, T MOD = 1000000007>
struct Mint {
	T v;

	Mint() : v(0) {}
	Mint(signed v) : v(v) {}
	Mint(ll t) { v = t % MOD; if (v < 0) v += MOD; }

	Mint pow(ll k) {
		Mint res(1), tmp(v);

		while (k) {

			if (k & 1) res *= tmp;

			tmp *= tmp;
			k >>= 1;
		}



		return res;
	}

	Mint inv() { return pow(MOD - 2); }

	Mint& operator=(Mint a) { if (a.v >= MOD) a.v %= MOD; v = a.v; return *this; }
	Mint& operator+=(Mint a) { v += a.v; if (v >= MOD) v -= MOD; return *this; }
	Mint& operator-=(Mint a) { v += MOD - a.v; if (v >= MOD) v -= MOD; return *this; }
	Mint& operator*=(Mint a) { v = 1LL * v * a.v % MOD; return *this; }
	Mint& operator/=(Mint a) { return (*this) *= a.inv(); }
	Mint operator+(Mint a) const { return Mint(v) += a; }
	Mint operator-(Mint a) const { return Mint(v) -= a; }
	Mint operator*(Mint a) const { return Mint(v) *= a; }
	Mint operator/(Mint a) const { return Mint(v) /= a; }

	Mint operator-() { return v ? MOD - v : v; }
	bool operator==(const Mint a) const { return v == a.v; }
	bool operator!=(const Mint a) const { return v != a.v; }
	bool operator < (const Mint a) const { return a < a.v; }


};

using M = Mint<ll>;

vector <ll> x, y;
ll vis[55];
int main() {
	ll N;



	cin >> N;
	x.resize(N), y.resize(N);

	rep(i, N)
		cin >> x[i] >> y[i];

	vector<pair<ll, ll>> cands;

	
	rep(i, N) {
		rep(j, N){
			cands.push_back({x[i] - x[j], y[i] - y[j] });
		}
	}

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

	ll ans = inf;
	rep(i, cands.size()) {
		ll p = cands[i].first, q = cands[i].second;


		ll cost = 0;
		queue<ll> que;
		for (int k = 0; k < N; k++) {

			if (vis[k] == 1)
				continue;


			cost += 1;
			que.push(k);
			vis[k] = 1;
			while(!que.empty()) {

				rep(j, N) {
					ll indx = x[que.front()] - x[j], indy = y[que.front()] - y[j];
					if ( ((indx == p && indy == q) || (indx == -p && indy == -q))  && vis[j] == 0)
						vis[j] = 1, que.push(j);
				}

				que.pop();
			}



		}

		ans = min(cost, ans);

		rep(k, N)
			vis[k] = 0;

	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

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

Measured memory_bytes: 256
int main() {
char i,j,cup[3]={0,0,1},t;
while(0<=scanf("%c,%c%*c",&i,&j)){
t=cup[i%3];
cup[i%3]=cup[j%3];
cup[j%3]=t;
}
for(i=0;i<3;i++){
switch((int)cup[i]){
case 1:
if(i==0)
printf("B\n");
if(i==1)
printf("C\n");
if(i==2)
printf("A\n");
break;
default:
break;
}
}
return 0;
} 

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li len[55];
li pat[55];

li solve(li n, li x, li now_p) {
    //p4(n, x, now_p, len[n]);
    if (n == 0) {
        if (x < 1) {
            return now_p;
        } else {
            return now_p + 1;
        }
    }
    if (x <= 1) {
        return now_p;
    }
    const li mid = (len[n] + 1) / 2;
    if (x < mid) {
        return solve(n - 1, x - 1, now_p);
    }
    // for mid pat
    now_p += pat[n - 1] + 1;

    return solve(n - 1, x - mid, now_p);
}

int main() {
    len[0] = 1;
    pat[0] = 1;
    repp(i, 1, 55) {
        len[i] = len[i - 1] * 2 + 3;
        pat[i] = pat[i - 1] * 2 + 1;
    }
    li n, x;
    cin >> n >> x;
    cout << solve(n, x, 0) << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] arr = new int[N];

        for (int i = 0; i < N; i++) {
            arr[sc.nextInt()-1] = i+1;
        }

        for (int i = 0; i < N; i++) {
            System.out.print(arr[i]);
            if (i != N - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }
 
}

Measured memory_bytes: 63116
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << (A / D + (A % D ? 1 : 0) >= C / B + (C % B ? 1 : 0) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, int> P3;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-11;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll n, m;
    while(cin >> n >> m, n){
        ll ans = 0;
        vector<P> v;
        REP(i,n){
            ll d, p;
            cin >> d >> p;
            v.push_back({p,d});
        }
        SORT(v);
        reverse(ALL(v));
        REP(i,n){
            ans += v[i].first*max(v[i].second-m,0LL);
            m -= min(v[i].second,m);
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3264
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

ll pow(ll x, ll e) {
  ll v = 1;
  for (; e; e>>=1) {
    if (e & 1) {
      v = v * x;
    }
    x = x * x;
  }
  return v;
}

ll MAX = pow(10, 16) + 1000;

bool solve(ll K, int N) {
  vector<ll> a(N), s(N);
  for (int i = 0; i < N; i++) {
    s[i] = K / N + (i < K % N);
    a[i] = N - 1 + s[i] * N - (K - s[i]);
    if (a[i] < 0 || MAX < a[i]) {
      return false;
    }
  }
  cout << N << endl;
  for (auto x: a) {
    cout << x << " ";
  }
  cout << endl;
  return true;
}

int main() {
  ll K;
  cin >> K;
  for (int N = 2; N <= 50; N++) {
    if (solve(K, N)) {
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define ll long long
using namespace std;
ll n,a,b;
int main(){
	cin>>n>>a>>b;
	ll t=n/(a+b);
	ll sheng=n-t*(a+b);
	ll ans=t*a;
	if(sheng>a)
		ans+=a;
	else
		ans+=sheng;
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>


int main()
{
	int a, b;
	int c, d;
	int e, f;
	while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) > 0) {
		int cnt[] = { 0,0,0,0 };
		cnt[a-1]++;
		cnt[b - 1]++;
		cnt[c - 1]++;
		cnt[d - 1]++;
		cnt[e - 1]++;
		cnt[f - 1]++;
		if (cnt[0]>2 || cnt[1]>2 || cnt[2]>2 || cnt[3]>2) printf("NO\n");
		else printf("YES\n");
	}
    return 0;
}



Measured memory_bytes: 128
#pragma GCC target("avx")
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define PA pair<LL,LL>
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define TS to_string
#define TU to_ullong
#define BPL __builtin_popcountll
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORR(i,a,n) for(i=n-1;i>=a;i--)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL LBn(VL &v,LL a){LL mx=v.size(),mn=-1,md;while(mx-mn>1){md=(mx+mn)/2;if(v[md]<a)mn=md;else mx=md;}return mx;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a%m<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  FAST;
  LL ans,A,B,N,x;
  cin>>A>>B>>N;
  if(N>B-1)x=B-1;
  else x=N;
  ans=A*x/B;
  ans-=(x/B)*A;

  cout<<ans<<endl;
}


Measured memory_bytes: 3656
S = str(input())
ODD = ["R", "U", "D"]
EVEN = ["L", "U", "D"]
flag = False
for i in range(len(S)):
    if i%2 == 0:
        if not ( S[i] in ODD):
            flag = True
    if i%2 == 1:
        if not ( S[i] in EVEN):
            flag = True
if flag == False:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060