akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

int M,K;

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

    cin>>M>>K;
    if( K>=(1LL<<M) )
    {
        cout<<-1<<'\n';
        return 0;
    }
    if( M==1 )
    {
        if(K==0)cout<<"0 0 1 1\n";
        else cout<<-1<<'\n';
        return 0;
    }
    cout<<K;
    FOR(i,0,(1<<M)-1)if(i!=K)cout<<' '<<i;
    cout<<' '<<K;
    FORD(i,(1<<M)-1,0)if(i!=K)cout<<' '<<i;

    return 0;
}


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

int main(){
  unsigned long long int X;
  cin >> X;
  unsigned long long int a=100;
  int count=0;

  while (true){
      
    count++;
    a*=1.01;
    if (a>=X) {cout << count << endl; return 0;}
  }
  
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int digitSum(int n){
   int res = 0;
   while(n){
       res += n % 10;
       n /= 10;
   }
   return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = digitSum(n);
    int now = 1;
    for(int i = 0; i < 16; i++){
        now *= 10;
        int tmp = n % now + 1;
        tmp = n - tmp;
        if(tmp > 0){
            ans = max(ans, digitSum(tmp));
        }
    }   
    cout << ans << endl;
}

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

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/
//vector<int> a を受け取り(参照し)、累積和配列 s を返す
vector<int> ruisekiwa(vector<int> &a){
    vector<int> s(a.size()+1, 0);
    for(int i = 0; i < a.size(); i++){
        s[i+1] = s[i] + a[i];
    }
    return s;
}
//a[L]からa[R-1]までの総和を返す
int sumforquery(vector<int> &s, int L, int R){
    return s[R] - s[L];
}

/*MAIN==================================================*/
int main(){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);   //cin cout 高速化

    vi a(1001);
    rep1(i,1000) a[i] = i;
    vi sum = ruisekiwa(a);
    int n;
    while(cin >> n) {
        if(n == 0) break;
        int cnt = 0;
        rep1(p,n) {
            rep2(q,p+2,n) {
                //if(p == q) continue;
                if(sumforquery(sum, p, q) == n) {
                    //cout << p << " " << q << endl;
                    cnt++;
                }
            }
        }
        cout << cnt << '\n';
    }
}


Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;



int main(){

    string s;
    cin >> s;

    int ans = 0;

    rep(i,4){
        if(s[i] == '+'){
            ans++;
        }else ans--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import Data.List.Split
import Control.Monad
import Data.Ord

getGrams :: Int -> IO [Int]
getGrams times = do
	a <- forM [1..times] $ \i -> do
		c <- getLine
		let c' = read c :: Int
		return c'
	return a

main = do
	nx <- getLine
	let nx' = splitOn " " nx
	let n = read $ nx' !! 0 :: Int
	let x = read $ nx' !! 1 :: Int 
	ms <- getGrams n
	let x' = x - (sum ms)
	let rest = x' `div` (minimum ms)
	let res = n + rest
	putStrLn $ show res


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll tot_vacation,temp=0;
    scanf("%lld",&tot_vacation);
    ll tot_assignments;
    scanf("%lld",&tot_assignments);
    while(tot_assignments--)
    {
        ll assignment;
        scanf("%lld",&assignment);
        temp+=assignment;
    }
    ll vacation=tot_vacation-temp;
    if(vacation>0)
    {
        printf("%lld\n",vacation);
    }
    else if(vacation==0)
        printf("%d\n",0);
    else
        cout<<-1<<endl;
    return 0;

}


Measured memory_bytes: 3756
def main():
  num = [int(input()) for i in range(5)]
  n =int(input())
  flg=0
  for i in range(0,4):
    for j in range(i,5):
      if abs(num[j]-num[i])>n :
        flg=1
        break
  if flg==0 :
    print('Yay!')
  else :
    print(':(')

main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
struct no{
  no *l,*r;
  int key;
  no(){l=r=NULL;key=-1;};
};
typedef no* node;
string s[2];
node head[2];
int x,p;
int get_num(){
  int res=0;
  while(p<s[x].size()&&isdigit(s[x][p]))res=res*10+(s[x][p++]-'0');
  return res;
}
node make_tree(){
  node po=new no();
  if(s[x][p]=='(')++p,po->l=make_tree();
  if(isdigit(s[x][p]))po->key=get_num();
  if(p<s[x].size()&&s[x][p]=='(')++p,po->r=make_tree();
  p++;
  return po;
}
void ch(node n1,node n2,int p){
  if(p)cout<<'(';
  if(n1->l!=NULL&&n2->l!=NULL)ch(n1->l,n2->l,1);
  if(n1->key>=0&&n2->key>=0)cout<<'['<<n1->key+n2->key<<']';
  if(n1->r!=NULL&&n2->r!=NULL)ch(n1->r,n2->r,1);
  if(p)cout<<')';
}
main(){
  r(i,2)cin>>s[i];
  r(i,2)r(j,s[i].size())if(s[i][j]==']'||s[i][j]=='[')s[i].erase(s[i].begin()+j),j--;
  r(i,2)p=0,x=i,head[i]=make_tree();
  ch(head[0],head[1],0);
  cout<<endl;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

double deg_to_rad(double degree){
    double pi = acos(-1);
    double rad = pi*degree/180;
    return rad;
}

int main() {
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    
    double degH = H*30 + M/2;
    double degM = M*6;
    double diff = abs(degH-degM);
    double rad = deg_to_rad(diff);

    cout << fixed << setprecision(15);
    cout << sqrt(A*A+B*B-2*A*B*cos(rad)) << endl;
}

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

using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;

template<typename C>
i64 Size(const C& c) { return static_cast<i64>(c.size()); }

template<typename C>
void Sort(C &c) { std::sort(c.begin(), c.end()); }

template<typename C>
void SortR(C &c) { std::sort(c.rbegin(), c.rend()); }

template<typename T, typename U, typename Comp=std::less<>>
bool ChMax(T& x_max, const U& x, Comp comp={}) {
  if(comp(x_max, x)) {
    x_max = x;
    return true;
  }
  return false;
}

template<typename T, typename U, typename Comp=std::less<>>
bool ChMin(T& x_min, const U& x, Comp comp={}) {
  if(comp(x, x_min)) {
    x_min = x;
    return true;
  }
  return false;
}

struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;

  ProconInit() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(IOS_PREC);
    if (AUTOFLUSH) std::cout << std::unitbuf;
  }
} PROCON_INIT;

void solve() {
  i64 n; std::cin >> n;

  std::unordered_map<std::string, i64> m;
  for (i64 i = 0; i < n; i++) {
    std::string s;
    std::cin >> s;
    m[s]++;
  }

  std::cout << m.size() << "\n";
}

signed main() {
  solve();

  return 0;
}


Measured memory_bytes: 17624
#include <iostream>
#include <numeric>
#include <cmath>
using namespace std;

int main() {
    int a[4]; for (int i = 0; i < 4; i++) cin >> a[i];
    int ans = 100000, S = accumulate(a, a+4, 0);
    for (int i = 1; i < 4; i++) ans = min(ans, abs(2 * (a[0] + a[i]) - S));
    cout << ans << endl;
}



Measured memory_bytes: 3112
h,w = map(int,input().split())
l = [list(input()) for i in range(h)]
#print(h,w,l)

def search(x,y):
    c = 0
    if x > 0:
        if l[y][x-1] == "#":
            c += 1
        if y > 0:
            if l[y-1][x-1] == "#":
                c += 1
        if y < h-1:
            if l[y+1][x-1] == "#":
                c += 1
    if x < w-1:
        if l[y][x+1] == "#":
            c += 1
        if y > 0:
            if l[y-1][x+1] == "#":
                c += 1
        if y < h-1:
            if l[y+1][x+1] == "#":
                c += 1
    if y > 0:
        if l[y-1][x] == "#":
            c += 1
    if y < h-1:
        if l[y+1][x] == "#":
            c += 1
    return c

for x in range(w):
    for y in range(h):
        pos = l[y][x]
        if pos == ".":
            l[y][x] = search(x,y)
for i in range(h):
    for j in range(w):
        print(l[i][j],end="")
    print()

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n, m;
    cin >> n >> m;
    ll ac = 0;
    ll wa = 0;

    vector<ll> has_ac(n+1);
    vector<ll> wa_num(n+1);

    NREP() {
        has_ac.push_back(false);
    }

    REP(i, m) {
        ll p;
        string s;
        cin >> p >> s;
        if (s == "AC") {
            if (!has_ac.at(p)) {
                has_ac.at(p) = true;
                ac++;
                wa += wa_num.at(p);
            }
        } else {
            if (!has_ac.at(p)) {
                wa_num.at(p)++;
            }
        }
    }
    cout << to_string(ac) << " " << to_string(wa) << endl;
}


Measured memory_bytes: 2672
import math
import os
import sys
from collections import Counter
from functools import reduce
from operator import mul

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))


def get_factors(n):
    """
    素因数分解
    :param int n:
    :rtype: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def mod_inv(a, mod):
    """
    a の逆元
    :param int a:
    :param int mod:
    :return:
    """
    return pow(a, mod - 2, mod)


def ncr(n, r, mod=None):
    """
    scipy.misc.comb または scipy.special.comb と同じ
    組み合わせの数 nCr
    :param int n:
    :param int r:
    :param int mod: 3 以上の素数であること
    :rtype: int
    """
    if n < r:
        return 0

    # 何度も呼ぶ場合は combination.py をつかう
    r = min(n - r, r)
    if r == 0:
        return 1
    if mod:
        return reduce(mul, range(n, n - r, -1)) * mod_inv(reduce(mul, range(r, 0, -1)), mod) % mod
    else:
        # math.factorial よりこっちのが速い
        # https://atcoder.jp/contests/abc110/submissions?f.Task=&f.Language=&f.Status=&f.User=nohtaray
        return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))


def nhr(n, r, mod=None):
    """
    重複組み合わせの総数 nHr
    :param int n:
    :param int r:
    :param int mod:
    :return:
    """
    return ncr(n + r - 1, r, mod)


counts = Counter(get_factors(M))
ans = 1
for c in counts.values():
    # N 個から c 個選ぶ重複組合せ
    ans = ans * nhr(N, c, MOD) % MOD
print(ans)


Measured memory_bytes: 3684
#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;

void Main()
{
  int n, m;
  cin >> n >> m;
  
  int h[n+1];
  bool hf[n+1];
  
  h[0] = 0;
  hf[0] = false;
  
  int count = 0;
  
  
  for(int i = 1; i <= n; i++){
    cin >> h[i];
    hf[i] = true;
  }
  
  vector<int> a(m);
  vector<int> b(m);
  
  for(int i = 0; i < m; i++){
    cin >> a[i];
    cin >> b[i];
  }
  
  for(int i = 0; i < m; i++){
    if(h[a[i]] > h[b[i]]){
      hf[b[i]] = false;
    }
    else if(h[a[i]] < h[b[i]]){
      hf[a[i]] = false;
    }
    else if(h[a[i]] == h[b[i]]){
      hf[a[i]] = false;
      hf[b[i]] = false;
    }
  }
  for(int i = 1; i <= n; i++){
    if(hf[i] == true)
      count++;
  }
  
  printf("%d", count);
  
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}


Measured memory_bytes: 4584
#include<stdio.h>
int main(){
int a,b,i;
char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')
        {printf("%d\n",a+b);
        }
        else if(op=='-')
        {printf("%d\n",a-b);
        }
        else if(op=='*')
        {printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }else if(op=='?') {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2124
import java.util.*;

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

        if (C <= A+B) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

int main() {
  
  int K;
  cin >> K ;
  
    
if (K % 2 == 0 ){
  
  cout << (K*K) /4 << endl;
}
  else {
    cout << ((K+1)*(K-1))/4 << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char s[2048];
  int i;
  fgets(s, sizeof(s), stdin);
  for(i = 0;s[i] != '\0';i++){
    if('a' <= s[i] && s[i] <= 'z') s[i] += 'A' - 'a';
    else if('A' <= s[i] && s[i] <= 'Z') s[i] += 'a' - 'A';
  }

  printf("%s",s);
  return 0;
}



Measured memory_bytes: 2036
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll n, m; cin >> n >> m;
    vll a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    priority_queue<ll> r;
    rep(i, 0, n){
        r.push(a[i]);
    }
    rep(i, 0, m){
        ll x = r.top();
        //prtl(x);
        r.pop();
        x /= 2;
        r.push(x);
    }
    ll c = 0;
    while(!r.empty()){
        ll v = r.top(); r.pop();
        //prtl(v);
        c += v;
    }
    prtl(c);
}



Measured memory_bytes: 5044
package main

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

var sc = bufio.NewScanner(os.Stdin)
var mat [7][7]string

func main() {
	scanInit()

	h := nextInt()
	w := nextInt()
	k := nextInt()
	mats := nextStrMat(h, w)

	blackcnt := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			mat[i][j] = mats[i][j]
			if mats[i][j] == "#" {
				blackcnt++
			}
		}
	}

	//fmt.Println("DEBUG 2&(1<<1)=", 2&(1<<1))
	//fmt.Println("DEBUG 5&(1<<1)=", 5&(1<<1))

	//	var linelist [14]int // h
	way := 0
	for hi := 0; hi < pow(2, h); hi++ {

		//fmt.Println("--- new hi ---: ", hi)

		for wi := 0; wi < pow(2, w); wi++ {
			//fmt.Println("  --- new wi ---: ", wi)

			// 初期化
			var nowmat [7][7]string
			nowmat = mat

			// hiに当たる線を引く
			for i := 0; i < h; i++ {
				//fmt.Println("--- new 1<<i ---: ", 1<<i, hi)
				if hi&(1<<i) != 0 {
					//fmt.Println("hit", i, 1<<i)
					for j := 0; j < w; j++ {
						nowmat[i][j] = "r"
					}
				}
			}
			// wiに当たる線を引く
			for i := 0; i < w; i++ {
				//fmt.Println("--- new 1<<i ---: ", 1<<i, hi)
				if wi&(1<<i) != 0 {
					//fmt.Println("hit", i, 1<<i)
					for j := 0; j < h; j++ {
						nowmat[j][i] = "r"
					}
				}
			}
			/*
				fmt.Printf("\n")
				for i := 0; i < h; i++ {
					for j := 0; j < w; j++ {
						fmt.Printf("%s", nowmat[i][j])
					}
					fmt.Printf("\n")
				}*/

			// count
			tmpblackcnt := 0
			for i := 0; i < h; i++ {
				for j := 0; j < w; j++ {
					if nowmat[i][j] == "#" {
						tmpblackcnt++
					}
				}
			}
			//fmt.Println("--- tmpblackcnt ---: ", tmpblackcnt)
			if tmpblackcnt == k {
				//fmt.Println("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIT")
				way++
			}
		}
	}

	fmt.Println(way)

}
func bitString(a int) string {
	return strconv.FormatInt((int64)(a), 2)
}
func pow(a, b int) int {
	var ret int = 1
	for b > 0 {
		if (b & 1) == 1 {
			ret *= a
		}
		a *= a
		b >>= 1
	}
	return ret
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
func nextStrMat(a int, b int) [][]string {
	mat := make([][]string, a)
	for i := 0; i < a; i++ {
		mat[i] = make([]string, b)
		var tmp string
		tmp = nextStr()
		for j := 0; j < b; j++ {
			mat[i][j] = string(tmp[j])
		}
	}
	return mat
}


Measured memory_bytes: 1780
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>

using namespace std;
//int moreGcd

int main(){
    int N = 0;
    cin >> N;
    string x;
    string u;
    double total = 0;
    for(int i = 0; i < N; i++){
        cin >> x;
        cin >> u;
        
        if(u == "JPY"){
            total += stod(x.c_str());
        }else{
            total += stod(x.c_str()) * 380000;
        }


    }

    cout << total << endl;

}


Measured memory_bytes: 256
n,k,c = map(int, input().split())
s = input()

asc = []
des = []

count = 0
while count<n:
    if s[count]=="o":
        asc.append(count)
        count += c+1
    else:
        count += 1
asc = asc[0:k]

count = n-1
while count>=0:
    if s[count]=="o":
        des.append(count)
        count -= c+1
    else:
        count -= 1
des = des[0:k]
des.reverse()

# print(asc)
# print(des)

for i in range(len(asc)):
    if asc[i]==des[i]:
        print(asc[i]+1)


Measured memory_bytes: 22036
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long N;
    cin >> N;
    ll max_div = 0;
    for(size_t i=1;i*i<=N; i++)
    {
        if(N % i == 0) max_div = i;
    }
    cout << (max_div - 1) + (N / max_div - 1) << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority queue
#include<deque>//double_ended queue
using namespace std;
int main()
{ 
    long long int n;
    cin>>n;
    long long int sqrt=1;
    while(sqrt*sqrt<n){
        sqrt++;
    }
    while(n%sqrt!=0){
        sqrt--;
    }
    cout<<sqrt+n/sqrt-2<<endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize (2)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii =  pair<int,int>;
const int  dir[2][2] = {{-1,0},{0,1}};
const int mod = 1000000007;
const int INF = 0x3f3f3f;
#define all(v) v.begin(),v.end()
ll quick_pow(ll base, ll n) {
    ll ans = 1;
    while (n ) {

        if (n & 1 )ans *= base;

        base *= base;
        n >>= 1;
    }
    return ans;

}
void solution();
int main() {
    int T = 1;
//    cin>>T;
    while (T--) {
        solution();
    }
    return 0;
}
void solution(){
  int n;
  scanf("%d",&n);
  --n;
  ll ans = 0;
  for(int i = 1; i <= (n); ++i) {
    ans += n/i;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3752
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: u64, b: u64
    }

    println!("{}", (a-1)*(b-1));
}

Measured memory_bytes: 4352
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();

		if(a < b) {
			System.out.println("a < b");
		}else if(a > b) {
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}


	}

}


Measured memory_bytes: 26144
import bisect

n = int(input())
ls = list(map(int, input().split()))
ls.sort()

count = 0

for i in range(n - 2):
  a = ls[i]
  for j in range(i + 1, n - 1):
    b = ls[j]
    index = bisect.bisect_left(ls, a + b)
    count += index - j - 1
print(count)


Measured memory_bytes: 3316
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, K, ans = 1e9;
int Group[15];
char S[15][1005];

int Now[15], Next[15];

int Solve(){
  int cnt = 0;
  for (int i = 0; i < H - 1; i++){
    if (Group[i] != Group[i + 1]) cnt++;
  }

  fill(Now, Now + H, 0);
  for (int i = 0; i <= W; i++){
    fill(Next, Next + H, 0);
    for (int j = 0; j <= H; j++){
      if (S[j][i] == '1'){
        Next[Group[j]]++;
      }
      if (Next[Group[j]] > K) return 0;
    }

    bool flag = false;
    for (int j = 0; j < H; j++){
      Now[j] += Next[j];
      if (Now[j] > K){
        cnt++; flag = true; break;
      }
    }
    if (!flag) continue;
    for (int j = 0; j < H; j++) Now[j] = Next[j];
  }
  ans = min(ans, cnt);

  return 0;
}

int Make_Group(int num, int turn){
  if (turn == H){
    Solve();
    return 0;
  }
  Group[turn] = num;
  Make_Group(num, turn + 1);
  Group[turn] = num + 1;
  Make_Group(num + 1, turn + 1);
  return 0;
}

int main(){
  scanf("%d%d%d", &H, &W, &K);
  for (int i = 0; i < H; i++) scanf("%s", S + i);

  Make_Group(0, 1);

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


Measured memory_bytes: 256
//ID: LRL52  Date: 2019.10.9 ~ 10.10
//组合数实际意义的应用(格点游走方案数)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#include<bits/stdc++.h>
using namespace std;
const int N = 4055, M = 2055; char ss[1 << 21], *A = ss, *B = ss, cc;
inline char gc(){return A == B && (B = (A = ss) + fread(ss, 1, 1 << 21, stdin), A == B) ? EOF : *A++;}
template<class T>inline void rd(T &x){
	int f = 1; x = 0, cc = gc(); while(cc < '0' || cc > '9'){if(cc == '-') f = -1; cc = gc();}
	while(cc >= '0' && cc <= '9'){x = x * 10 + (cc ^ 48); cc = gc();} x *= f;
}
const int P = 1e9 + 7;
int n;
int a[200055], b[200055], f[N][N];
const int maxn = 8000;
int jc[maxn + 5], jcinv[maxn + 5], inv[maxn + 5];

void Prework(int maxn){
	jc[0] = jc[1] = jcinv[0] = jcinv[1] = inv[1] = 1;
	rep(i, 2, maxn) jc[i] = 1LL * jc[i - 1] * i % P;
	rep(i, 2, maxn) inv[i] = 1LL * (P - P / i) * inv[P % i] % P;
	rep(i, 2, maxn) jcinv[i] = 1LL * jcinv[i - 1] * inv[i] % P;
}

int C(int n, int m){return 1LL * jc[n] * jcinv[n - m] % P * jcinv[m] % P;}

#define f(i, j) f[i + 2005][j + 2005]
int main(){
	//freopen("AGC001E.in", "r", stdin);
	//freopen("AGC001E.out", "w", stdout);
	rd(n);
	rep(i, 1, n) rd(a[i]), rd(b[i]);
	Prework(8000);
	rep(i, 1, n)
	    ++f(-a[i], -b[i]);
	rep(i, -2000, 2000)
	    rep(j, -2000, 2000)
	        f(i, j) = (1LL * f(i, j) + f(i - 1, j) + f(i, j - 1)) % P;
	int ans = 0;
	rep(i, 1, n) 
	    ans = (ans + f(a[i], b[i])) % P;
	rep(i, 1, n){
		ans = (ans - C(2 * (a[i] + b[i]), 2 * a[i]) + P) % P;
	} 
	ans = 1LL * ans * inv[2] % P;
	printf("%d\n", ans);
	return 0;
}

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

int main()
{
	long long A, B, C;
	scanf("%lld %lld %lld", &A, &B, &C);
	
	if ((A + B + C) % 2 == 0) printf("0\n");
	else {
		if (A > B) {
			B += A;
			A = B - A;
			B -= A;
		}
		if (A > C) {
			C += A;
			A = C - A;
			C -= A;
		}
		if (B > C) {
			C += B;
			B = C - B;
			C -= B;
		}
		printf("%lld\n", A * B);
	}
	
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = sc.nextInt();

        StringBuilder b = new StringBuilder("");
        if (n == 0)
            b.append(0);
        while (n != 0) {
            int rem = n % -2;
            n /= -2;
            if (rem < 0) {
                rem += 2;
                n++;
            }
            b.append(rem);
        }

        w.println(b.reverse().toString());
        w.close();
    }
}


Measured memory_bytes: 21844
/*author : Yashvardhan
Saturday, April 04, 2020
5:31 PM
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))
#define printArr(name,from,to) for(int x = from; x < to; x++) cout << name[x] << " ";


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

#ifdef __APPLE__
#define debug(...) __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...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,m;
	cin >> n >> m;

	vi arr(n);
	int tot = 0;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		tot += arr[i];
	} 

	sort(arr.rbegin(),arr.rend());
	bool flag = true;
	for(int i = 0; i < m; i++){
		int curr = arr[i];
		if(curr*4*m < tot) flag = false; 
	}

	if(!flag) cout << "No" << endl;
	else cout << "Yes" << endl;
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


typedef  long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
const int N=2005+5;

int mod=1000000007 ;
ll mul (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll add (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a+b+mod)%mod;
}
ll fastpow(ll b, ll p)
{
    if(p==0)
        return 1;
    ll ans=fastpow(b,p/2);ans=mul(ans,ans);
    if(p%2)ans=mul(ans,b);
    return ans;
}
ll fac[N];
ll inv(ll x)
{
    return fastpow(x,mod-2);

}
ll ncr(ll n, ll r)
{
return mul(inv(fac[r]),mul(fac[n],inv(fac[n-r])));

}


int main()
{
    FIO
    fac[0]=1;
    for(int i=1;i<N;i++)
        fac[i]=mul(fac[i-1],i);
    int n, k;
    cin>>n>>k;
    for(int i=1;i<=k;i++)
    {
        if(n-k-i+1<0)
            cout<<"0\n";
        else
        {
            cout<<mul(ncr(n-k+1,i),ncr(k-1,k-i))<<endl;

        }


    }
      return 0;
}


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

int main(){ 
  vector<long long> luca;
  luca.push_back(2);
  luca.push_back(1);
  for(int i = 2; i < 87; i++){
    luca.push_back(luca.at(i-2) + luca.at(i-1));
  }
  int n;
  cin >> n;
  cout << luca.at(n)<< endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
using namespace std;
int main() {
	int a = 0, b = 0,c=0,count=0;
	cin >> a;
	if (a >= 2800) {
		cout << "AGC"<<endl;
	}
	else if (a < 1200) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ARC" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define hell 998244353 
#define endl "\n"

int min(int a, int b){
 
    if(a>b)
        return b;
    return a;
}
 
int max(int a, int b){
 
    if(a>b)
        return a;
    return b;
}


int32_t main()
{
    int a, b,c;
    cin>>a>>b>>c;
    int space = a-b;
    cout<<max(0,c-space);



    return 0;
}   

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{int p, l, r;};
struct Node T[MAX];
int n;

// 先行順巡回
void preParse(int u)
{
    // 親->左の子->右の子
    if (u == NIL) {  // 端点まで探索
        return;
    }
    printf(" %d", u);  // 親
    preParse(T[u].l);  // 左の子に行く
    preParse(T[u].r);  // 右の子に行く
}

// 中間順巡回
void inParse(int u)
{
    // 左の子->親->右の子
    if (u == NIL) {  // 端点まで探索
        return;
    }
    inParse(T[u].l);  // 左の子に行く
    printf(" %d", u);  // 親
    inParse(T[u].r);  // 右の子に行く
}

// 後行順巡回
void postParse(int u)
{
    // 左の子->右の子->親
    if (u == NIL) {  // 端点まで
        return;
    }
    postParse(T[u].l);  // 左の子
    postParse(T[u].r);  // 右の子
    printf(" %d", u);  // 親
}

int main()
{
    int i, v, l, r, root;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        T[i].p = NIL;
    }

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

    for (i = 0; i < n; i++) {
        if (T[i].p == NIL) {
            root = i;
        }
    }

    // 先行順巡回
    printf("Preorder\n");
    preParse(root);
    printf("\n");

    // 中間順巡回
    printf("Inorder\n");
    inParse(root);
    printf("\n");

    // 後行順巡回
    printf("Postorder\n");
    postParse(root);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2108
/**-------------------------
|--------From A.R.A--------|
-------------------------**/

#include <bits/stdc++.h>

#define ll            long long int
#define pb            push_back
#define ull           unsigned long long int
#define endl          "\n"
#define sz(c)         (c).size()
#define sall(c)       sort((c).begin(),(c).end())
#define rsall(c)      sort((c).rbegin(),(c).rend())
#define rev(c)        reverse((c).begin(),(c).end())
#define FOR(i,n)      for(ll i=0;i<n;i++)
#define max3(a,b,c)   max(max(a,b),c)
#define min3(a,b,c)   min(min(a,b),c)
#define input(a,i,n)  for(ll i=0;i<n;i++){      cin>>a[i];}
#define output(a,i,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}

using namespace std;
int64_t R=1;
void solution(){
    int64_t a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(max(b*d,a*c),max(a*d,b*c))<<endl;
}
int main()
{
    FOR(i,R){solution();}
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if(abs(A - B) <= (V - W) * T) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;

long long A[100000];
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    int odd_num = 0;
    for(int i = 0; i < N; i++){
        if(A[i] % 2 != 0){
            odd_num ++;
        }
    }
    if(odd_num % 2 == 0){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

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

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			if ((i + j == x) && (2 * i + 4 * j == y)) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3612
using System;

namespace ABC154A
{
    class Program
    {
        static void Main(string[] args)
        {
            string c, d;
            string[] aa = Console.ReadLine().Split(' ');
            c = aa[0];
            d = aa[1];
            int a, b;
            string[] ss = Console.ReadLine().Split(' ');
            a = int.Parse(ss[0]);
            b = int.Parse(ss[1]);
            string s = Console.ReadLine();
            if (s.Equals(c))
                Console.WriteLine((a - 1) + " " + b);
            else
                Console.WriteLine(a + " " + (b - 1));
            Console.ReadKey();


        }
    }
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  sort(all(d));
  int l=d[n/2-1],r=d[n/2];
  cout << r-l << endl;
  return 0;
}


Measured memory_bytes: 640
# Aizu Problem 0287: Jinkoki

import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

unit = ["","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko",
        "Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"]
while True:
    a, b = [int(_) for _ in input().split()]
    if a == 0:
        break
    n = a**b
    ans = ""
    for j in range(20):
        k = n % 10000
        if k > 0:
            ans = str(k) + unit[j] + ans
        n //= 10000
        if n == 0:
            break
    print(ans)

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

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;

signed main()
{

    int s, w;
    cin >> s >> w;

    if (s <= w)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

long long  gcd(long long  a, long long  b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

long long lcm(long long a, long long b) {
	long long  g = gcd(a, b);
	return a / g * b;
}

int main() {
	long long a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
}


Measured memory_bytes: 3024
#

import sys
from collections import deque
input=sys.stdin.readline

def main():
    H,W,K=map(int,input().split())
    x1,y1,x2,y2=map(int,input().split())
    x1-=1
    y1-=1
    x2-=1
    y2-=1
    mas=[list(input()) for i in range(H)]

    dist=[[-1]*W for i in range(H)]
    dist[x1][y1]=0
    
    qu=deque([(x1,y1)])
    qup=qu.popleft
    qua=qu.append
    
    d=((-1,0),(1,0),(0,-1),(0,1))
    
    while(len(qu)>0):
        v=qup()
        for di in d:
            for i in range(1,K+1):
                nvh=v[0]+i*di[0]
                nvw=v[1]+i*di[1]
                if nvh<0 or nvh>=H or nvw<0 or nvw>=W or mas[nvh][nvw]=="@":
                    break
                if dist[nvh][nvw]!=-1 and dist[nvh][nvw]<=dist[v[0]][v[1]]:
                    break
                if dist[nvh][nvw]==-1:
                    dist[nvh][nvw]=dist[v[0]][v[1]]+1
                    qua((nvh,nvw))
    print(dist[x2][y2])
    
if __name__=="__main__":
    main()


Measured memory_bytes: 138568
#include <stdio.h>
int main(){
  int p,q,r;
  fscanf(stdin,"%d%d%d",&p,&q,&r);
  if(p>=q&&p>=r)
    printf("%d",q+r);
  else if(q>=p&&q>=r)
    printf("%d",p+r);
  else
    printf("%d",p+q);
  return 0;
}


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

int main(){
    int n;  cin >> n;
    vector<int> h(n);
        for(int i=0; i<n; i++)
            cin >> h.at(i);
    vector<int> x(n);
    for(int i=0; i<n; i++) x.at(i)=0;
    bool f1 = true;
    int cnt = 0;
        while(f1){
            f1 = false;
            bool f2=false;
            for(int i=0; i<n; i++){
                if(x.at(i)<h.at(i)){
                    x.at(i) += 1;
                    if(!f2) cnt += 1;
                    f1 = true;
                    f2 = true;
                    continue;
                }
                f2 = false;
            }
        }
    cout << cnt << endl;
}


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < 2 * n; i += 2) {
    ans += a[i];
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long  ll;
typedef unsigned long long int ull;
#define pb push_back
#define For(ii,aa,bb) for(ll ii = aa; ii < bb;ii++)
#define Rof(ii,aa,bb) for(ll ii = aa; ii >= bb;ii--)
#define st first 
#define nd second 
#define MP make_pair
#define MAX 1000000009
#define MOD 1000000007
#define all(v6) v6.begin(),v6.end()
#define IT iterator
#define ln "\n"
#define F(ii) ((abs(ii) + ii)/2)
#define N 500005
using namespace std;
ll n, x;
int main(){
	#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n >> x;
	cout << (n == x ? "Yes" : "No");
	
}

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

int main(){
  int x,y;
  cin>>x>>y;
  int ans;
  if(x<y){
    if(x<0 && y>0){
      if(abs(x) < abs(y)) ans=y-x*-1+1;
      else ans=y*-1-x+1;
    }else{
      ans=y-x;
    }
  }else{
    if(y>0 || x<0) ans=y*-1 - x*-1 + 2;
    else if(abs(y) < abs(x)) ans=y-x*-1+1;
    else ans=y*-1-x+1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3540
import itertools

def calc_time(current_time):

    if current_time % 10 == 0:
        return current_time
    else:
        fraction = current_time % 10
        current_time += 10 -fraction
        return current_time


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

time_list = [a,b,c,d,e]

permutation_list = list(itertools.permutations(time_list))

current_time = 0
results = []

for times in permutation_list:
    for index, time in enumerate(times):
        current_time += time
        if index < 4:
            current_time = calc_time(current_time)
    results.append(current_time)
    current_time = 0
print(min(results))    

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
int len;
char ss[12];
LL dfs(int st,LL sum,LL now)
{
    if(st==len)  return sum;
    return dfs(st+1,sum+ss[st+1]-'0',ss[st+1]-'0')+dfs(st+1,sum+now*10+ss[st+1]-'0'-now,now*10+ss[st+1]-'0');
}
int main()
{
//	freopen("Many Formulas.in","r",stdin);
    scanf("%s",ss+1);
    len=strlen(ss+1);
    printf("%lld\n",dfs(1,ss[1]-'0',ss[1]-'0'));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d);
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    
    for(int i=0;i<n;i++){
        int b;
        cin >> b;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(b==a[i][j]) a[i][j]=0;
            }
        }
    }

    for(int i=0;i<3;i++){
        if(a[i][0]==a[i][1] && a[i][2]==a[i][1]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    for(int i=0;i<3;i++){
        if(a[0][i]==a[1][i] && a[2][i]==a[1][i]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if((a[0][0]==a[1][1] && a[1][1]==a[2][2]) || a[0][2]==a[1][1] && a[1][1]==a[2][0]){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

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

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

int main(){
    int k; cin >> k;
    int a, b; cin >> a >> b;
    for(int i = a; i <= b; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3636