akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

ll a[2200000];
int main(){
    ll n,k,ans=0;
    cin>>n;
    if(n==0)cout<<1;
    else cout<<0;
}



Measured memory_bytes: 3632
if (_dice_a = gets.split.map(&:to_i)) == (_dice_b = gets.split.map(&:to_i))
  puts "Yes"
  exit
elsif _dice_a.uniq.size == 2
  puts "Yes"
  exit
end

def vertical_roll(new_dice, upper_value)
  count = 0
  while new_dice[0] != upper_value && count < 4
    new_dice[0], new_dice[1], new_dice[4], new_dice[5] = new_dice[1], new_dice[5], new_dice[0], new_dice[4]
  end
  new_dice
end

def horizontal_roll(new_dice, front_value)
  count = 0
  while new_dice[1] != front_value && count < 4
    new_dice[1], new_dice[2], new_dice[4], new_dice[3] = new_dice[2], new_dice[4], new_dice[3], new_dice[1]
    count += 1
  end
  new_dice
end

_dice_b_idx = _dice_b.index(_dice_a[0])

case _dice_b_idx
when 0, 1, 5, 4
  vertical_roll(_dice_b, _dice_a[0])
  horizontal_roll(_dice_b, _dice_a[1])
else
  horizontal_roll(_dice_b, _dice_a[0])
  vertical_roll(_dice_b, _dice_a[0])
  horizontal_roll(_dice_b, _dice_a[1])
end

puts _dice_a == _dice_b ? "Yes" : "No"


Measured memory_bytes: 6880
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

const int N = 2e5 + 5;

int cntW[N];
int cntB[N];

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

    cntW[0] = cntB[0] = 0;
    for (int i = 0; i < n; ++i)
    {
        cntW[i + 1] = cntW[i] + (s[i] == '.');
        cntB[i + 1] = cntB[i] + (s[i] == '#');
    }

    int ans = 1e9;
    for (int i = 0; i <= n; ++i)
        ans = min(ans, cntB[i] + cntW[n] - cntW[i]);

    printf("%d", ans);
}


Measured memory_bytes: 2180
import sys
sys.setrecursionlimit(10000)

def count(ans, c, i, l, k):
    if(i == 0):
        if(ans[0] > c + l):
            ans[0] = c + l
        return

    for j in range(l // k[i], -1, -1):
        c += j
        l -= k[i] * j
        i -= 1
        count(ans, c, i, l, k)
        i += 1
        l += k[i] * j
        c -= j
        if(ans[0] <= c + l // k[i]): return

n = int(input())

k = [1]
a = 1
b = 1
while(k[len(k)-1] <= n):
    if(6 ** a < 9 ** b):
        k.append(6 ** a)
        a += 1
    elif(6 ** a > 9 ** b):
        k.append(9 ** b)
        b += 1
    else:
        k.append(6 ** a)
        a += 1
        b += 1

ans = [1000000]
count(ans, 0, len(k)-1, n, k)

print(ans[0])

Measured memory_bytes: 3188
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
// }}}

const int MAX_N = 200005;
int n, A[MAX_N], F[MAX_N];
LL K, AF[MAX_N];
void input() {
    RI(n);
    scanf("%lld", &K);
    REP(i, n) RI(A[i]);
    REP(i, n) RI(F[i]);
}

bool C(LL x) {
	LL cnt = 0;
	for(int i = 0; i < n; i++) {
		if(AF[i] > x) {
			cnt += A[i] - x/F[n-1-i]; 
		}
	}
	return cnt > K;
}

void solve() {
	sort(A, A+n);
	sort(F, F+n);

	REP(i, n) {
		AF[i] = 1LL*A[i]*F[n-i-1];
	}

	LL lb = -1, ub = 1e18;
	while(ub - lb > 1) {
		LL mid = (ub + lb) / 2;
		if(C(mid)) {
			lb = mid;
		} else {
			ub = mid;
		}
	}

	printf("%lld\n", ub);
}

int main( int argc, char *argv[] ) {
	input();
	solve();
    return 0;
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int K; cin >> K;
    int X; cin >> X;
    if(500*K>=X){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

const int64_t MOD = 1'000'000'007L;

int64_t dpow(int64_t x, int64_t y)
{
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return dpow(x * x % MOD, y / 2);
    } else {
        return x * dpow(x, y - 1) % MOD;
    }
}

int64_t inv(int64_t x)
{
    return dpow(x, MOD - 2);
}

uint64_t perm(uint64_t n, uint64_t k)
{
    uint64_t r = 1;
    for (uint64_t i = 0; i < k; i++) {
        r *= (n - i);
        r %= MOD;
    }
    return r;
}

int main()
{
    int n;
    cin >> n;
    vector<int64_t> x(n);
    rep(i, n)
    {
        cin >> x[i];
    }

    int64_t result = 0;
    rep(i, n - 1)
    {
        result += (x[n - 1] - x[i]) * inv(i + 1) % MOD;
        result %= MOD;
    }
    cout << result * perm(n - 1, n - 1) % MOD << endl;

    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main(){
	int a,b,c;
	int x = 0;
	scanf("%d%d%d",&a,&b,&c);
	for(int i = a;i <= b;i++){
		if(c % i == 0){
			x = x + 1;
		}
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 2716
c = [list(map(int, input().split())) for _ in range(3)]

ans = "Yes"
for i in range(1, 3):
  if c[i][0] - c[0][0] != c[i][1] - c[0][1] or c[i][1] - c[0][1] != c[i][2] - c[0][2]:
    ans = "No"
print(ans)

Measured memory_bytes: 3064
unsigned short C[331][1024];F(n,s,U){int i,c=C[s][U];if(c==65535&&(c=s==0,n))for(c=0,i=10;i--;)U&1<<i||n*i>s||(c+=F(n-1,s-n*i,U|1<<i));return C[s][U]=c;}n;main(s){for(;~scanf("%d%d",&n,&s);printf("%d\n",s<331?F(n,s,0):0))memset(C,-1,677888);}

Measured memory_bytes: 1076
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<P,P> Q;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 45, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
typedef v(string) vs;

int a[MX][MX];
int f(int si, int sj, int ti, int tj) {
  int res = a[ti][tj];
  res += a[si][sj];
  res -= a[ti][sj];
  res -= a[si][tj];
  return res;
}

int dp[MX][MX][MX][MX];

int main() {
  int h,w;
  scanf("%d%d",&h,&w);
  vs s(h);
  cin>>s;
  rep(i,h)rep(j,w) a[i+1][j+1] = s[i][j] == '#';
  rep(i,h+1)rep(j,w+1) a[i][j+1] += a[i][j];
  rep(i,h+1)rep(j,w+1) a[i+1][j] += a[i][j];
  int pi = 0, pj = 0;
  rep(i,h)rep(j,w) if (s[i][j] == 'P') pi = i, pj = j;

  rep(si,h+1)rep(sj,w+1)rep(ti,h+1)rep(tj,w+1) dp[si][sj][ti][tj] = INF;
  dp[0][0][h][w] = 0;
  int ans = INF;
  rep(si,h)rep(sj,w)drep(ti,h+1)drep(tj,w+1) {
    if (si >= ti) break;
    if (sj >= tj) break;
    int now = dp[si][sj][ti][tj];
    srep(i,si,ti)srep(j,sj,tj) {
      mins(dp[si][sj][i][j], now+f(i,sj,ti,j)+f(si,j,i,tj));
      mins(dp[i][j][ti][tj], now+f(i,sj,ti,j)+f(si,j,i,tj));
      mins(dp[si][j][i][tj], now+f(si,sj,i,j)+f(i,j,ti,tj));
      mins(dp[i][sj][ti][j], now+f(si,sj,i,j)+f(i,j,ti,tj));
    }
    if (si <= pi && pi < ti && sj <= pj && pj < tj) {
      mins(ans, now+f(si,sj,pi+1,pj+1));
      mins(ans, now+f(si,pj,pi+1,tj));
      mins(ans, now+f(pi,sj,ti,pj+1));
      mins(ans, now+f(pi,pj,ti,tj));
    }
  }
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 14848
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+5;
const int M=1e4+5;
const int INF=0x3f3f3f3f;
int a[N],b[N],f[M<<1];
int main() {
	int h,n;
	scanf("%d%d",&h,&n);
	for(int i=0;i<n;i++) {
		scanf("%d%d",&a[i],&b[i]);
	}
	memset(f,INF,sizeof f);
	f[0]=0;
	for(int i=0;i<n;i++) {
		for(int j=a[i];j<=h+M;j++) {
			f[j]=min(f[j],f[j-a[i]]+b[i]);
		}
	}
	int ans=INF;
	for(int i=h;i<=h+M;i++) {
		ans=min(ans,f[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
//B
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
	return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
	stringstream ss;
	ss << x;
	return ss.str();
}
//string to ll
ll toNumber(string S) {
	ll ret; 
	sscanf(S.c_str(),"%lld",&ret); 
	return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

int main(){
	int n,k,a, res=0;
	scanf("%d %d",&n,&k);
	while(n--)scanf("%d",&a),res+=min(a,k-a);
	printf("%d\n",res<<1);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	int h, w, i;
	scanf("%d%d", &h, &w);
	if (!h && !w) {
		return 0;
	}
	char odd[w + 1], even[w + 1];
	for (i = 0; i < w + 1; i++) {
		odd[i] = i % 2 ? '.' : '#';
		even[i] = i % 2 ? '#' : '.';
	}
	odd[w] = even[w] = 0;
	for (i = 0; i < h; i++) {
		puts(i % 2 ? even : odd);
	}
	puts("");
	return main();
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N,K;
  cin>>N>>K;
  cout<<N-K+1<<endl;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

double P[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    REP(i, N) {
        cin >> P[i];
    }

    double sum = 0;
    REP(i, K) {
        sum += (P[i] * (P[i] + 1) / 2) / P[i];
    }
    double ans = sum;
    FOR(i, N, K) {
        sum += (P[i] * (P[i] + 1) / 2) / P[i];
        sum -= (P[i - K] * (P[i - K] + 1) / 2) / P[i - K];
        ans = std::max(ans, sum);
    }
    cout << OF64 << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
int main() 
{ 
	SPEED
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; ++i)
    {
    	cin >> arr[i];
    }
    multiset<int> last; 
    for (int i = 0; i < n; i++) { 
        multiset<int>::iterator it = last.lower_bound(arr[i]); 
        if (it == last.begin()) 
            last.insert(arr[i]); 
  
        else { 
            it--; 
            last.erase(it);
            last.insert(arr[i]); 
        } 
    } 
    cout << last.size() << '\n';
    return 0;      
} 

Measured memory_bytes: 5376
var
  x1,x2,y1,y2,a,b:longint;
begin
  read(x1,y1,x2,y2);
  a:=abs(x1-x2);b:=abs(y1-y2);
  if (x1<=x2)and(y1>=y2) then
    write(x2+b,' ',y2+a,' ',x2+b-a,' ',y2+a+b) else
  if (x1<=x2)and(y1<=y2) then
   write(x2-b,' ',y2+a,' ',x2-b-a,' ',y2+a-b) else
  if (x1>=x2)and(y1<=y2) then
    write(x2-b,' ',y2-a,' ',x2-b+a,' ',y2-a-b) else
  write(x2+b,' ',y2-a,' ',x2+a+b,' ',y2-a+b);
end.

Measured memory_bytes: 128
N = int(input())
A = map(int, input().split())
B = [3 if i == 0 else 0 for i in range(N + 1)]
MOD = 1000000007
ans = 1
for a in A:
    ans = ans * B[a] % MOD
    if ans == 0:
        break
    else:
        B[a] -= 1
        B[a + 1] += 1
print(ans)


Measured memory_bytes: 17412
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<String>();

    let ans = n
        .chars()
        .map(|c| if c == '1' { '9' } else { '1' })
        .collect::<String>();
    println!("{}", ans);
}


Measured memory_bytes: 4352
unittest
{
	assert( [ "3", "4 7", "2 9", "6 2" ].parse.expand.solve == 8 );
	assert( [ "5", "1 10", "3 6", "5 2", "4 4", "2 8" ].parse.expand.solve == 7 );
	assert( [ "2", "1 1000000000", "1000000000 1" ].parse.expand.solve == 1000000001 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto abs = new long[ 2 ][ n ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
	}
	return tuple( abs );
}

auto solve( long[ 2 ][] abs )
{
	abs.sort!( ( x, y ) => y[ 0 ] < x[ 0 ] );
	return abs.front[ 0 ] + abs.front[ 1 ];
}


Measured memory_bytes: 4860
N, K = gets.split(' ')
n = N.to_i
k = K.to_i

h = []
n.times do
    h << gets.chomp.to_i
end

h = h.sort_by{|x| x}

min = 1000000000
(n-k+1).times do |i|
    tmp = h[i+k-1] - h[i]
    if tmp < min then
        min = tmp
    end
end

print min

Measured memory_bytes: 6136
out_put = []

n,m=map(int,input().split())
n_m = [[0 for i in range(m)] for j in range(n)]

for n_s in range(n):
    n_m[n_s]=list(map(int,input().split()))

b =[]

for _ in range(m):
    b.append(int(input()))

#print(list(n_m))
#print(list(b))

for n_s in n_m:
    out_put_plus =0
    for m_s, b_s in zip(n_s,range(m)):
        #print(m_s,end="×")
        #print(b[b_s])
        out_put_plus+= m_s * b[b_s]
    out_put.append(out_put_plus)
    
for out_put_no in out_put:
    print(out_put_no)


Measured memory_bytes: 6032
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define rad M_PI/3
#define N 200001
#define Max 10000
#define NTL -1

int m,n,point=0;
int Pre[41],In[41],af[41];
int seach(int p){
    for(int i=0;i<n;i++){
        if(p==In[i]) return i;
    }
    return 0;
}
void visit(int l,int r){
    int p,q;
    if(l>=r) return;
    p=Pre[point++];
    q=seach(p);
    visit(l,q);
    visit(q+1,r);
    af[m++]=p;
}
int main()
{
    int i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&Pre[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d",&In[i]);
    }
    visit(0,n);
    for(i=0;i<n-1;i++){
        printf("%d ",af[i]);
    }
    printf("%d\n",af[i]);
    return 0;
}


Measured memory_bytes: 2100
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int D = scan.nextInt();

    int kanshi = 2 * D + 1;

    if (N <= kanshi) {
      System.out.println(1);
      return;
    }

    int count = 0;

    while (true) {
      count++;
      N -= kanshi;
      if (N <= 0) {
        System.out.println(count);
        return;
      }
    }
  }

}


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

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

	long long int sum = 0;
	for (long long int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3596
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let h: usize = itr.next().unwrap().parse().unwrap();
    let w: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<Vec<usize>> = vec![vec![0; w]; h];
    for i in 0..h {
        for j in 0..w {
            a[i][j] = itr.next().unwrap().parse().unwrap();
        }
    }

    let mut ans: Vec<(usize, usize, usize, usize)> = Vec::new();

    for i in 0..h {
        if i % 2 == 0 {
            for j in 0..w - 1 {
                if a[i][j] % 2 == 1 {
                    ans.push((i, j, i, j + 1));
                    a[i][j + 1] += 1;
                }
            }
            if i != h - 1 && a[i][w - 1] % 2 == 1 {
                ans.push((i, w - 1, i + 1, w - 1));
                a[i + 1][w - 1] += 1;
            }
        } else {
            for j in (1..w).rev() {
                if a[i][j] % 2 == 1 {
                    ans.push((i, j, i, j - 1));
                    a[i][j - 1] += 1;
                }
            }
            if i != h - 1 && a[i][0] % 2 == 1 {
                ans.push((i, 0, i + 1, 0));
                a[i + 1][0] += 1;
            }
        }
    }
    println!("{}", ans.len());
    for i in 0..ans.len() {
        println!(
            "{} {} {} {}",
            ans[i].0 + 1,
            ans[i].1 + 1,
            ans[i].2 + 1,
            ans[i].3 + 1
        );
    }
}


Measured memory_bytes: 13432
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n, t; scanf("%d%d", &n, &t);
	int a[n];
	rep(i, n) scanf("%d", &a[i]);
	
	int mi = a[0];
	int ma = 0;
	int ans = 0;
	rep(i, n-1){
		int dif = a[i+1] - mi;
		if(ma < dif){
			ma = dif;
			ans = 1;
		}else if(ma == dif){
			ans++;
		}
		
		mi = min(mi, a[i+1]);
	}
	
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
n = int(input())
length = len(str(n))

res = 0
if length == 1:
    print(n)
elif length == 2:
    print(9)
elif length == 3:
    print(9 + n - 99)
elif length == 4:
    print(900 + 9)
elif length == 5:
    print(9 + 900 + n - 9999)
else:
    print(9 + 900 + 90000)

Measured memory_bytes: 38512
#include<iostream> 
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=5010, inf=1e9+233;
struct edge{int too, pre;}e[maxn<<1];
int n, x, y, tot;
ll f[maxn][maxn][2], g[maxn][2];
int last[maxn], size[maxn], a[maxn];

template<typename T>
inline void read(T &k)
{
    int f=1; k=0; char c=getchar();
    while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
    while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
    k*=f;
}

inline void add(int x, int y) {e[++tot]=(edge){y, last[x]}; last[x]=tot;}

void dfs(int x, int fa)
{
    size[x]=1;

    if(a[x]>0) f[x][0][0]=a[x];
    else f[x][0][1]=a[x];

    for(int i=last[x], too;i;i=e[i].pre)
        if((too=e[i].too)!=fa)
        {
            dfs(too, x);
            memset(g, 0x3f, sizeof(g));
            for(int j=0;j<size[x];j++)
            {
                for(int k=0;k<=size[too];k++)
                {
                    if(a[x]>0)
                    {
                        g[j+k][0]=min(g[j+k][0], f[x][j][0]+f[too][k][0]);
                        g[j+k][1]=min(g[j+k][1], f[x][j][1]+min(f[too][k][0], f[too][k][1]));
                        g[j+k][1]=min(g[j+k][1], min(f[x][j][0], f[x][j][1])+f[too][k][1]);
                        // if(x==2) printf("x:%d too:%d j:%d k:%d f[too][k][1]:%lld g:%lld\n", x, too, j, k, f[too][k][1], g[j+k][1]);
                    }
                    else g[j+k][1]=min(g[j+k][1], f[x][j][1]+min(f[too][k][1], f[too][k][0]));
                }
            }
            memcpy(f[x], g, sizeof(g));
            size[x]+=size[too];
        }

    for(int i=0;i<size[x];i++) if(f[x][i][1]<0) f[x][i+1][0]=min(f[x][i+1][0], 0ll);//, printf("x:%d qaq\n", x);
    for(int i=0;i<size[x];i++) if(f[x][i][0]<=(ll)(1e13)) f[x][i+1][0]=min(f[x][i+1][0], 0ll);//, printf("x:%d qwq\n", x);
}

int main()
{
    read(n);
    for(int i=1;i<=n;i++) read(a[i]);
    for(int i=1;i<n;i++)
        read(x), read(y), add(x, y), add(y, x);

    memset(f, 0x3f, sizeof(f));
    dfs(1, 0);

    for(int i=0;i<n;i++)
        if(f[1][i][0]<=(ll)(1e13) || f[1][i][1]<0) return printf("%d\n", i), 0;
}


Measured memory_bytes: 393088
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,r,s1,r1,s2,r2;
    int d,d1,d2;
    cin>>r;
    int n=r.size();
    s=r;
    reverse(r.begin(),r.end());
    d=s.compare(r);
    s1=s.substr(0,(n-1)/2);
    r1=s1;
    reverse(r1.begin(),r1.end());
    d1=s1.compare(r1);
    s2=r.substr(0,((n+2)/2 )-1);
    r2=s2;
    reverse(r2.begin(),r2.end());
    d2=s2.compare(r2);
    if(d1!=0||d!=0||d2!=0)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b)-1; i>=(a); i--)
#define debug(x) cout << #x << " => " << x << endl
using namespace std;
const int MAX_N = 7 + 300000;
const int MOD = 1e9 + 7;
///----------------------------------------------
int qpow(int a,int b) {
    int ret=1;
    for (; b; b>>=1) {
        if (b&1) ret=1ll*ret*a%MOD;
        a=1ll*a*a%MOD;
    }
    return ret;
}
///----------------------------------------------
int jc[MAX_N*3],jcr[MAX_N*3];
int C(int n,int m) {
    return 1ll*jc[n]*jcr[m]%MOD*jcr[n-m]%MOD;
}
///----------------------------------------------
int fb[MAX_N*3],fc[MAX_N*3];
int main() {

    ///read
    int n1,n2,n3; cin>>n1>>n2>>n3;
    int n=n1+n2+n3;

    ///prework
    jc[0]=1; rep(i,1,n+1) jc[i]=1ll*jc[i-1]*i%MOD;
    rep(i,0,n+1) jcr[i]=qpow(jc[i],MOD-2);
    rep(i,n2+1,n+1) fb[i]=(fb[i-1]+(fb[i-1]+C(i-1,n2))%MOD)%MOD;
    rep(i,n3+1,n+1) fc[i]=(fc[i-1]+(fc[i-1]+C(i-1,n3))%MOD)%MOD;

    ///work
    int ans=0;
    rep(i,n1,n+1) {
        int tmp=((qpow(2,i-n1)+MOD-fb[i-n1])%MOD+MOD-fc[i-n1])%MOD;
        tmp=1ll*tmp*qpow(3,n-i)%MOD;
        ans=(ans+1ll*tmp*C(i-1,n1-1)%MOD)%MOD;
    }
    cout << ans;

}



Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int x; cin >> x;
	for (int i = -1000; i <= 1000; i ++) {
		for (int j = -1000; j <= 1000; j ++) {
			if (pow(i, 5) - pow(j, 5) == x) {
				cout << i << ' ' << j << '\n';
				return 0;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>//头文件
using namespace std;
short a,b;//作死short
int c[14]={-1,12,0,1,2,3,4,5,6,7,8,9,10,11};//赋权
string d;//答案
int main(){
    cin>>a>>b;
    d=(c[a]<c[b])?"Bob":"Alice";//问号运算符
    if(a==b)d="Draw";//唯一的if
    cout<<d<<endl;
    return 0;//完美结束
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    string T;
    cin >> T;

    rep(i, 0, T.size())
        if (T[i] == '?') T[i] = 'D';

    cout << T << endl;
    return 0;
}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repk(i,k, n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500001
#define MOD 1000000007
typedef long long  ll;
 
using namespace std;
 
 
int max;
int cnt[MAX];
 
int main() {
	int A, B;
	cin >> A >> B;
 
	int ans = 0;
 
	if (A == 1) {
		if (B == 2) {
			cout << 3 << endl;
		}
		else if (B == 3) {
			cout << 2 << endl;
		}
	}
	else if (A == 2) {
		if (B == 1) {
			cout << 3 << endl;
		}
		else if (B == 3) {
			cout << 1 << endl;
		}
	}
	else if (A == 3) {
		if (B == 1) {
			cout << 2 << endl;
		}
		else if (B == 2) {
			cout << 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 384
import collections

n = int(input())
a = list(map(int,input().split()))
b,c = [],[]
nh = n // 2 
for i in range(nh):
    b.append(a[i*2])
    c.append(a[i*2+1])

cb = collections.Counter(b)
cc =collections.Counter(c)

cb2 = cb.most_common(2)
cc2 = cc.most_common(2)


if cb2[0] == cc2[0]:
    if len(cb2) == 1 and len(cc2) == 1:
        print(nh)
    elif len(cb2) == 1:
        print(nh - cc2[1][1])
    elif len(cc2) == 1:
        print(nh - cb2[1][1])
    elif cb2[1][1] >= cc2[1][1]:
        print(n - cb2[1][1] - cc2[0][1])
    else:
        print(n - cb2[0][1] - cc2[1][1])
else:
    print(n-cb2[0][1]-cc2[0][1])

Measured memory_bytes: 19168
/*
My heart’s beating faster
I know what I’m after
 
I’ve been standing here my whole life
Everything I’ve seen twice
Now it’s time I realized
It’s spinning back around now
On this road I’m crawlin’
Save me 'cause I’m fallin’
Now I can’t seem to breathe right
'Cause I keep runnin' runnin' runnin' runnin'
Runnin' runnin' runnin' runnin'
Runnin' from my heart
*/
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define slow_as_snail ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 
 
const ll mod = 1000000007;
#define mx 10000005
const ll mxi = 100005;

int main()
{
    slow_as_snail;
    ll n,l;
    cin>>n>>l;
    if(abs(l)>n)
    {
        if(l<0)
        {
            l = abs(l);
            ll tm = l*(l+1)/2;
            tm = -1*tm;
            // cout<<tm<<"\n";
            ll tmp = (abs(l)-n+1) * (abs(l)-n+2)/2;
            cout<< tm + tmp; 
        }
        else
        {
            ll tm = l+n-1;
            ll tmp = l*(l+1)/2;
            cout<<tm*(tm+1)/2 - tmp;
        }
    }
    else if(abs(l)<n)
    {
        if(l>0)
        {
            ll tm = l+n-1;
            ll tmp = l*(l+1)/2;
            cout<<tm*(tm+1)/2 - tmp;
        }
        else
        {
            l = abs(l);
            ll tm = l*(l+1)/2;
            ll tmp = (n-l-1)*(n-l)/2;
            cout<<tmp-tm;
        }
    }
    else
    {
        if(l<0)
        {
            l = abs(l);
            ll tmp = l*(l+1)/2;
            tmp = -1*tmp;
            cout<<tmp+1;
        }
        else
        {
            ll tm = l+n-1;
            ll tmp = l*(l+1)/2;
            cout<<tm*(tm+1)/2 - tmp; 
        }
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1e5+5;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a>=c+e && c-e>=0 && b>=d+e && d-e>=0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 584
import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int N = sc.nextInt();
        int A[]=new int[N+1];
        for(int i=1;i<=N;i++)
            A[sc.nextInt()]=i;
        for(int i=1;i<=N;i++)
            System.out.println(A[i]);
    }
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

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

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else 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 digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

int r(int x){
    return abs(x);
}



int main(){
    int n;
    cin >> n;
    int h[n];
    rep(i,n) cin >> h[i];
    int ans=0;
    int dp[n];
    dp[0]=0;
    dp[1]=r(h[1]-h[0]);
    for(int i=2;i<=n;i++){
        dp[i]=min(dp[i-2]+r(h[i]-h[i-2]),dp[i-1]+r(h[i]-h[i-1]));
    }

    
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define has_bit(bit_mask, x) ((bit_mask) & (1Uint << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1Uint << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1Uint << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
#define MOD 1000000007

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    cout << t << s << '\n';
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    ll prev = -INF;
    ll cnt = 0;
    ll ans = -INF;
    rep(i, N){
        ll h; cin >> h;
        if (h > prev){
            if (cnt > ans){ans = cnt;}
            cnt = 0;
        } else {
            cnt += 1;
        }
        prev = h;
    }
    if (cnt > ans){ans = cnt;}
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#!/usr/bin/env -S JULIA_VERSION=1.4.0 julia
# contest: abc167, problem: abc167_c, alphabet: C

function solve(N::Int, M::Int, X::Int, C::Vector{Int}, A::Matrix{Int})
  min_cost = 2^60
  for i in 0:2^N-1
    s = string(i, base=2, pad=N)
    @assert length(s) == N
    study = zeros(Int, M)
    cost = 0
    for (j, js) in enumerate(s)
      js == '0' && continue
      cost += C[j]
      for k in 1:M
        study[k] += A[j, k]
      end
    end
    if all(study .>= X)
      min_cost = min(min_cost, cost)
    end
  end
  if min_cost < 2^60
    println(min_cost)
  else
    println(-1)
  end
end

function main()
  # Failed to predict input format
  tokens = Channel{String}(32)
  Task() do
    for line in eachline(@static VERSION < v"0.6" ? STDIN : stdin)
      startswith(line, '\0') && break
      for token in split(chomp(line))
        put!(tokens, token)
      end
    end
    close(tokens)
  end |> schedule
  N = parse(Int, take!(tokens))
  M = parse(Int, take!(tokens))
  X = parse(Int, take!(tokens))
  C = zeros(Int, N)
  A = zeros(Int, N, M)
  for i in 1:N
    C[i] = parse(Int, take!(tokens))
    for j in 1:M
      A[i, j] = parse(Int, take!(tokens))
    end
  end
  solve(N, M, X, C, A)
end

if isempty(get(ENV, "ATCODER_LOCAL", ""))
  isempty(ARGS) && main()
else
  @eval begin
    const samples = [("3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9", "120"), ("3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5", "-1"), ("8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2", "1067")]
    function test(sampleids...)
      isempty(sampleids) && return test(collect(1:length(samples))...)
      ostdin, ostdout = @static VERSION < v"0.6" ? (STDIN, STDOUT) : (stdin, stdout)
      rd, wr = first(redirect_stdout()), last(redirect_stdin())
      try
        map(sampleids) do sampleid
          input, output = samples[sampleid]
          print(ostdout, "Testing sample #$(sampleid)..."); flush(ostdout)
          println(wr, input)
          println(wr, "\0")
          t = @elapsed main()
          println()
          result = strip(String(readavailable(rd)))
          if result == output
            println(ostdout, "OK ($t sec).")
            true
          else
            println(ostdout, "ERROR ($t sec)")
            println(ostdout, "== expected ==\n$output")
            println(ostdout, "== actual ==\n$result\n")
            false
          end
        end |> all
      finally
        redirect_stdin(ostdin)
        redirect_stdout(ostdout)
      end
    end
    submit() = test() && (prog = @__FILE__; run(`atcoder-submit $prog`))
    !isinteractive() && submit()
  end
end


Measured memory_bytes: 212152
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		out(lcm(2l, nl()));

	}

	/*
	 * 以下メソッド集
	 */

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int abcount(String str) {
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if ("AB".equals(str.substring(i, i + 2))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

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

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 23124
n = int(input())

D = {}
for i in range(n):
    s = ''.join(sorted(input()))
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1
    
ans = 0
for v in D.values():
    if v > 1:
        for i in range(v):
            ans += i
            
print(ans)

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

int main() {
  string c;
  cin >> c;
  
  if (c=="a"||c =="i"||c=="u"||c=="e"||c=="o"){  
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant "<< endl;
  }
} 

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int N, M;

int stream_line(vector<int> &X) {
    if (N >= M) {
        return 0;
    }
    sort(X.begin(), X.end());
    vector<int> L(M - 1);
    for (int i = 0; i < M - 1; i++) {
        L[i] = abs(X[i + 1] - X[i]);
    }
    sort(L.begin(), L.end(), greater<int>());
    int ans = X[M - 1] - X[0];
    for (int i = 0; i < N - 1; i++) {
        ans -= L[i];
    }
    
    return ans;
}

int main() {
    cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++) {
        scanf("%d", &X[i]);
    }

    int ans = stream_line(X);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 int i,j,c,ans,ns,nt;
 ans=INT_MAX;
 string s,t;
 cin >> s >> t;
 ns=s.length();
 nt=t.length();
 for(i=0;i<=(ns-nt);i++)
 {
  c=0;
  for(j=i;j<(i+nt);j++)
  c+=(s[j]!=t[j-i]);
  ans=min(ans,c);
 }
 cout << ans;
 return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC120C
{
    class MainClass
    {

        static int[] s;
        static int[] n;

        public static void Main(string[] args)
        {

            string str = Console.ReadLine();
            int cnt = 0;
            int l = str.Length;
            for (int i = 0; i < l; i++)
            {
                if (str[i] == '1')
                {
                    cnt++;
                }
            }
            cnt = Math.Min(cnt, l - cnt);
            int ans = cnt * 2;
            Console.WriteLine(ans);


        }
    }
}

Measured memory_bytes: 13148
n = int(input())
# cs = ['W' for i in range(200000)]
cs = input()

w_count = 0
for c in cs:
    if c == 'W':
        w_count += 1

if w_count == 0:
    print(0)
    exit()

rest = cs[-w_count:]

answer = 0
for c in rest:
    if c == 'R':
        answer += 1
print(answer)


Measured memory_bytes: 9336
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for _ in range(n)]
print(x+n+sum([(d-1)//a[i] for i in range(n)]))

Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

ll k,a[200000];

int main(){
    cin >> k;
    REP(i,k)
        cin >> a[i];

    ll l = 2,r = 2;

    for(int i = k - 1;i >= 0;i--) {
        l = (l + a[i] - 1) / a[i] * a[i];
        r = r / a[i] * a[i] + a[i] - 1;

        if(l > r)
            break;
    }

    if(l <= r)  {
        cout << l << " " << r << endl;
    }else {
        cout << -1 << endl;
    }
    return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<list>
using namespace std;
int main()
{
    list<int> L;
    auto cur=L.end();
    int T;
    cin>>T;
    while (T--)
    {
        int c;
        cin>>c;
        if(c==0)
        {
            int n;
            cin>>n;
            cur=L.insert(cur,n);
        }else if(c==1)
        {
            int n;
            cin>>n;
            if(n>0)
            {
                for(int i=0;i<n;i++) cur++;
            }
            else
            {
                 for(int i=0;i<-n;i++) cur--;
            }
        }else
        {
            cur=L.erase(cur);
        }
    }
    auto it=L.begin();
    while(it!=L.end())
    {
        cout<<*it<<endl;
        it++;
    }
}


Measured memory_bytes: 18652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+7;
const int maxm = 2e6+7;
const ll mod = 1e9+7;
int n,m,ar[maxn];

char ch[maxn];
ll f[maxn][2];
int main()
{
    scanf("%s", ch+1);
    n=strlen(ch+1);
    f[0][0]=1;
    for(int i=1;i<=n;i++){
        f[i][0] = (f[i-1][0]*3)%mod;
        f[i][1] = (f[i-1][1]*3+f[i-1][0])%mod;
    }
    ll a=1,ans=0,b=0;
    for(int i=1;i<=n;i++){
        if(ch[i]=='1'){
            ans += f[n-i][0]*a;
            ans %= mod;
        }
        ll na,nb;
        if(ch[i]=='1'){
            na = a*2;
        }
        else{
            na = a;
        }
        a = na%mod;
        b = nb%mod;
        //cout<<i<<" "<<ans<<" "<<a<<" "<<b<<endl;
    }
    ans = (ans + a)%mod;
    printf("%lld\n", ans);

    return 0;
}


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

int mod = 1'000'000'007;

long long modpow(long long x, long long y){
    if (y == 0) return 1;
    if (y % 2 == 0) return modpow(x, y / 2) * modpow(x, y / 2) % mod;
    return x * modpow(x, y - 1) % mod;    
}

int main(){
    string s;
    cin >> s;
    int k = (int)s.size();
    int count_one = 0;
    long long ans = 0;
    for (int i = 0; i < k; i++){
        if (s[i] == '0') continue;
        ans += modpow(3, k - i - 1) * modpow(2, count_one) % mod;
        ans %= mod;
        count_one++;
    }
    ans += modpow(2, count_one);
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 640
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let k: usize = parse_line().unwrap();
    let mut s = s.chars();
    let mut cnt_1 = 0;
    let mut ans = '1';

    while let Some(i) = s.next() {
        if i == '1' {
            cnt_1 += 1
        } else {
            ans = i;
            break;
        }
    }
    if k <= cnt_1 {
        ans = '1';
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
'use strict';

function Main(input) {
  const X = Number(input);
  let list = [];

  for(let i=1; i<32; i++) {
    for(let j=2; j<11; j++) {
      if(Math.pow(i,j) <= 1000) {
        list.push(Math.pow(i,j))
      }
    }
  }
  list.sort(function(a,b) {return a<b ? 1:-1;});  
  
  let listleng = list.length;

  for(let k=0; k<listleng; k++) {
    if(list[k] <= X) {
      console.log(list[k]);
      break;
    }
  }
  
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22460
#include <bits/stdc++.h>
#include <math.h>
#define PI 3.14159265359
using namespace std;

int main(){
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  
  h %= 12;
  double n_degree = (h * (360.0 / 12.0)) + (m * (360.0 / 12.0 / 60.0));
  double m_degree = (m * (360.0 / 60.0));

  double kari=min(abs(n_degree - m_degree),360 - abs(n_degree - m_degree));
  double radian=kari*PI/180;
  double x2 = cos(radian);
  printf("%15.10f",sqrt(a*a+b*b-2*a*b*x2));
  return 0;
}


Measured memory_bytes: 4100
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()
p = t[0]
h = 1
ans = 1
for x in t[1:]:
    h += 1
    if x > p + k or h > c:
        ans += 1
        p = x
        h = 1

print(ans)


Measured memory_bytes: 7888