akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::pair<ll, ll> pll;

using namespace std;

int main() 
{   
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;

    irep(i, s.size()) {
        string t = s.substr(i, s.size() - i);
        irep(j, t.size()) {
            string u = t.substr(0, t.size() - j);  
            if(u == "ABC") { ans++; }
            //cout << u << endl;
        }
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import Data.List
import Data.Function

withMinimum :: [Int] -> [(Int, Int)]
withMinimum [] = []
withMinimum xs = withMinimum' xs (head xs)

withMinimum' :: [Int] -> Int -> [(Int, Int)]
withMinimum' [] _ = []
withMinimum' (x:xs) m = (x, min') : withMinimum' xs min'
  where min' = min x m

maximumsCount :: [Int] -> Int
maximumsCount xs = fst res
  where res = foldl' next (0, 0) xs
        next (acc, x) y
          | y > x = (1, y)
          | y == x = (acc + 1, x)
          | otherwise = (acc, x)

main :: IO ()
main = do
  getLine
  line <- getLine
  let xs = read <$> words line :: [Int]
  print $ maximumsCount $ fmap (uncurry (-)) $ withMinimum xs


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

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (a * b >= c * d) {
    cout << a * b << endl;
  } else {
    cout << c * d << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>

using namespace std;
vector<int> vec;
vector<int> ans;

int main() {

	int n, k;
	cin >> n >> k;

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

	for (int i = 0; i <= n - k; ++i) {
		int tmp_ans = 0;
		int tmp2 = max(vec.at(i), vec.at(i + k - 1));
		int tmp3 = min(vec.at(i), vec.at(i + k - 1));
		tmp_ans = tmp2 - tmp3 + min(abs(vec.at(i)), abs(vec.at(i + k - 1)));
		ans.push_back(tmp_ans);
	}

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

	cout << ans.at(0) << endl;

	return 0;
}

Measured memory_bytes: 1144
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int64_t val;
    cin >> val;
    if(val%2==1) {
        cout << 0 << endl;
        return 0;
    }
    // There are a plenty of 2, so we consider the number of 5.
    val /= 2;
    int64_t power5 = 5;
    int64_t ans = 0;
    while(val >= power5) {
        ans += val / power5;
        power5 *= 5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
N = int(input())
A = [list(map(int,  input().split())) for i in range(N)]
A.sort(key=lambda x: x[0]+x[1])
now = -1e10
ans = 0
for i in range(N):
    [X, L] = A[i]
    if X-L >= now:
        now = X+L
        ans += 1
print(ans)

Measured memory_bytes: 32296
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    INIT;
    cin >> S >> T;
    ans = INF;
    REP(i, S.size()) {
        ll x = 0;
        string tmp = S.substr(i, T.size());
        if (tmp.size() != T.size())
            break;
        REP(j, T.size()) {
            if (tmp[j] != T[j])
                x++;
        }
        chmin(ans, x);
    }
    cout << ans << endl;
}

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

#define ll long long 
#define pll pair<ll,ll> 

const ll mod = 1e9+7;
int main(){

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

	ll n;
	cin>>n;
	ll A[n], ans=0, s=0;
	for(ll i=0;i<n;i++){
		cin>>A[i];
		ans+=(A[i]*s)%mod;
		s+=A[i];
		ans%=mod;
		s%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 5200
/*Author--Vishwas Agrawal*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define pb push_back
#define test \
   int t;    \
   cin >> t; \
   while (t--)
#define fio                          \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);                    \
   cout.tie(NULL);
#define mod 1000000007LL
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define inc(i, a, n) for (int i = a; i < n; i++)
#define dec(i, a, n) for (int i = n - 1; i >= a; i--)
int main()
{
  string s;
  cin>>s;
  int flag=0;
  ll sum=0;
  inc(i,0,s.length())
  {
     sum+=stoi(s.substr(i,1));
  }
   if(sum%9==0)
   cout<<"Yes"<<endl;
   else
   {
      cout<<"No"<<endl;
   }
   

   return 0;
}

Measured memory_bytes: 3756
import sys
import math
N,M=map(int,input().split())
ans=0
a=min(M+1,10**5)
b=M//N
for i in range(1,a):
    if M%i!=0:
        continue
    if i<=b:
        ans=max(ans,i)
    if M//i <=b:
        ans=max(ans,M//i)
print(ans)
        



Measured memory_bytes: 38640
## DP問題
 
N,M = map(int,input().split())
As = list(map(str,input().split()))
match = {"1":2, "2":5, "3":5,
         "4":4, "5":5, "6":6,
         "7":3, "8":7, "9":6}
 
# test
# N, M = 10000, 9
# As = [str(i) for i in range(1,10)]
 
 
ws = {} #マッチの数に対しての、作れる数字の最大値を算出
for a in As:
    w = match[a] #数aに使うマッチの数
    try: 
        ws[str(w)] = max(a,ws[str(w)])
    except:
        ws[str(w)] = a
ks = list(map(int,ws.keys()))
ns = list(ws.values())
 
dp = ["0" for _ in range(N+1)]
for i in range(1,min(ks)):#最小
    dp[i] = "-1"
 
for i in range(N+1):
    # print(i)
    for a,k in zip(ns,ks):
        if i+k <= N:
            if dp[i] == "-1":
                dp[i+k] = str(max(int(dp[i]+a),int(dp[i+k])))
            elif dp[i] == "0":
                dp[i+k] = str(max(int(a),int(dp[i+k])))
            elif len(dp[i+k]) < len(dp[i])+1:
                    dp[i+k] = dp[i]+a
            elif len(dp[i+k]) == len(dp[i])+1:
                dp[i+k] = max(dp[i+k],dp[i]+a)
            # else:
            #     dp[i+k] = str(max(int(dp[i+k]),int(dp[i]+a)))

        else:
            continue
print(dp[N])

Measured memory_bytes: 29684
#include <bits/stdc++.h>
 
using namespace std; 
 
long long int p[500501];
 
long long int find(long long int a)
{
	if(p[a]<0ll){
		return a;
	}
	else{
		return p[a]=find(p[a]);
	}
}
 
void merge(long long int a,long long int b)
{	
	a=find(a);
	b=find(b);
	if(a==b){
		return;
	}
	else{
		if(p[a]>p[b]){
			swap(a,b);
		}
		p[a]+=p[b];
		p[b]=a;
	}
}
 
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int n,m;
    cin>>n>>m;
	memset(p,-1,sizeof(p));
	while(m--){
		long long int u,v;
		cin>>u>>v;
		merge(u,v);
	}
	long long int ans=INT_MIN;
	for(long long int i=1;i<=n;i++){
		if(p[i]<0){
			ans=max(ans,(p[i]*-1));
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 7560
import java.util.Scanner;

public class Main {

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

			while(sc.hasNext()) {
				int a = sc.nextInt();
				int b = sc.nextInt();

				if ( (a!=0) && (b!=0) )
				{
					for (int i = 0; i < a; i++) {
						for (int j = 0; j < b; j++) {
							if (j == (b - 1))
								System.out.printf("#\n");
							else
								System.out.printf("#");

						}
					}
				}
				else
					break;
				System.out.println();
			}
	}
}



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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  int n;cin>>n;
  ll dp[n+2000]={};
  for(int i=0;i<n+2000;i++)dp[i]=llINF;
  int k=2;
  dp[0]=0;
  vector<ll>h(n+100);
  for(int i=0;i<n;i++)cin>>h[i];
  for(int i=0;i<n;i++){
    for(int j=1;j<=k;j++){
      dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
    }
  }
  //for(int i=0;i<=n;i++)cout<<dp[i]<<endl;
  cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define elif else if
#define rep(i,n) for((i)=(0);(i)<(n);++(i))
#define str string
#define Cout(a) cout<<(a)<<endl;
int a,b,c,i,j,k,n,m,x,y,cnt=0,ans=0;
str s,t;

int main(){
  int a[3];
  rep(i,3)cin>>a[i];
  sort(a,a+3);
  bool w = a[0]==5&&a[1]==5&&a[2]==7;
  cout<<( w?"YES":"NO" )<<endl;
  return 0;
}


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

int A, B;
int ans;

int main() {
    cin >> A >> B;
    if (A >= 13) ans = B;
    else if (A >= 6) ans = B / 2;
    else ans = 0;

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

Measured memory_bytes: 256
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        String s = next();

        if(s.equals("Sunny")) println("Cloudy");
        if(s.equals("Cloudy")) println("Rainy");
        if(s.equals("Rainy")) println("Sunny");

    }

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

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 20692
use std::io::BufRead;

fn main() {
  let stdin = std::io::stdin();
  for line in stdin.lock().lines() {
    let line = line.unwrap();
    let mut iter = line.trim().split_whitespace()
      .map(|x| x.parse::<i32>().unwrap());

    let m = iter.next().unwrap();
    let f = iter.next().unwrap();
    let r = iter.next().unwrap();

    if m == -1 && f == -1 && r == -1 {
      break;
    }

    let mf = m + f;
    let score =
      if m == -1 || f == -1 {
        'F'
      } else if mf >= 80 {
        'A'
      } else if mf >= 65 {
        'B'
      } else if mf >= 50 {
        'C'
      } else if mf >= 30 {
        if r >= 50 { 'C' } else { 'D' }
      } else {
        'F'
      };

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


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

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    int L, R, Min = INT_MAX, Max = INT_MIN;
    for (int i = 1; i <= m; i++)
        scanf("%d%d", &L, &R), Min = min(Min, R), Max = max(Max, L);
    printf("%d\n", max(Min - Max + 1, 0));
    cin >> ws;
    return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<long long>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  long long okane=1000;
  long long shou=a[0];
  for(int i=0;i<n-1;i++){
    shou=a[i];
    for(int j=i+1;j<n;j++){
      if(shou<a[j]){
        okane=(okane/shou)*a[j]+okane%shou;
        //cout<<shou<<i<<j;
        i=j-1;
        shou=a[j];
        break;
      }
      shou=min(a[j],shou);
    }
  }  
  cout<<okane<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    for (u32 i = 0; i < N; i++) {
        cout << S[i] << T[i];
    }
    cout << endl;
}



Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

cnt = 0

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 == 0 or A[i] % 5 == 0:
      cnt += 1
    else:
      pass
  else:
    cnt += 1

if cnt == N:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 3064
import itertools
def main():
    l = list(map(int, input().split()))
    all_pair = []
    all_pair.append(l[0]*l[2])
    all_pair.append(l[0]*l[3])
    all_pair.append(l[1]*l[2])
    all_pair.append(l[1]*l[3])
    print(sorted(all_pair)[-1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 61956
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL a;
    string s,ans;
    cin >> a;
    cin >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int prime(int x){
  int i;
  if(x < 2) return 0;
  if(x == 2) return 1;
  if(x % 2 == 0) return 0;
  for(i = 3;i * i <= x;i += 2)
    if(x % i == 0) return 0;
 
  return 1;
}
 
int main(){
  int   i,n, c = 0, a;
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%d", &a);
    c += prime(a);
  }
  printf("%d\n", c);
  return 0;
}



Measured memory_bytes: 2108
#include <stdio.h>
#include <string.h>
int main()
{
	int a,c,d,b;
	char s[10000];
	scanf("%d\n",&a);
	gets(s);
	d=strlen(s);
	for(b=0;b<d;b++)
	{c=s[b]+a;
		if(c<=90){s[b]=c;}else
		{s[b]=c-26;
		
	}
	}
	printf("%s",s);
	return 0;
	}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll a[310][310];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	string ans;
	while (n != 0) {
		if (n % 2) {
			n--;
			ans = "1" + ans;
		}
		else {
			ans = "0" + ans;
		}
		n /= -2;
	}
	if (ans == "")ans = "0";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3640
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Kenken Race
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

bool reachable(int st, int gl) {
  for (int x = st; x <= gl;) {
    while (x <= gl && s[x] == '.') x++;
    if (x > gl) break;
    int x1 = x + 1;
    while (x1 <= gl && s[x1] == '#') x1++;
    if (x1 - x > 1) return false;
    x = x1;
  }
  return true;
}

bool pass(int b, int d) {
  b--, d++;
  for (int x = b; x <= d;) {
    while (x <= d && s[x] == '#') x++;
    if (x > d) break;
    int x1 = x + 1;
    while (x1 <= d && s[x1] == '.') x1++;
    if (x1 - x > 2) return true;
    x = x1;
  }
  return false;
}

/* main */

int main() {
  int n, a, b, c, d;
  scanf("%d%d%d%d%d%s", &n, &a, &b, &c, &d, s);
  a--, b--, c--, d--;

  if (reachable(a, c) && reachable(b, d) && (c < d || pass(b, d)))
    puts("Yes");
  else
    puts("No");
  
  return 0;
}


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

#define INF INT64_MAX

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<pair<int, long long>>> g( n );
	for( int i = 0; i < m; i++ ) {
		int u, v;
		long long s;
		cin >> u >> v >> s;
		u--;
		v--;
		g[u].push_back( make_pair( v, s ) );
		g[v].push_back( make_pair( u, s ) );
	}

	vector<bool> plus( n );
	plus[0] = true;
	vector<long long> value( n, INF );
	value[0] = 0;
	long long offset = INF;
	stack<int> st;
	st.push( 0 );
	while( !st.empty() ) {
		int u = st.top();
		st.pop();
		for( auto e : g[u] ) {
			int v = e.first;
			long long s = e.second;
			if( u == v ) continue;
			if( value[v] == INF ) {
				plus[v] = !plus[u];
				value[v] = s - value[u];
				st.push( v );
				continue;
			}
			if( plus[u] != plus[v] ) {
				if( value[u] + value[v] != s ) {
					cout << 0 << endl;
					return 0;
				}
				continue;
			}
			long long diff = s - ( value[u] + value[v] );
			if( plus[v] ) diff = ( value[u] + value[v] ) - s;
			if( diff % 2 ) {
				cout << 0 << endl;
				return 0;
			}
			if( offset != INF && offset != diff / 2 ) {
				cout << 0 << endl;
				return 0;
			}
			offset = diff / 2;
		}
	}
	long long posmin = INF;
	long long negmin = INF;
	for( int i = 0; i < n; i++ ) {
		if( plus[i] ) {
			posmin = min( posmin, value[i] );
		}
		else {
			negmin = min( negmin, value[i] );
		}
	}
	int ans;
	if( offset != INF ) {
		if( posmin - offset > 0 && negmin + offset > 0 ) {
			ans = 1;
		}
		else {
			ans = 0;
		}
	}
	else {
		ans = max( 0LL, posmin + negmin - 1 );
	}

	cout << ans << endl;

}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}

int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int k,n;
	cin >> n >>k;
	VI d(n), t(n);
	rep(i,n) cin >>t[i] >>d[i];
	VI idx(n), dt(n+10, -1); iota(all(idx),0);
	stable_sort(all(idx), [&d](int a, int b){return d[a] > d[b];});
	rep(j, n){
		int i = idx[j];
		if(dt[t[i]]<0) dt[t[i]]=i;
	}
	vector<bool> usd(n+10), uss(n+10);
	VI pdel, padd;
	pdel.reserve(n); padd.reserve(n);
	ll cnd=0;
	rep(j, k){
		int i = idx[j];
		cnd += d[i];
		uss[t[i]] = usd[i] = 1;
		if(dt[t[i]] !=i) pdel.push_back(i);
	}
	ll wz=0;
	rep(i, n+5) wz += uss[i]==1;
	cnd += wz * wz;
	//dbg("1stcnz",cnd,wz);
	ll ans = cnd;
	for(int q: dt) if(q>=0 && !usd[q]) padd.push_back(q);
	
	sort(all(padd),[&d](int a, int b){return d[a] <d[b];});
	sort(all(pdel),[&d](int a, int b){return d[a] >d[b];});
	
	while(1){
		int dlc=-1, adc=-1;
		while(!pdel.empty() && dlc<0){
			auto p1= pdel.back(); pdel.pop_back();
			if(usd[p1]) dlc = p1;
		}
		while(!padd.empty() && adc<0){
			auto p1= padd.back(); padd.pop_back();
			if(!usd[p1] && !uss[t[p1]]) adc =p1;
		}
		if(dlc<0 || adc<0) break;
		
		cnd -= d[dlc]; usd[dlc]=0;
		cnd += d[adc]; usd[adc] =uss[t[adc]]=1;
		cnd += (wz+1)*(wz+1) - wz*wz;
		wz++; 
		//dbg(cnd,wz);
		ans = max(ans, cnd);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 2108
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

int main(void){
  string s,len="";
  getline(cin,s);
  
  s += ' ';
  vector<string> arys;
  string ss="";
  rep(i,s.size()){
    if(s[i] != ' '){
      ss += s[i];
    }else{
      arys.push_back(ss);
      if(len.size() < ss.size())len=ss;
      ss = "";
    }
  }
  vector<int> aryi(arys.size(),0);
  int n = arys.size(),used=0,index=-1;
  rep(i,n){
    loop(j,i,n){
      if(arys[i] == arys[j]){
        aryi[i]++;
        if(aryi[i] > used){
          index = i;
          used = aryi[i];
        }
      }
    }
  }
  
  cout<<arys[index]<<" "<<len<<endl;

}

Measured memory_bytes: 1196
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> num (N);
  vector<vector<int>> list (N,vector<int>(30));
  for (int i=0; i<N; i++) {
    cin >> num.at(i);
    for (int j=0; j<num.at(i); j++) {
      cin >> list.at(i).at(j);
    }
  }
  int judge;
  int answer=0;
  for (int i=1; i<M+1; i++) {
    judge = 1;
    for (int j=0; j<N; j++) {
      for (int k=0; k<num.at(j); k++) {
        if (i == list.at(j).at(k)) {
          break;
        }
        if (k == num.at(j)-1) {
          judge = 0;
          break;
        }
      }
      if (judge == 0) {
        break;
      }
    }
    answer += judge;
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
void no(){
    cout << -1 << endl;
    exit(0);
}
vector<int> ans[100005];
int main() {
    string s;
    int n;cin >> s;
    n = s.size();
    if(s[0]=='0' || s[n-1] == '1' || s[n-2] == '0'){
        no();
    }
    rep(i,n-1){
        if(s[i]!=s[n-2-i]){
            no();
        }
    }
    int root = 2;
    ans[2].push_back(1);
    for(int i= 2;i<n;i++){
        bool f = s[i-1] == '1';
        if(!f)
        {
            ans[root].push_back(i+1);
        }else {
            ans[i+1].push_back(root);
            root = i+1;
        }
    }
    rep(i,n+1)
    {
        for(auto s:ans[i]){
            cout << i << " " << s << endl;
        }
    }
    
}


Measured memory_bytes: 8192
//
//$$$$$$$$$$$$$$$$$$$$$$
//$$                  $$
//$$   gyoubu_oniwa   $$
//$$                  $$
//$$$$$$$$$$$$$$$$$$$$$$
//
#include<bits/stdc++.h>
using namespace std;
#define DBG(a) cout<<#a<<':'<<a<<endl;
#define PB push_back
#define EB emplace_back
#define btoe(v) (v).begin(),(v).end()
#define F first
#define S second
#define L length()
#define SZ size()
#define pow(a,b) (pow(a,b)+0.5)

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--) 
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<string> vs;typedef vector<vector<string>> vvs;

#define unmp unordered_map

#define PRIME ((lli)(1e9+7ll))
#define PRIME2 (998244353ll)
const lli TEN_18 = 1e18;
const lli TEN_9 = 1e9;
const lli TEN_5 = 1e5;

inline void debugORfast(int a=1,int b=1){
    if(a){
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
        #endif
    }
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}}

template<typename T>
void print(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin==-1) fl(i,0,v.SZ) cout<<setw(w)<<v[i]<<' ';
	else if(end==-1) fl(i,begin,v.SZ) cout<<setw(w)<<v[i]<<' ';
	else fl(i,begin,end) cout<<setw(w)<<v[i]<<' ';
	cout<<endl;
}

template<typename T>
void printr(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin==-1) flr(i,v.SZ-1,-1) cout<<setw(w)<<v[i]<<' ';
	else if(end==-1) flr(i,begin,-1) cout<<setw(w)<<v[i]<<' ';
	else flr(i,begin,end) cout<<setw(w)<<v[i]<<' ';
    cout<<endl;
}

void pans(char v){
	switch(v){
		case 'y' : cout<<"yes"<<endl; break;
		case 'n' : cout<<"no"<<endl; break;
		case 't' : cout<<"True"<<endl; break;
		case 'f' : cout<<"False"<<endl; break;
		case 'Y' : cout<<"Yes"<<endl; break;
		case 'N' : cout<<"No"<<endl; break;
	}
}


lli tmp1,tmp2;

int main()
{
	debugORfast(0,1);
	const int DBGDO=100;
	//w(ttt)
	{
		lli x,y; cin>>x>>y;
		lli t = (y-(2*x))/2;
		lli c = x-t;
		if(c>=0 and t>=0 and c+t == x and (2*c + 4*t)==y) pans('Y');
		else pans('N');
	}

	return 0;
}


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int taro_point = 0;
		int hanako_point = 0;
		int num = Integer.parseInt(br.readLine());

		for(int i = 0; i < num; i++){

			String[] token = br.readLine().split(" ");
			String taro_card = token[0];
			String hanako_card = token[1];
			int compare = taro_card.compareTo(hanako_card);

			if(compare < 0){
				hanako_point += 3;
			}else if(compare > 0){
				taro_point += 3;
			}else if(compare == 0){
				taro_point++;
				hanako_point++;
			}

		}

		System.out.println(taro_point + " " + hanako_point);

	}
}

Measured memory_bytes: 25004
// abc123_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int A[5] = {0};
    REP(i, 5) cin >> A[i];
    sort(A, A+5);

    int ans = INF;
    do {
        int tmp = 0;
        REP(i, 4) {
            tmp += A[i];
            tmp = 10 * ((tmp + 9) / 10);
        }
        tmp += A[4];
        ans = min(ans, tmp);
    } while (next_permutation(A, A+5));

    print(ans);

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

n, C = map(int, input().split())
stc = []
max_t = 0
for i in range(n):
    s, t, c = map(int, input().split())
    max_t = max(max_t, t)
    stc.append([s, t, c])

len_imos = max_t+1
imos = [[0 for _ in range(len_imos)] for _ in range(C)]
for i in range(n):
    s, t, c = stc[i]
    imos[c-1][s-1] += 1
    imos[c-1][t] -= 1

for j in range(C):
    v = 0
    for i in range(len_imos):
        v += imos[j][i]
        imos[j][i] = v

ans = 0
v = 0
for i in range(len_imos):
    v = 0
    for c in range(C):
        v += 1 if imos[c][i] > 0 else 0
    ans = max(ans, v)
# print(imos)
print(ans)


Measured memory_bytes: 123528
from fractions import gcd
a, b, c, d = map(int, input().split(' '))

# # cye bolunenler
# c_numbers = b//c - (a-1)//c
# # dye bolunenler
# d_numbers = b//d - (a-1)//d
# # ortak bolunenler
# gcd_number = c*d // gcd(c, d)
# ortak = b//gcd_number - (a-1)//gcd_number
# # result
# print(b-a+1-(c_numbers+d_numbers-ortak))

cd = gcd(c, d)
cd = c * d // cd
c_able = b // c - (a - 1) // c
d_able = b // d - (a - 1) // d
cd_able = b // (cd) - (a - 1) // (cd)

print(b - a + 1 - (c_able + d_able - cd_able))

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

int main(void) {
	string N;
	cin >> N;
	long sum = 0;
	for (int i = 0; i < N.length(); i++) {
		sum += N[i] - '0';
	}
	// cout << sum << "\n";
	printf(sum % 9 == 0 ? "Yes\n" : "No\n");

	return 0;
}


Measured memory_bytes: 3828
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String[] nums = str.split(" ");
		int a = Integer.parseInt(nums[0]);
		int b = Integer.parseInt(nums[1]);
		System.out.println(a * b + " " + 2 * (a + b));
	}
}

Measured memory_bytes: 17128
let m = 1000000007
let ( * ) a b = a * b mod m
let rec f n a = if n <= 1 then a else f (n - 1) (a * n)
let rec g b n = if n <= 0 then 1 else let p = g b (n / 2) in p * p * if n mod 2 = 0 then 1 else b
let c n r = if n < r || n < 0 || r < 0 then 0 else f n 1 * g (f r 1) (m - 2) * g (f (n - r) 1) (m - 2)
let _ = Scanf.scanf "%d %d" @@ fun x y -> Printf.printf "%d\n" @@ if (x + y) mod 3 > 0 then 0 else c ((x + y) / 3) (y - (x + y) / 3)

Measured memory_bytes: 384
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<int,int>;
using namespace std;
template<class T>T chmin(T a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T b,T a){if(a<b){a^=b;b^=a;a^=b;return 1;}return 0;}

ll n;
vector<ll> h;
void input(){
    cin>>n;
    h.resize(n);
    rep(i,n){
        ll a;
        cin>>a;
        h[i]=a;
    }
}
void src(){
    int count=0;
    int cmax=0;
    rep(i,n-1){
        if(h[i]>=h[i+1]){count++;if(count>cmax) cmax=count;}
        else{count=0;}
    }
    cout<<cmax;
    return;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 1024
n, k = map(int, input().split())
P = list(map(lambda x:int(x)-1, input().split()))
C = list(map(int, input().split()))
D = [-1]*n
ans = -float("inf")
for i, p in enumerate(P):
    ans = max(ans, C[p])
    temp = p
    res = C[p]
    cnt = 1
    while temp != i and cnt < k:
        temp = P[temp]
        res += C[temp]
        cnt += 1
        ans = max(ans, res)
    D[i] = (cnt, res)
for i in range(n):
    a, b = D[i]
    ans = max(ans, b)
    if a == k:
        continue
    if b < 0:
        continue
    temp = b * (k//a-1)
    rest = k%a+a
    now = i
    for _ in range(rest):
        now = P[now]
        temp += C[now]
        ans = max(ans, temp)
print(ans)

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

res = 0
prev = H[0]
count = 0

for i in range(1, N):
    if H[i] <= prev:
        count += 1
    else:
        count = 0
    prev = H[i]
    res = max(res, count)

print(res)


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

int main()
{
  ll N, K; cin >> N >> K;
  ll ans = 0;
  if(N % K == 0) cout << ans << endl;
  else cout << min(N%K, abs(N%K-K)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::string s; cin >> s;
	
	int mi = 1 << 30;
	for(int i = 0; i < s.size() - 2; i++) {
		int X = std::stoi(s.substr(i, 3));
		mi = std::min(mi, std::abs(X - 753));
	}
	printf("%d\n", mi);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);    
#define f(i,j,k)  for(int i=j;i<k;i++)
#define fr(i,j,k) for(int i<=k-1;i>=j;i--)
#define ll long long
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()

using namespace std;

int main()
{
	fio
	int TC;
	//cin>>TC;
	TC=1;
	while(TC--)
	{
		int s,w;
		cin>>s>>w;
		cout<<(w>=s?"unsafe":"safe")<<endl;
		
	}
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

bool in(string s1, string s2) {
  int64 idx = 0;
  REP(i, s2.size()) {
    if (idx < s1.size() && s1[idx] == s2[i]) idx++;
  }
  return idx == s1.size();
}

::std::vector<::std::int64_t> divisors(::std::int64_t x) {
	::std::vector<::std::int64_t> res;
	for (::std::int64_t i = 1; i*i <= x; ++i) {
		if (x % i == 0) {
			res.push_back(i);
			if (i * i != x) res.push_back(x / i);
		}
	}
	::std::sort(res.begin(), res.end());
	return res;
}

int64 r, D, x;
int main(void) {
  cin >> r >> D >> x;
  REP(i, 10) {
    x = r*x - D;
    cout << x << endl;
  }
}

/*()
int main(void) {
  int64 N, M;
  cin >> N >> M;
  vector<int64> G(N+1, 0);
  REP(i, M) {
    int64 l, r;
    cin >> l >> r;
    G[l-1]++;
    G[r]--;
  }
  int64 res = 0;
  REP(i, N) {
    G[i+1] += G[i];
    if (G[i] == M) res++;
  }
  cout << res << endl;
}
*/

Measured memory_bytes: 256
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    auto s = readln.chomp;
    
    int ans = 0;
    for (int i = 0, j = s.length.to!int - 1; i < j; ++i, --j) {
        if (s[i] != s[j]) { ++ans; }
    }
    
    ans.writeln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

const int x_max = 1004;
const int k_max = 3005;

signed main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    int A[x_max],B[x_max],C[x_max];
    REP(i,x) cin >> A[i];
    REP(i,y) cin >> B[i];
    REP(i,z) cin >> C[i];
    sort(A,A+x);
    reverse(A,A+x);
    sort(B,B+y);
    reverse(B,B+y);
    sort(C,C+z);
    reverse(C,C+z);

    vector<int> tmp;
    REP(i,x){
        REP(j,y){
            REP(l,z){
                if(i * j * l > k) break;
                tmp.push_back(A[i] + B[j] + C[l]);
            }
        }
    }
    sort(tmp.rbegin(), tmp.rend());
    REP(i,k) cout << tmp[i] << endl;


}

Measured memory_bytes: 35172
fun main(args: Array<String>) {
    val N = readInt()
    val list = (0 until N).map { readPair(String::toString, String::toInt) }.toList()
    val X = readString()
    println(list.dropWhile { it.first != X }.drop(1).sumBy { it.second })
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <S, T> readPair(s: (String) -> S, t: (String) -> T) =
    readLine()!!.split(" ").let { Pair(s(it[0]), t(it[1])) }


Measured memory_bytes: 36300
abcde = []
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
k = int(input())

if (max(abcde) - min(abcde)) <= k:
    print("Yay!")
else:
    print(":(")


Measured memory_bytes: 3060
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%3==0||b%3==0||(a+b)%3==0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }
  }
}

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

int N, M;
int a[28], b[28];
int perm[8];
int ans = 0;

void permutation(int n) {
    for (int i = 0; i < n; i++) {
        perm[i] = i;
    }
    do {
        if (perm[0] != 0) continue;
        bool mitasu;
        for (int i = 0; i < n-1; i++) {
            mitasu = false;
            for (int j = 0; j < M; j++) {
                if ((perm[i] + 1 == a[j] && perm[i+1] + 1 == b[j]) ||
                    (perm[i] + 1 == b[j] && perm[i+1] + 1 == a[j])) {
                        mitasu = true;
                }
            }
            if (!mitasu) break;
        }
        ans += mitasu;
    } while (next_permutation(perm, perm + n));
    return ;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) cin >> a[i] >> b[i];
    permutation(N);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

map <int, int> Mx;
vector <int> Vu;
int main() {
	int N, K, i, j;
	scanf("%d %d", &N, &K);
	for (i = 1; i <= N; i++) {
		scanf("%d", &j);
		Mx[j]++;
	}
	K = min(K, (int)Mx.size());
	for (auto it : Mx) Vu.push_back(it.second);
	sort(all(Vu));
	reverse(all(Vu));

	int ans = N;
	for (i = 0; i < K; i++) ans -= Vu[i];
	return !printf("%d\n", ans);
}

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

int main() {
    ll n,ans=0;
    cin>>n;
    for(ll i=2; i*i<n; i++) {
        if(n % i != 0) continue;
        ll num = 0;
        while(n % i == 0) {
            n /= i;
            num++;
        }
        for(int j=1; ; j++) {
            if(num >= j) {
                num -= j;
                ans++;
            }
            else break;
        }
    }
    if(n != 1) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
import sys
def solve(n,m):
    d = [0]*n
    d_ = [0]*n
    for i in range(m):
        p = [int(x) for x in sys.stdin.readline().split()]
        for c in p[2:]:
            d[c-1] += p[0]
        if len(p) == 3:
            d_[p[2]-1] += p[0]
    ma = max(d)
    mi = min(d_)
    for i in range(n):
        if d[i] == ma:
            if d_[i] != mi:
                print(ma-mi+1)
                return
        else:
            if d_[i] == mi:
                print(ma-mi+1)
                return
    d.sort()
    d_.sort()
    print(max(d[-2]-mi,ma-d_[1])+1)
while 1:
    n,m = [int(x) for x in sys.stdin.readline().split()]
    if n == 0:
        break
    solve(n,m)



Measured memory_bytes: 6092
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
box = [1] * n
nya = [True] + [False]*(n-1)
for i in range(m):
    x,y = map(lambda x:int(x)-1,input().split())
    # if box[x] < 2:
    #     if nya[x] == True:
    #         if box[x]-1 == 0:
    #             nya[x] = False
    #         nya[y] = True
    #     else:
    #         nya[y] = False
    #     box[x] -= 1
    #     box[y] += 1
    # else:
    #     nya[y] = True
    #     box[x] -= 1
    #     box[y] += 1
    box[x] -= 1
    box[y] += 1
    if nya[x]:
        nya[y] = True
    if box[x] == 0:
        nya[x] = False
print(nya.count(True))


Measured memory_bytes: 12620
import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	long p = 1;
	for(int i = 1; i <= n; i++) {
		p = (p * i) % ((int)Math.pow(10, 9) + 7);
	}
	System.out.println(p);
}
}


Measured memory_bytes: 21844