akhauriyash/Code-Regression huggingface dataset:
<?php

while (true) {
    $chr = fgetc(STDIN);
    if (false === $chr) break;

    echo replace_char($chr);
}

function replace_char($chr)
{
    $code = ord($chr);

    if (ord('a') <= $code && $code <= ord('z')) {
        $d = $code - ord('a');
        return chr(ord('A') + $d);
    }

    if (ord('A') <= $code && $code <= ord('Z')) {
        $d = $code - ord('A');
        return chr(ord('a') + $d);
    }

    return $chr;
}

Measured memory_bytes: 6600
a, b, c = map(int, input().split())
k = int(input())
cnt = 0

for i in range(k):
  if a < b:
    break
  b *= 2
  #print("1 a:{} b:{} c:{}".format(a, b, c))
  cnt += 1

for i in range(k - cnt):
  if b < c:
    break
  c *= 2
  #print("2 a:{} b:{} c:{}".format(a, b, c))

if a < b and b < c:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9176
/*
AizuOnline A0228
Title
@kankichi573
*/
#include <stdio.h>
int n;
char hyouji[]={0b1111110, // 0
               0b0110000, // 1
               0b1101101, // 2
               0b1111001, // 3
               0b0110011, // 4
               0b1011011, // 5
               0b1011111, // 6
               0b1110010, // 7
               0b1111111, // 8
               0b1111011, // 9
               0b0000000  // blank
}; 
//
print_binary(char v)
{
        printf("%d",(v & 1)?1:0);
        printf("%d",(v & 2)?1:0);
        printf("%d",(v & 4)?1:0);
        printf("%d",(v & 8)?1:0);
        printf("%d",(v & 16)?1:0);
        printf("%d",(v & 32)?1:0);
        printf("%d",(v & 64)?1:0);
        printf("\n");
}
main()
{
        int i,old,new;


        while(EOF!=scanf("%d",&n) && n!=-1)
        {
                old=10;  // blank
                for(i=0;i<n;i++)
                {
                        scanf("%d",&new);
                        print_binary(hyouji[new] ^ hyouji[old]);
                        old=new;
                }
        }
return(0);
}

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


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

  vector<int> v(N);
  for(int i=0; i<N; ++i) {
    cin >> v[i];
  }

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


  int L = v[N-1];
  int sum = 0;
  for(int i=0; i<N-1; ++i) {
    sum += v[i];
  }
  if(sum > L) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

using namespace std;

int main() {
    /* code */
    double A, B, C, D, E;
    cin >> A >> B >> C;
    double ans = (B - C)/0.006;//嬉しい標高
    double pin = 10000000;//現時点最高の標高差
    int memo;
    for (size_t i = 0; i < A; i++)
    {
        cin >> D;//もらった標高
        if (abs(D-ans)<pin)//
        {
            /* code */
            pin = abs(D-ans);
            memo = i+1;
        }
        
    }
    cout << memo << endl;
    return 0;
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	if(n/10 == 9 || n%10 ==9)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

#define FOR(VAR,ST,END) for(int VAR=ST; VAR<END; ++VAR)
#define FORI(VAR,ST,END) for(int VAR=ST; VAR<=END; ++VAR)
#define ROF(VAR,ST,END) for(int VAR=ST; VAR>END; --VAR)
#define ROFI(VAR,ST,END) for(int VAR=ST; VAR>=END; --VAR)
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define MAXI(a,b) (a=(a>b?a:b))
#define MINI(a,b) (a=(a<b?a:b))
#define MINI_NZ(a,b) {if(a==0) a = b; else a = a<b?a:b;}
#define SWAP_IF(type,x,y,cond) if(cond) {type tmp=x; x=y; y=tmp;}
#define SWAP(type,x,y) {type tmp=x; x=y; y=tmp;}
#define INF 0x3f3f3f3f

using namespace std;

using Coor = pair<int, int>;

Coor coors[90001];
int D[90001];

int main()
{
    int h, w, d;
    cin >> h >> w >> d;
    int a;
    FOR(i,0,h)
        FOR(j, 0, w)
        {
            cin >> a;
            coors[a] = Coor{ i,j };
        }


    FOR(i, d + 1, 90001)
        D[i] = D[i-d] + abs(coors[i - d].first - coors[i].first) + abs(coors[i - d].second - coors[i].second);

    int q;
    cin >> q;
    FOR(i, 0, q)
    {
        int l, r;
        cin >> l >> r;

        cout << D[r] - D[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  int n;
  cin >> n;
  int cnt = 0;
  rep(i,n){
    int a, b;
    cin >> a >> b;
    if(a==b){
      ++cnt;
      if(cnt == 3){
        cout <<"Yes"<< endl;
        return 0;
      }
    }
    else cnt=0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	string str = "No";
	while (n > 0)
	{
		if (n % 10 == 7)
		{
			str = "Yes";
		}

		n /= 10;
	}

	println(str);
}

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

ll moddividing(ll x,ll y){
    vector<ll> vec(30);
    rep(i,30){
        vec[i] = y;
        y = y * y % 1000000007;
    }
    ll c = x;
    c = c * vec[0] % 1000000007;
    c = c * vec[2] % 1000000007;
    c = c * vec[9] % 1000000007;
    c = c * vec[11] % 1000000007;
    c = c * vec[14] % 1000000007;
    c = c * vec[15] % 1000000007;
    c = c * vec[17] % 1000000007;
    c = c * vec[19] % 1000000007;
    c = c * vec[20] % 1000000007;
    c = c * vec[23] % 1000000007;
    c = c * vec[24] % 1000000007;
    c = c * vec[25] % 1000000007;
    c = c * vec[27] % 1000000007;
    c = c * vec[28] % 1000000007;
    c = c * vec[29] % 1000000007;
    return c;
}

ll combination(ll n, ll r){
    vector<ll> factorial(100002);
    factorial[0] = 1;
    rep(i,100001){
        factorial[i + 1] = (factorial[i] * (i + 1)) % 1000000007;
    }
    ll x = moddividing(factorial[n], (factorial[n - r] * factorial[r]) % 1000000007);
    return x;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> C(N);
    rep(i,N) cin >> C[i];
    sort(all(C));
    vector<ll> exp2(200005);
    exp2[0] = 1;
    rep(i,200004){
        exp2[i + 1] = (exp2[i] * 2) % 1000000007;
    }
    ll ans = 0;
    for (ll i = 1; i <= N; i++){
        ll x = exp2[N - i];
        if (i == 1){
            x = (x * 1) % 1000000007;
        }
        else{
            ll y = (exp2[i - 1] + ((i - 1) * exp2[i - 2]) % 1000000007) % 1000000007;
            x = (x * y) % 1000000007;
        }
        ans = (ans + (x * C[N - i]) % 1000000007) % 1000000007;
    }
    ans = (ans * exp2[N]) % 1000000007;
    cout << ans << endl;
}

Measured memory_bytes: 6376
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int  a, b, c, count=0;
	cin >> a >> b >> c;
	for (int i = 1; i*a <= b&&i<c+1; i++) {
		count++;
	}
	cout << count;
	ed;
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  for(int i = 0; i < 26; i++){
    for(int j = 0; j < 15; j++){
      if(4 * i + 7 * j == N){
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
}

Measured memory_bytes: 256
import sys
from math import sqrt
read = sys.stdin.read

N, *xy = map(int, read().split())
x = xy[::2]; y = xy[1::2]

distance = []

for i in range(N - 1):
    for j in range(i + 1, N):
        distance.append(sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2))

print(sum(distance) / N * 2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    ll A, B, K;
    cin >> A >> B >> K;
    if(A+B >= K){
        if(A >= K) cout << A-K <<' ' <<  B << endl;
        else cout << 0 << ' ' << A+B-K << endl;
    }
    else cout << 0 << ' ' << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1000000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N;cin >> N;
    vector<ll> A(N);
    map<ll,ll> mp;
    rep(i,N){
        cin >> A[i];
        mp[A[i]] = mp[A[i]-1] + 1;
    }
    ll ans = 0;
    auto begin = mp.begin(),end = mp.end();
    for(auto itr = begin;itr != end;itr++){
        //cout << itr ->first << ' ' << itr ->second << endl;
        ans = max(itr->second,ans);
    }
    cout << N - ans << endl;
}

Measured memory_bytes: 14336
# coding: utf-8
# Your code here!

class Card:
    def __init__(self, suit, value):
        self.suit = suit
        self.value = value
        

def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0;
        for i in reversed(range(1, N)):
            if A[i-1].value > A[i].value:
                A[i-1], A[i] = A[i] , A[i-1]
                flag = 1;
    showResult(A)
    return A

def selectionSort(A, N):
    for i in range(0, N):
        minj = i
        mink = i
        for j in range(i, N):
            if A[mink].value > A[j].value:
                mink = j
        if minj != mink:
            A[minj], A[mink] = A[mink], A[minj]
    showResult(A)
    return A



def showResult(B):
    for i in range(N-1):
        print(B[i].suit+str(B[i].value), end = " ")
    print(B[N-1].suit+str(B[N-1].value))

def isStable(rawA, sortedA):
    rawDic = listToDic(rawA)
    sortedDic = listToDic(sortedA)
    flag = 1
    for key in rawDic:
        if len(rawDic[key]) >= 2:
            for i in range(len(rawDic[key])-1):
                if rawDic[key][i] != sortedDic[key][i]:
                    
                    flag = 0
    if flag:
        print("Stable")
    else:
        print("Not stable")

def listToDic(raw):
    rawDic = {}
    for i in range(len(raw)):
        if rawDic.get(raw[i].value) != None:
            rawDic[raw[i].value].append(raw[i].suit)
        else:
            rawDic[raw[i].value] = [raw[i].suit]
    return rawDic

N = int(input())
A = list(input().split()) 
B = []
for i in range(0, N):
    B.append(Card(A[i][:1], A[i][1:]))
C = tuple(B)
"""
C = []
for i in range(0, N):
    C.append(Card(A[i][:1], A[i][1:]))
D = []
for i in range(0, N):
    D.append(Card(A[i][:1], A[i][1:]))
E = []
for i in range(0, N):
    E.append(Card(A[i][:1], A[i][1:]))

F = tuple(B)
print(B)
"""

bubbleA = bubbleSort(B.copy(), N)
isStable(B.copy(), bubbleA)
selectionA = selectionSort(B.copy(), N)
isStable(B.copy(), selectionA)







Measured memory_bytes: 5632
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))



int main(){
    int N,A,B;
    string S;
    cin>>N>>A>>B;
    cin>>S;
    int AB=A+B;
    int cnt=0;
    int cnt2=0;
    vector<string>res;
    REP(i,SZ(S)){
        if(S[i]=='a'){
            if(cnt<AB){
                cnt++;
                res.PB("Yes");
            }else{
                res.PB("No");
            }
        }else if(S[i]=='b'){
            if(cnt<AB&&cnt2<B){
                cnt++;cnt2++;
                res.PB("Yes");
            }else{
                res.PB("No");
            }
        }else{
            res.PB("No");
        }
    }
    REP(i,SZ(res))cout<<res[i]<<endl;
    return 0;
}

Measured memory_bytes: 6260
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

int main(void){
	long long int n;
	while(1){
		cin >> n;
		if(n==0)break;
		long long int ans=0;
		bool ac=true;
		//long long int b=5;
		while(n>=5){
			ans+=n/5;
			n=n/5;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
const int dx[] = {1,-1,0,0,1,-1,1,-1};
const int dy[] = {0,0,1,-1,1,-1,-1,1};
const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};

int main(int argc, char const *argv[])
{

	string s;cin>>s;

	cout<<s.find_last_of('Z') - s.find_first_of('A') + 1;
}	

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  int cnt=0,cnt2=0,num=0;
  for(int i=0;i<s.size()-1;i++){
    int num2=0;
    while(i<s.size()-1&&s[i]==s[i+1]){
      i++;
      num2++;
    }
    if(i<s.size()&&s[i]=='R'&&s[i+1]=='L')	cnt++;
    num+=num2;
  }
  cnt2+=(s[0]=='L'?1:0);
  cnt2+=(s[n-1]=='R'?1:0);
  int N=num+2*min(k,cnt)+min(cnt2,max(0,k-cnt));
  cout << (N==n?N-1:N) << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

//Bitwise Kingdom
public class Main{

	int n;
	long M;
	char[] r;
	long[][] comb;

	boolean dfs(int k, long L, long R, int c){
		if(k==n){
			if(c==0&&L<=M&&M<=R)return true;
			return false;
		}
		if(!(L<=M&&M<=R))return false;
		if(n-k-1>=c){
			r[k] = '0';
			if(dfs(k+1, L, L+comb[n-k-1][c]-1, c))return true;
		}
		if(c==0)return false;
		r[k] = '1';
		long up = 0;
		if(n-k-1>=c)up += comb[n-k-1][c];
		return dfs(k+1, L+up, R, c-1);
	}

	long[][] comb(int N){
		long[][] r = new long[N+1][N+1];
		r[0][0]=1;
		for(int i=1;i<=N;i++){
			r[i][0]=r[i][i]=1;
			for(int j=1;j<i;j++){
				r[i][j] = r[i-1][j-1]+r[i-1][j];
			}
		}
		return r;
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		comb = comb(60);
		for(;;){
			n = sc.nextInt(); M = sc.nextLong();
			if((n|M)==0)break;
			long s = 0;
			int c = 0;
			for(;c<=n;c++){
				s += comb[n][c];
				if(M<=s)break;
			}
			s -= comb[n][c];
			M -= s;
			r = new char[n];
			dfs(0, 1, comb[n][c], c);
			System.out.println(new String(r));
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <stdio.h>

int main() {
	int X,Y,i;
	scanf("%d %d", &X, &Y);
	if (X * 2 <= Y && Y <= X * 4) {
		if (Y % 2 == 0) {
			printf("Yes");
		}
		else {
			printf("No");
		}
	}
	else {
		printf("No"); 
	}
	return 0;
}

Measured memory_bytes: 1688
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        
        long A = in.nextInt();
        long B = in.nextInt();
        long C = in.nextInt();
   
        long R = C - A - B;
        if (R < 0) {
            System.out.println("No");
        } else if (4 * A * B < R * R) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    l = int(input())
    print((l/3)**3)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 13768
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct node
{
	int s,x;
}a1[51000],a2[51000];
int s1[110000],s2[110000],id1=0,id2=0;
bool cmp(node x,node y)
{
	return x.s>y.s;
}
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if (i%2==1)
		{
			if (s1[x]==0) 
			{
				s1[x]=++id1; a1[s1[x]].x=x;
			}
			 a1[s1[x]].s++;
		}
		else 
		{
			if (s2[x]==0)
			{
				s2[x]=++id2; a2[s2[x]].x=x;
			}
			a2[s2[x]].s++;
		}
	}
	sort(a1+1,a1+1+id1,cmp);
	sort(a2+1,a2+1+id2,cmp);
	if (a1[1].x!=a2[1].x)
	{
		printf("%d\n",n-a1[1].s-a2[1].s);
	}
	else 
	{
		printf("%d\n",min(n-a1[1].s-a2[2].s,n-a1[2].s-a2[1].s));
	}
	return 0;
}

Measured memory_bytes: 1792
import bisect
primes = [0, 0] + [1]*999999
for i in range(2, 1001):
    if primes[i]:
        for j in range(i*i, 1000001, i):
            primes[j] = 0

primes = [i for i, v in enumerate(primes) if v]
while True:
    try:
        n = int(input())
    except:
        break
    print(len(primes[:bisect.bisect(primes, n)]))

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

#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

int main(){
    int N, M;
    cin >> N >> M;
    printl(N*M);
}


Measured memory_bytes: 3616
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;

ll mod = 1e9 + 7;

int main(){	
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ull> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	vector<int> cnt(100 , 0);
	for(int i = 0; i < n; i++){
		for(int bit = 0; bit < 60; bit++){
			if(a[i] & (1LL << bit))cnt[bit]++;
		}
	}
	
	ull ans = 0;
	ull t = 1;
	for(int bit = 0; bit < 60; bit++){
			t = pow(2 , bit);
			t %= mod;
			ans += t * ((ll)cnt[bit]*(ll)(n - cnt[bit])%mod);
			ans %= mod;
	}
	cout << ans << endl;
	return 0;
}
 


Measured memory_bytes: 5520
#include <stdio.h>
int main(void){
	int x;
	
	int i;
	for(i=0;i<10000;i++){
		scanf("%d",&x);
		if(x!=0) printf("Case %d: %d\n",i+1,x);
		else break;
		}
		return 0;
	}
	

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl

int main() {
  string s; 
  cin >> s;
  string t;
  int q; 
  cin >> q;
  while (q--) {
    int type; 
     cin >> type;
    if (type == 1) {
      swap(s, t);
    } 
    else {
      int f; char c;
       cin >> f >> c;
      if (f == 1) {
        t.push_back(c);
      } else {
        s.push_back(c);
      }
    }
  }
  
  reverse(t.begin(),t.end());
  cout << t + s << endl;
  
   }
 


Measured memory_bytes: 1248
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long m = scanner.nextInt();
        final long v = scanner.nextInt();
        final int p = scanner.nextInt();

        final List<Long> list = IntStream.range(0, n)
                .mapToObj(i -> scanner.nextLong())
                .sorted(Comparator.reverseOrder())
                .collect(Collectors.toList());

        final int answer = binarySearch(p - 1, list.size(), list, m, v, p) + 1;
        System.out.println(answer);
    }

    private static int binarySearch(final int begin, final int end, final List<Long> list, final long m, final long v, final int p) {
        if (end - begin <= 1) {
            return begin;
        }

        final int mid = (begin + end) / 2;
        if (isOk(mid, p, list, m, v)) {
            return binarySearch(mid, end, list, m, v, p);
        } else {
            return binarySearch(begin, mid, list, m, v, p);
        }
    }

    private static boolean isOk(final int index, final int p, final List<Long> list, final long m, final long v) {
        if (list.get(index) + m < list.get(p - 1)) {
            return false;
        }

        final long max = list.get(index) + m;
        final long formerSum = IntStream.range(p - 1, index)
                .mapToObj(i -> max - list.get(i))
                .mapToLong(Long::longValue)
                .sum();

        final long latterSum = (list.size() - index - 1) * m;

        return m + (p - 1) * m + formerSum + latterSum >= m * v;
    }
}


Measured memory_bytes: 65652
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;

int n;

int main()
{
	cin>>n;
	for (int i=1;i<=9;i++)
	{
		if (n%i==0&&n/i>=1&&n/i<=9) 
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int fGrade(int x)
{
if(x>=1800) return 1;
else if(x>=1600) return 2;
else if(x>=1400) return 3;
else if(x>=1200) return 4;
else if(x>=1000) return 5;
else if(x>=800) return 6;
else if(x>=600) return 7;
else return 8;
}

int main(void)
{
  int x;
  scanf("%d", &x);
  printf("%d", fGrade(x));
  return 0;
}


Measured memory_bytes: 1724
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;
// static const int NMAX = 5005;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// typedef priority_queue<int, greater<int>> RevQ;
ll l, r;
// vector<ll> a(MAX);

mint dp[61][2][2][2];


int main(){
  cin >> l >> r ;
  dp[60][0][0][0] = 1;
  for (int i = 59; i >= 0 ; --i) {
    int lb = (l >> i & 1);
    int rb = (r >> i & 1);
    rep(j,2)rep(k,2)rep(s,2) {
      mint pre = dp[i+1][j][k][s];
      rep(x, 2) rep(y, 2) {
        int ns = s, nj = j, nk = k;
        if (x && !y) continue; // x = 1 && y = 0
        if (x && y) { // x = y = 1 => ns =1
          ns = 1; // s setting
        }
        if (!lb && x) nj = 1; // x > L
        if (rb && !y) nk = 1; // y < R
        if (!s && !x && y) continue; // top like x = 0, y = 1
        if (!j && !x && lb) continue; // it turns out that x < L
        if (!k && y && !rb) continue; // it turns out that y > R
        dp[i][nj][nk][ns] += pre;
      }
    }
  }
  mint ans;
  rep(j,2)rep(k,2)rep(s,2) ans += dp[0][j][k][s];
  cout << ans.x << endl;
}


/* standard input
19
strangexyxxorangexx

*/


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

int main(){
  int N; cin>>N;
  vector<bool> p(N+1);
  for(int i=0;i<N;i++){
    int a; cin>>a;
    a--;
    if(a == i) p[i] = true;
  }
  int ans = 0;
  for(int i=0;i<N;i++){
    if(p[i]){
      ans++;
      p[i+1] = false;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

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

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

vector<int> cum(char c, string& s) {
    int n = s.size();
    vector<int> res(n + 1);
    rep(i, 1, n + 1) {
        res[i] = res[i - 1] + (s[i - 1] == c);
    }
    return res;
}

signed main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<P> ab;
    rep(i, 0, N) rep(j, i + 1, N) {
        if (S[i] != S[j]) {
            ab.push_back(P(i, j));
        }
    }
    const auto R = cum('R', S);
    const auto G = cum('G', S);
    const auto B = cum('B', S);
    i64 ans = 0;
    for (const auto& p : ab) {
        auto i = p.first;
        auto j = p.second;
        i64 tmp = 0;
        if ((S[i] == 'R' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'R')) {
            tmp += B[N] - B[j];
        } else if ((S[i] == 'R' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'R')) {
            tmp += G[N] - G[j];
        } else if ((S[i] == 'G' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'G')) {
            tmp += R[N] - R[j];
        }
        auto k = j + (j - i);
        if (k < N && S[k] != S[i] && S[k] != S[j]) tmp--;
        ans += tmp;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 68932
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 105,Wmax = 1e5+5;
int dp[Wmax];
int W[N],v[N];

signed main(){
	IOS
	int n,w;	cin >> n >> w;
	rep(i,n)	cin >> W[i] >> v[i];
	rep(i,n){
		for(int j = w;j > 0; j--){
			if(j >= W[i])	dp[j] = max(dp[j],dp[j-W[i]] + v[i]);
		}
	}
	cout << dp[w] << endl;
}


Measured memory_bytes: 1024
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var h, w, k int
	fmt.Fscan(r, &h)
	fmt.Fscan(r, &w)
	fmt.Fscan(r, &k)

	grid := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Fscan(r, &grid[i])
	}

	ans := math.MaxInt64

	// 水平方向の切り方を網羅する（h <= 10）
	for div := 0; div < (1 << uint(h-1)); div++ {
		// 水平方向に分割されるグループ数
		g := 0
		id := make([]int, h)

		for i := 0; i < h; i++ {
			id[i] = g
			if div>>uint(i)&1 == 1 {
				// 水平方向に分割する場合はグループを加算
				g++
			}
		}
		g++

		// グループ化されたグリッドの状態を一次元に変換
		c := make([][]int, g)
		for i := 0; i < g; i++ {
			c[i] = make([]int, w)
		}
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				c[id[i]][j] += int(grid[i][j] - '0')
			}
		}

		num := g - 1
		now := make([]int, g)
		add := func(j int) bool {
			// WCの個数がK個を超えるグループがある場合はfalse
			for i := 0; i < g; i++ {
				now[i] += c[i][j]
			}
			flg := true
			for i := 0; i < g; i++ {
				if now[i] > k {
					flg = false
					break
				}
			}
			return flg
		}

		for j := 0; j < w; j++ {
			if !add(j) {
				num++
				now = make([]int, g)

				if !add(j) {
					// これ以上垂直方向での分割はできない
					num = math.MaxInt64
					break
				}
			}
		}

		ans = min(ans, num)
	}

	fmt.Println(ans)
}

// Utility

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

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

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

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}


Measured memory_bytes: 6528
N = int(input())
C = input()

cnt_r = 0
for c in C:
  if c == "R":
    cnt_r += 1

cnt_r_in_lefternmost_cnt_r = 0
for c in C[:(cnt_r)]:
  if c == "R":
    cnt_r_in_lefternmost_cnt_r += 1

print(cnt_r - cnt_r_in_lefternmost_cnt_r)

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

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

const int MOD = (int) 1e9 + 7;
const int MAXN = (int) 1e5;

// Template-Libs

namespace MATH
{
	int inv[MAXN + 5];

	inline void init()
	{
		inv[1] = 1;
		for(int i = 2; i <= MAXN; ++i) inv[i] = (LL) MOD / i * -inv[MOD % i] % MOD;
	}
}

using MATH::inv;

// END

int n;

int a[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) a[i] = read<int>();
}

inline void solve()
{
	static int prefix[MAXN + 5];
	prefix[0] = 0;
	for(int i = 1; i <= n; ++i) prefix[i] = (prefix[i - 1] + inv[i]) % MOD;

	int ans = 0;
	for(int i = 1; i <= n; ++i) (ans += (LL) (prefix[i] + prefix[n - i + 1] - 1) % MOD * a[i] % MOD) %= MOD;
	for(int i = 1; i <= n; ++i) ans = (LL) ans * i % MOD;
	printf("%d\n", (ans + MOD) % MOD);
}

int main()
{
	MATH::init();
	input();
	solve();

	return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int maxn = 42;
const int maxs = 1 << 17;
const int mod = 1e9 + 7;
int dp[maxn][maxs];
int main()
{
    ios::sync_with_stdio(false);
    int n , x , y , z; cin >> n >> x >> y >> z;
    int no = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));
    int S = 1 << (x + y + z);
    dp[0][0] = 1;
    for (int i = 1 ; i <= n ; i++){
        for (int j = 0 ; j < S ; j++){
            if (dp[i - 1][j] == 0) continue;
            for (int k = 1 ; k <= 10 ; k++){
                int v = (j << k) | (1 << (k - 1));
                v &= (S - 1);
                if ((v & no) == no) continue;
                dp[i][v] = (dp[i][v] + dp[i - 1][j]) % mod;
            }
        }
    }
    int ans = 0;
    for (int i = 0 ; i < S ; i++) ans = (ans + dp[n][i]) % mod;
    int all = 1;
    for (int i = 1 ; i <= n ; i++) all = (all * 10ll % mod);
    cout << (all - ans + mod) % mod << endl;
    return 0;
}


Measured memory_bytes: 22268
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (long long i = l; i < r; i++)
using namespace std;
typedef pair<int, int> P;

struct edge {
    int to, cost;
};

class dijkstra {
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<P>> que;

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first) continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    int find(int e) {
        return d[e];
    }
};

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

bool prime(int a) {
    if (a == 1) return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0) return false;
    }
    return true;
}

class Union_Find {
private:
    vector<int> t, s;

public:
    Union_Find(int max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(int x, int y) {
        if (same(x, y)) return;
        int tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        } else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        } else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        } else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }

    int Find(int n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

    bool same(int x, int y) {
        return Find(x) == Find(y);
    }

    int get_Size(int a) {
        return s[a];
    }
};

vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}
signed main() {
    int n,k;
    cin>>n>>k;
    if(k==1)cout<<0<<endl;
    else cout<<(n-k)<<endl;
}


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

int main()
{
	int H, R;

	cin >> H >> R;

	if (H + R > 0)
	{
		cout << 1 << endl;
	}
	else if (H + R == 0)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int e[12];
    for (int i=0; i<12; i++) {
        cin>>e[i];
    }
    sort(e, e+12);
    
    if(e[0]==e[3]&&e[4]==e[7]&&e[8]==e[11]){
        cout<<"yes"<<endl;
    }else{
        cout<<"no"<<endl;
    }
    return 0;
}

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

#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    CIN3(a,b,c) 
    cout << (a*b)/2 << endl;
}

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

int main() {
  string s;
  cin >> s;
  
  int ans = 0;
  int count = 0;
  
  for(int i=0; i<s.size(); i++) {
    if(s.at(i) == 'A' ||
       s.at(i) == 'T' ||
       s.at(i) == 'G' ||
       s.at(i) == 'C') {
      count++;
    }
    else {
      if(ans < count)
        ans = count;
      count = 0;
    }
  }
  
  if(ans < count)
    ans = count;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char S[1010], res[1010];
int N, W;
int main(){
  int i, k=0;
  N = rd(S);
  rd(W);
  for(i=0;i<N;i+=W){
    res[k++] = S[i];
  }
  res[k++] = '\n';
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20180707-1 [beta]

// --- original code ---
// char S[1010]; int N, W;
// char res[1010];
// {
//   int i, k = 0;
//   rd(S@N,W);
//   for(i=0;i<N;i+=W) res[k++] = S[i];
//   res[k++] = '\n';
//   wt(res);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long A, B;
  cin >> A >> B;
  cout << A / __gcd(A, B) * B << '\n';
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <map>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int isPrime[1000001];
int main()
{
  vector<int>prime;
  fill(isPrime,isPrime + 1000001,1);
  isPrime[0] = isPrime[1] = 0;
  for(int i = 2 ; i*i < 1000001 ; i++ )
    {
      if(isPrime[i]){
	for(int j = i*2 ; j < 1000001 ; j+=i )isPrime[j] = 0;
      }
    }
  for(int i = 0 ; i < 1000001 ; i++ )if(isPrime[i])prime.push_back(i);
  int n;
  while(cin >> n,n)
    {
      cout << upper_bound(prime.begin(),prime.end(),2*n)-lower_bound(prime.begin(),prime.end(),n+1) << endl;
    }
  return 0;
}

Measured memory_bytes: 5492
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }

    int res = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] == i + 1) {
            res++;
            i++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;

int main()
{
	int i=0;
	string str;

	getline(cin,str);

	for(i=0;i<str.size();i++)
	{
		if(isupper(str[i])==0)
		{
			str[i] = toupper(str[i]);
			cout << str[i] ;
			continue;
		}

		else
		{
			str[i] = tolower(str[i]);
			cout << str[i] ;
		}
	} 

	cout << endl;

	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
using namespace std;
int main()
{
    int x,n;
    cin >> n;
    x=((n%100)%10);
    if(x==2 || x==4 || x==5 || x==7 || x==9)
    {
        cout << "hon" << endl;
    }
    else if(x==0 || x==1 || x==6 || x==8)
    {
    cout << "pon" << endl;
    }
    else if(x==3){
        cout << "bon" << endl;
    }



}


Measured memory_bytes: 3632
n = 4
input_list = []
for i in range(4):
    input_list.append(int(input()))

N = input_list[0]
K = input_list[1]
X = input_list[2]
Y = input_list[3]

if N > K :
    result = K * X + (N-K) * Y
else:
    result = N * X

print ( result )

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e2 + 5, M = 3e5 + 5;

char s[N];

int main(){
    scanf("%s", &s);
    int n = strlen(s);
    for(int i = 0 ; i < n ; ++i){
        if(i & 1){
            if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
                cout << "No" << endl;
                return 0;
            }
        }
        else{
            if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;

int main() {
	
  int n; cin >> n;
  int p; cin >> p;
  
  int ans_x = -1;
  int ans_y = -1;
  int ans_z = -1;
  for(int i=0; i<=n; i++){
    for(int j=0; j<=n; j++){
      int x = i;
      int y = j;
      int z = n-x-y;
      
      if (z >= 0 && (x+y+z == n && (x*10000 + y*5000 + z*1000) == p)) {
        ans_x = x;
        ans_y = y;
        ans_z = z;
        break;
      }
    }
   
  }
  cout << ans_x << ' ' << ans_y << ' ' << ans_z;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, W;
  cin >> N >> W;
  vector<int> v(N), w(N);
  for (int i = 0; i < N; i++){
    cin >> v[i] >> w[i];
  }
  vector<vector<int>> dp(N + 1, vector<int>(W + 1, 0));
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= W; j++){
      dp[i + 1][j] = dp[i][j];
      if (j >= w[i]){
        dp[i + 1][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
      }
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 6788
#include <cstdio>

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
  size_t k;
  scanf("%zu", &k);
  --k;
  printf("%d\n", a[k]);
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
	static final long MOD = 1000000007;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int K = sc.nextInt();
		List<Long> pos = new ArrayList<>(), neg = new ArrayList<>();
		int zeroes = 0;
		for (int i = 0; i < N; i++) {
			long tmp = sc.nextLong();
			if (tmp > 0) pos.add(tmp);
			else if (tmp == 0) zeroes++;
			else neg.add(-tmp);
		}
		Collections.sort(pos);
		Collections.sort(neg);
		boolean canPos = 2 * (neg.size() / 2) + pos.size() >= K && (pos.size() >= 1 || K % 2 == 0);
		long ans;
		if (canPos) {
			ans = 1;
			int p = pos.size() - 1, n = neg.size() - 1;
			if (K%2 == 1) {
				ans *= pos.get(p);
				ans %= MOD;
				p--;
				K--;
			}
			while (K > 0) {
				long tmpP = p >= 1 ? pos.get(p) * pos.get(p - 1) : -1;
				long tmpN = n >= 1 ? neg.get(n) * neg.get(n - 1) : -1;
				if (tmpP > tmpN) {
					ans *= pos.get(p);
					ans %= MOD;
					p--;
					ans *= pos.get(p);
					ans %= MOD;
					p--;
				} else {
					ans *= neg.get(n);
					ans %= MOD;
					n--;
					ans *= neg.get(n);
					ans %= MOD;
					n--;
				}
				K-=2;
			}
		} else if (zeroes > 0) {
			ans = 0;
		} else {
			ans = 1;
			int p = 0, n = 0;
			while (K > 0) {
				if (n >= neg.size() || p < pos.size() && pos.get(p) < neg.get(n)) {
					ans *= pos.get(p);
					ans %= MOD;
					p++;
				} else {
					ans *= neg.get(n);
					ans %= MOD;
					n++;
				}
				K--;
			}
			ans = MOD-ans;
			ans %= MOD;
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 61628