akhauriyash/Code-Regression huggingface dataset:
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    LL X;
    R(X);
    LL now=100;
    int an=0;
    while(now<X){
        an++;
        now+=now/100;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 3800
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll rep_power_modM(ll a, ll n, ll M = MOD){
    if(n == 0)return 1;
    if(n%2 == 0){ll tmp = rep_power_modM(a,n/2,M); return tmp*tmp%M;}
    return a*rep_power_modM(a,n-1,M)%M;
}

int main(){
	int N,P; 
	P = 2019;
	string s; cin>>s;
	N = s.size();
	if(10%P == 0){
		ll ans = 0;
		rep(i,N){
			if((s[i]-'0')%P == 0){
				ans += i+1;
			}
		}
		cout<<ans<<endl;
		return 0;
	}
	vector<int> rest(N);
	REP(i,N){
		ll t = s[N-i]-'0';
		rest[i-1] = (t*rep_power_modM(10,i-1, P)) % P;
	}
	vector<int> sum(N+1,0);
	map<ll,ll> cnt;
	cnt[0]++;
	rep(i,N){
		sum[i+1] = (sum[i]+rest[i]) % P;
		cnt[sum[i+1]]++;
	}
	ll ans = 0LL;
	for(auto x:cnt){
		ans += x.second*(x.second-1LL)/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5164
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int A, B;
  cin >> A >> B;

  cout << max(A - B * 2, 0) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 210;
int g[N][N];
int r[10];
int m,n,R;
void floyd()
{
    for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++) g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
}
int main()
{
    scanf("%d%d%d",&n,&m,&R);
    for(int i=1;i<=200;i++)
        for(int j=1;j<=200;j++)
        if(i==j) g[i][j]=0;
        else g[i][j]=INF;
    for(int i=1;i<=R;i++)
        scanf("%d",&r[i]);
    sort(r+1,r+1+R);
    for(int i=1;i<=m;i++)
    {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        if(g[a][b]>c||g[b][a]>c)
        {
            g[a][b]=g[b][a]=c;
        }
    }
    floyd();
    int ans=INF;
    do
    {
        int sum=0;
        for(int i=1;i<R;i++)
            sum+=g[r[i]][r[i+1]];
        ans=min(ans,sum);
    }while(next_permutation(r+1,r+R+1));
    cout<<ans<<endl;
}


Measured memory_bytes: 384
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
nums=[0,2,5,5,4,5,6,3,7,6]
dp=[-1]*(n+1)
dp[0]=0
for i in range(1,n+1):
    for x in a:
        if i-nums[x]>=0:
            dp[i]=max(dp[i-nums[x]]+1,dp[i])
k=dp[n]
ans=[]
for i in range(k):
    for x in a:
        if n-nums[x]<0:
            continue
        if dp[n-nums[x]]==dp[n]-1:
            n-=nums[x]
            ans.append(x)
            break
print("".join(list(map(str,ans))))


Measured memory_bytes: 40688
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int n;
ll k;
vector<int> g[100010];
ll ans;
bool used[100010];
void dfs(int x){
    used[x]=1;
    int cnt=0;
    for(auto y:g[x]){
        if(used[y]) continue;
        cnt++;
        dfs(y);
    }
    if(x==0){
        for(ll i=0; i<cnt; i++){
            ans*=(k-1-i);
            ans%=MOD;
        }
    }else{
        for(ll i=0; i<cnt; i++){
            ans*=(k-2-i);
            ans%=MOD;
        }
    }
}
int main()
{
    cin>>n>>k;
    ans=k;
    for(int i=0; i<n-1; i++){
        int a, b; cin>>a>>b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0);
    cout<<ans<<endl;
    
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n);
  for(int i=0;i<n;i++) cin >> vec[i];
  if((n-1)%(k-1)==0) cout << (n-1)/(k-1) << endl;
  else cout << (n-1)/(k-1) + 1 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,a[N];
long long ans=0;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)
	{
		int pnt=a[i]/2;
		ans+=pnt;
		a[i]%=2;
		if(a[i]&&a[i+1])
		{
			ans++;
			a[i]=0;
			a[i+1]--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
N,M=map(int, input().split())
py=[list(map(int, input().split())) for _ in range(M)]
cnt=[0]*(N+1)
ids={}
for p,y in sorted(py, key=lambda x: x[1]):
	cnt[p] += 1
	ids[y] = "%06d%06d" % (p, cnt[p])
for _,y in py:
	print(ids[y])


Measured memory_bytes: 43860
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <stdio.h>

int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<std::pair<int, std::pair<int, int>>> x(m);
    for (int i = 0; i < m; i++) {
        int a, b;
        std::cin >> a >> b;
        x[i] = {a, {b, i}};
    }
    std::sort(x.begin(), x.end());
    int cur_p = 0;
    int cur_id = 0;
    for (int i = 0; i < m; i++) {
        int p = x[i].first;
        if (cur_p != p) {
            cur_p = p;
            cur_id = 1;
        }
        x[i] = {x[i].second.second, {p, cur_id}};
        cur_id++;
    }
    std::sort(x.begin(), x.end());
    for (auto p : x) {
        printf("%06d", p.second.first);
        printf("%06d\n", p.second.second);
    }
}




Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int main(void){
int a,b;cin>>a>>b;
for(int i=1;i<=3;i++){
    if(a*b*i%2!=0){
        cout<<"Yes"<<endl;
        return 0;
    }
}
cout<<"No"<<endl;
return 0;}


Measured memory_bytes: 3544
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[20];
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;++i)
	{
		if(i==3) printf("8");
		else printf("%c",s[i]);
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<iomanip>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;

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







Measured memory_bytes: 256
import Foundation

let N = Int(readLine()!)!
let n = N
let s = readLine()!
let x = Array(s).map { String($0) }.compactMap { Int($0) }
let pc = x.reduce(0, +)

var ans: [Int] = .init(repeating: 0, count: N)

func popcount(_ x: Int) -> Int {
  var x = x
  var count = 0
  while x > 0 {
    x = x & (x - 1)
    count += 1
  }
  return count
}

func f(_ x: Int) -> Int {
  if x == 0 {
    return 0
  }
  return f(x % popcount(x)) + 1
}

for b in 0..<2 {
  let npc = b == 0 ? pc + 1 : pc - 1
  if npc <= 0 {
    continue
  }
  var r0 = 0
  for i in 0..<x.count {
    r0 = (r0 * 2) % npc
    r0 += x[i]
  }
  var k = 1
  for i in (0..<x.count).reversed() {
    if x[i] == b {
      var r = r0
      r = b == 0 ? (r + k) % npc : (r - k + npc) % npc
      ans[i] = f(r) + 1
    }
    k = (k * 2) % npc
  }
}
ans.forEach { print($0) }


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

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n;cin>>n;){
		vi a(n);
		rep(i,n)
			cin>>a[i];
		sort(allof(a));
		vi b(n);
		partial_sum(allof(a),b.begin());
		cout<<accumulate(allof(b),0)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    K = int(readline())

    vec = list(range(1, 10))
    for i in range(K):
        tail = vec[i] % 10
        n10 = vec[i] * 10
        if tail == 0:
            vec.append(n10 + tail)
            vec.append(n10 + tail + 1)
        elif tail == 9:
            vec.append(n10 + tail - 1)
            vec.append(n10 + tail)
        else:
            vec.append(n10 + tail - 1)
            vec.append(n10 + tail)
            vec.append(n10 + tail + 1)

        if len(vec) >= K:
            break

    print(vec[K - 1])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 72824
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if (s.matches(".*C.*F.*")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

int main()
{
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (0 <= x - r && x + r <= W
   && 0 <= y - r && y + r <= H)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
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) cout << fixed << setprecision(10) << s << endl;

string res;
ll sum = 0;

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

    println((a + b >= 10 ? "error" : to_string(a + b)));
}

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

int main() {
    long n, ans = 4;
    cin >> n;
    vector<long> temp(5);
    rep(i, 5) cin >> temp.at(i);
    sort(temp.begin(), temp.end());
    ans += (n + temp.at(0) - 1) / temp.at(0);
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(A: int, B: int):
    if(A >= 13):
        print(B)
    elif 6 <= A <= 12:
        print(B//2)
    else:
        print(0)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
R, B, G, N = (int(x) for x in input().split())
a = [R, B, G]
a = sorted(a)
b = a[2]
d = a[1]
f = a[0]
c = int(N / b)

count = 0

for i in range(c + 1):
    n = N - b * i
    e = int(n / d)
    for j in range(e + 1):
        m = n - d * j
        if m % a[0] == 0:
            count += 1

print(count)

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

int main()
{
    int dp[100000];
    int n;
    cin>>n;
    int ar[100000];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    dp[0]=0;
    dp[1]=abs(ar[0]-ar[1]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min((dp[i-1]+abs(ar[i-1]-ar[i])),(dp[i-2]+abs(ar[i-2]-ar[i])));
    }
    printf("%d",dp[n-1]);
}

Measured memory_bytes: 4520
nnnnn = 1010
P = 10 ** 9 + 7

fa = [1]
for i in range(1, nnnnn):
    fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, nnnnn)[::-1]:
    fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]

N, K = map(int, input().split())
A = [int(a) for a in input().split()]

def calc(k):
    return [fainv[i] * fa[N-i] * fainv[k-i] * fainv[N-k] % P if i <= k else 0 for i in range(N+1)]

def conv(a, b):
    L = [0] * (N+1)
    for i in range(N+1):
        for j in range(N+1):
            if i+j <= N: L[i+j] += a[i] * b[j]
    return [l % P for l in L]

X = [1] + [0] * N
for a in A:
    X = conv(X, calc(a))

print(X[-1] * fa[N] % P)


Measured memory_bytes: 51804
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vnt;

int n;
int a;
int k;

int main(){
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a;
		if(a%2) k++;
	}
	cout << ((k%2) ? "NO" : "YES") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <list>
#include<vector>
#include <sstream>
#include <stdio.h>
#include <valarray>
using namespace std;
float Max;
string Plindrome;
int main(void)
{
	auto CheckPlindrome = [](string Target)
	{
		string ReversedStr = Target;
		reverse(ReversedStr.begin(), ReversedStr.end());
		return Target == ReversedStr;
	};


	cin >> Plindrome;
	string PartsA;
	string PartsB;
	int PlindromeLen = Plindrome.size();

	if (!CheckPlindrome(Plindrome))
	{
		cout << "No" << endl;
		return 0;
	}

	PartsA = Plindrome.substr(0,(PlindromeLen-1)/2);
	PartsB = Plindrome.substr((PlindromeLen + 2) / 2);


	if (!CheckPlindrome(PartsA))
	{
		cout << "No" << endl;
		return 0;
	}

	if (!CheckPlindrome(PartsB))
	{
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int H, W, i, j;

  for (; scanf("%d %d", &H, &W); ) {
    if (H == W && H == 0) {
      break;
    }

    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        putchar((i + j) % 2 ? '.' : '#');
      }

      putchar('\n');
    }

    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 572
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	//
	int N;
	cin >> N;

	int ans = 1000000;
	for (int i = 1; i != N; ++i) {
		int a = i;
		int b = N - i;
		int sum = 0;
		while (1) {
			sum += (a % 10);
			a = a / 10;
			if (a == 0) {
				break;
			}
		}
		while (1) {
			sum += (b % 10);
			b = b / 10;
			if (b == 0) {
				break;
			}
		}

		ans = min(ans, sum);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int m,k;
	cin>>m>>k;
	if(m<=1)
	{
		if(m==0&&k==0)
		{
			cout<<"0 0";
			return 0;
		}
		if(m==1&&k==0)
		{
			cout<<"0 0 1 1";
			return 0;
		}
		cout<<"-1";
		return 0;
	}
	m=(1<<m)-1;
	if(k>m)
	{
		cout<<"-1";
		return 0;
	}
	for(int i=0;i<=m;++i)
	{
		if(i!=k)
		cout<<i<<" ";
	}
	cout<<k<<" ";
	for(int i=m;i>=0;--i)
	{
		if(i!=k)
			cout<<i<<" ";
	}
	cout<<k<<" ";
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
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; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
void dfs(int x, int dist, Graph& to, Graph& D, vector<bool>& visited, V& ans) {
	ans[x] = dist % 2;
	visited[x] = true;
	int C = 0;
	for (auto v : to[x]) {
		if (!visited[v]) {
			dfs(v, dist + D[x][C], to, D, visited, ans);
		}
		C++;
	}
}
int main() {
	int n;
	cin >> n;
	Graph to(n);
	Graph D(n); // (2*10^5)^2とか馬鹿か？
	rep(i, n - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		c %= 2;
		to[a].push_back(b); D[a].push_back(c);
		to[b].push_back(a); D[b].push_back(c);
	}
	vector<bool> visited(n, false);
	V ans(n, 0);
	dfs(0, 0, to, D, visited, ans);
	rep(i, n) cout << ans[i] << endl;
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, X, Y;
int cnt[2100];

int dist(int v, int w){
    if(v > w){std::swap(v, w);}

    if(v <= X){
        return std::min(w - v, (X - v) + 1 + std::abs(w - Y));
    }

    if(Y <= w){
        return std::min(w - v, (w - Y) + 1 + std::abs(v - X));
    }

    return std::min(w - v, (Y - X) - (w - v) + 1);
}

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

  std::cin >> N >> X >> Y;

  for(int i=1;i<=N;++i){
      for(int j=i+1;j<=N;++j){
          cnt[dist(i, j)] += 1;
      }
  }

  for(int k=1;k<N;++k){
      std::cout << cnt[k] << std::endl;
  }
}


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

using namespace std;


int main()
{
  int N;
  cin >> N;
  vector<int> A;
  A.resize(N);
  int min = 100000;
  int min_pos = 0;
  int max_pos = 0;
  int max = -100000;
  for(int i = 0;
      i < N;
      ++i)
    {
      cin >> A[i];
      if(A[i] < min)
        {
          min = A[i];
          min_pos = i;
        }
      if(A[i] > max)
        {
          max = A[i];
          max_pos = i;
        }
    }

  int ans;
  vector<pair<int, int> > v;

  if(min_pos == max_pos)
    {
      max_pos = N - 1;
    }

  if(max < 0)
    {
      ans = max;

      for(int i = 0;
          i < N;
          ++i)
        {
          if(i != max_pos)
            {
              v.push_back(make_pair(ans, A[i]));
              ans -= A[i];
            }
        }
    }
  else if(min >= 0)
    {
      ans = min;
      for(int i = 0;
          i < N;
          ++i)
        {
          if(i != min_pos && i != max_pos)
            {
              v.push_back(make_pair(ans, A[i]));
              ans -= A[i];
            }
        }
      v.push_back(make_pair(max, ans));
      ans = max - ans;
    }
  else
    {
      int ans1 = max;
      int ans2 = min;
      for(int i = 0;
          i < N;
          ++i)
        {
          if(i != min_pos && i != max_pos && A[i] >= 0)
            {
              v.push_back(make_pair(ans2, A[i]));
              ans2 -= A[i];
            }
          else if(i != min_pos && i != max_pos && A[i] < 0)
            {
              v.push_back(make_pair(ans1, A[i]));
              ans1 -= A[i];
            }
        }
      v.push_back(make_pair(ans1, ans2));
      ans = ans1 - ans2;
    }

  cout << ans << endl;
  for(int i = 0;
      i < v.size();
      ++i)
    {
      cout << v[i].first << " " << v[i].second << endl;
    }
  return 0;
}


Measured memory_bytes: 3188
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto xs = readints;
    int a = xs[0], b = xs[1];

    int ans = max(a + b, a - b, a * b);
    writeln(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w,m;
string s[1000],s1,s2;
//vvl v;
//vl vis,d;


int main() {
    IOS;
    cin>>n;
    vl v(n),a;cin>>v;a=v;
    sort(all(a));
    if(v==a)return cout<<"YES",0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            swap(v[i],v[j]);
            if(v==a)return cout<<"YES",0;
            swap(v[i],v[j]);
        }
    }
    cout<<"NO";
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = [0]*N
div = []
flg = 0
for i in range(N):
	a[i] = int(input())
	if i != 0:
		if (a[i] - a[i-1]) > 1:
			flg = 1
		if a[i-1] > a[i]:
			div.append(i)

div.append(N)

if (flg == 1) or (a[0] != 0):
	print(-1)
	exit(0)

ans = 0
p = 0
for index in div:
	s = a[index-1]
	for i in range(index-1,p,-1):
		if a[i] == a[i-1]:
			s += a[i-1]
	ans += s
	p = index

print(ans)

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		while(true) {
			C -= B;
			if(C <= 0) {
				System.out.println("Yes");
				return;
			}
			A -= D;
			if(A <= 0) {
				System.out.println("No");
				return;
			}
		}
	}

}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
int f[100001];
int main()
{
    int n,i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
	{
        f[i]=f[i-1]+1;
        for(j=6;j<=i;j*=6)
			f[i]=min(f[i],f[i-j]+1);
        for(j=9;j<=i;j*=9) 
			f[i]=min(f[i],f[i-j]+1);
    }
	printf("%d",f[n]);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  if(s.at(3) ==s.at(2)&& s.at(4) == s.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())

    ret = 0
    for i in range(1,N+1):
        tmp = N // i
        left = i
        right = i * tmp
        ret += (left + right) * tmp // 2
    print(ret)
if __name__ == "__main__":
    run()

Measured memory_bytes: 65892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= (int)b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int mod = 1e9 + 7, maxn = 100010;
struct Edge { int to, nxt; } edge[maxn * 2];
int tot, head[maxn], n, k, dp[maxn], son[maxn];
void add(int u, int v) { edge[++tot].to = v, edge[tot].nxt = head[u], head[u] = tot; }
void dfs(int u, int fa) {
	for(int i = head[u]; i; i = edge[i].nxt) if(edge[i].to != fa) {
		int v = edge[i].to;
		son[u]++;
	}
}
void Dp(int u, int fa, int cur1, int cur2) {
	dp[u] = k - cur1 - cur2;
	bool tmp = 1;
	int tmp1 = 1, tmp2 = 0;
	if(fa != 0) tmp2 = 1;
	for(int i = head[u]; i; i = edge[i].nxt) if(edge[i].to != fa) {
		int v = edge[i].to;
		tmp2++;
		if(tmp && tmp2) tmp2--, tmp = 0;
		Dp(v, u, tmp1, tmp2);
	}
}
int main()
{
	read(n), read(k);
	for(int u, v, i = 1; i < n; i++) {
		read(u), read(v);
		add(u, v), add(v, u);
	}
	dfs(1, 0);
	Dp(1, 0, 0, 0);
	ll ans = 1;
	rep(i, 1, n) ans = ans * dp[i] % mod;
	//rep(i, 1, n) cout << dp[i] << " ";
	printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 6144
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b=INT_MAX,c=0,f=INT_MAX;cin>>a;
  vector<ll>d(a);
  rep(i,a){
    cin>>d[i];
    b=min(d[i],b);
    c=max(d[i],c);
  }
  for(ll i=b;i<c+1;i++){
    ll e=0;
    rep(o,a){
      e+=(d[o]-i)*(d[o]-i);
    }
    f=min(f,e);
  }
  cout<<f;
}


Measured memory_bytes: 26992
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int dp[50];
int main(){
    int n;
    cin>>n;
    dp[1]=dp[0]=1;
    FOR(i,2,n+1) dp[i]=dp[i-1]+dp[i-2];
    cout<<dp[n]<<endl;
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    
    int a,b,c,d;
    
    a = N%10 ;
    b = (N%100-a)/10 ;
    c = (N%1000-N%100)/100;
    d = N/1000;
    
    if ((b==c) && ((a==b) || (c==d))){
        cout << "Yes" <<endl;
    }
    else {
        cout << "No" <<endl;
    }
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define vpush(v,x) v.push_back(x);
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,w,h;
    string s;
    cin>>a>>b;
    cout<<((a*3)+b)/2;
    return(0);
}

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

int main(){
	int n;
	cin >> n;
	vector<int> o(100005,0),e(100005,0);
	for(int i=0; i<n; i++){
		int v;
		cin >> v;
		if(i%2==1) o[v]++;
		else e[v]++;
	}

	int i = max_element(e.begin(), e.end()) - e.begin();
	int j = max_element(o.begin(), o.end()) - o.begin();
	if(i != j) cout << n-e[i]-o[j] << endl;
	else{
		sort(e.begin(), e.end(), greater<int>());
		sort(o.begin(), o.end(), greater<int>());
		int an = min(n-e[0]-o[1], n-e[1]-o[0]);

		cout << an << endl;
	}

	return 0;
}


Measured memory_bytes: 3932
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace competition
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            bool isFound = false;
            for (int i = 0; i < 3; i++)
            {
                 
                int rem = a % 10;
                a = a / 10;
                if (rem == 7)
                {
                    isFound = true;
                    break;
                }
            }
            if (isFound==true)
            {
                Console.WriteLine("Yes");
            }
            if (isFound==false)
            {
                Console.WriteLine("No");
            }
        }
            
                
             

        
    }
}


Measured memory_bytes: 27476
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long h = Long.parseLong(sc.next());
        long w = Long.parseLong(sc.next());

        // 主処理
        long result = (long) Math.ceil(h * w / 2.0);

        if (h == 1 || w == 1) {
            result = 1;
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
    double h,a;
    int i,s;
    while(scanf("%lf%lf",&h,&a)!=EOF)
    {
        s=0;
        while(h>0)
        {
            h=h-a;
            s++;
        }
        printf("%d\n",s);
    }
}


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

typedef long long int   ll;
#define cases           int t;cin>>t;while(t--)
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%d",&n)
#define PI              3.1415926535897932384626433832795
#define int             ll
#define loop0           for(int i=0;i<n;i++)
#define loop1           for(int i=1;i<=n;i++)
#define inpar0(ar)      for(int i=0;i<n;i++)cin>>ar[i];
#define inpar1(ar)      for(int i=1;i<=n;i++)cin>>ar[i];
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" ";
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" ";
#define manu            cout<<(checkerCounter++)<<endl;
int checkerCounter = 1;
int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int n;cin>>n;
    int h[n];
    inpar0(h);
    int dp[n];
    for(int i=1;i<n;i++){
        dp[i]=INT_MAX;
    }
    dp[0]=0;
    for(int i=0;i<n-1;i++){
        if(i<n-2){
            dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+2]);
        }
        dp[i+1]=min(dp[i]+abs(h[i+1]-h[i]),dp[i+1]);
    }
//    showar0(dp)cout<<endl;
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
A=int(input())
B=int(input())
C=int(input())
X=int(input())

ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if 500 * a + 100 * b + 50 * c == X:
                ans += 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	int t = 100 * r + 10 * g + b;
	if (t % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ismdeep
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char l = in.next().toCharArray()[0];
            char r = in.next().toCharArray()[0];
            if (l < r) {
                out.println("<");
            } else if (l == r) {
                out.println("=");
            } else {
                out.println(">");
            }
        }

    }
}



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

typedef long long int ll;

ll ar[1<<17+5];

int main() {
    string str;
    cin>>str;
    str[0]='2';
    str[1]='0';
    str[2]='1';
    str[3]='8';
    cout<<str<<endl;
}


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

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

    vector<set<int>> s(n + 1);
    int a;

    for (int i = 2; i <= n; i++) {
        cin >> a;
        s[a].insert(i);
    }

    for (int i = 1; i <= n; i++) {
        cout << s[i].size() << endl;
    }
    return 0;
}

Measured memory_bytes: 21912
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve()
{
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
    ll n;
    cin>>n;
    ll a[n];
    for (ll i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    ll stools = 0;
    for(ll i=1; i<n; i++)
    {
        // cout<<stools<<'\n';
        if(a[i] < a[i - 1])
        {
            stools += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout<<stools<<'\n';
}

Measured memory_bytes: 5176
#include"bits/stdc++.h"
using namespace std;

int main() {
	vector<int> A(3);
	cin >> A[0];
	cin >> A[1];
	cin >> A[2];
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	cout << A[0] - A[2] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>

#define div 1000000000+7

typedef long long ll;

using namespace std;


int main() {
    int n, ans;
    cin >> n;
    ans = 800 * n - 200 * (n/15);
    cout << ans << endl;
}

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

#define rep(i,beg,end)   for (auto i=(beg);i<(end);i++)
#define rrep(i,beg,end)   for (auto i=(beg);i>=(end);i--)
#define all(cont)           begin(cont), end(cont)
#define rall(cont)           rbegin(cont), rend(cont)
typedef long long ll;
typedef vector<ll> vi;
const ll INFMAX = LLONG_MAX;
const ll INFMIN = LLONG_MIN;
const ll MOD = 1000000007;
typedef pair<int, int> pii;


bool compare(const pii& x, const pii& y)
{
    if (x.first < y.first) return true;
    else return false;
}

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

    function<bool(const pii&, const pii&)> cmp = compare;
    int n, m; cin >> n >> m;
    vector<pii> v(n);
    rep(i, 0, n)
    {
        cin >> v[i].first >> v[i].second;
    }
    sort(all(v), cmp);
    int cnt = 0;
    deque<int> cache;
    rep(s, v[0].first, m + 1)
    {
        auto tbeg = lower_bound(all(v), pii(s, 0), cmp);
        auto tend = upper_bound(all(v), pii(s, 0), cmp);
        vector<pii>::iterator del = end(v);
        for (auto it = tbeg; it != tend; it++) {
            int v = it->second;
            cache.insert(lower_bound(all(cache), v), v);
        }
        if (!cache.empty()) {
            cnt += cache.back();
            cache.pop_back();
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1408
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int k;
int cntA[N];
int cntW[N];
bool status[N];
bool wrong[N];

int main(){
    int ac = 0 , av = 0;
    cin >> n >> k;
    while(k--){
        int x;
        string s;
        cin >> x >> s;
        if(s == "WA" && !status[x]){
            cntW[x]++;
        } else {
            status[x] = 1;
        }
    }
    for(int i = 1; i <= n; i++){
        if(status[i]){
            ac++;
            av += cntW[i];
        }
    }

    cout << ac << " " << av << endl;

}


Measured memory_bytes: 768
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n/10 == 9 || n%10 == 9) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
 
    }
}

Measured memory_bytes: 23124
fun main(args: Array<String>) {
    var Q = nextInt()
    repeat(Q) {
        val (A, B) = listOfLong()
        val ans: Long
        if (A == B) {
            ans = 2 * A - 2
        } else if (A + 1 == B || B + 1 == A) {
            ans = 2 * Math.min(A, B) - 2
        } else {
            val ab = A * B
            var d = Math.sqrt(ab.toDouble()).toLong()
            if (d * d == ab) d--
            if (d * (d + 1) >= ab) {
                ans = 2 * d - 2
            } else {
                ans = 2 * d - 1
            }
        }
        println(ans)
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfLong(d: Long = 0) = listOfString().map { it.toLong() + d }


Measured memory_bytes: 37936
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int N;
    std::cin >> N;
    std::vector<int> v(N);
    for (auto& e : v) std::cin >> e;

    int Q;
    std::cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int k;
        std::cin >> k;
        std::cout << (std::lower_bound(v.begin(), v.end(), k) - v.begin()) << std::endl;
    }
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   int a;
   cin>>a;
   for (int i=0;i<a;i++){
       int b; cin>>b;
       if (b%2==0) {
           if (b%3!=0 and b%5!=0){
               cout<<"DENIED";
               return 0;
           }
       }
   }
   cout<<"APPROVED";
   

}

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

int N,K;
vector<int> a;

bool check(int d)
{
    vector<int> b(N);
    for(int i=0;i<N;i++){
        b[i]=a[i]%d;
    }
    sort(b.begin(),b.end());

    int l=0,r=N-1;
    int cost1=0,cost2=0;
    while(l<=r){
        // [l,r]
        if(cost1<=cost2){
            cost1+=b[l++];
        }else{
            cost2+=d-b[r--];
        }
    }
    assert(cost1==cost2);
    return cost1<=K;
}

signed main()
{
    cin>>N>>K;
    a.resize(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    int S=accumulate(a.begin(),a.end(),0LL);

    int ans=0;
    for(int d=1;d*d<=S;d++) if(S%d==0){
        if(check(d)) ans=max(ans,d);
        if(check(S/d)) ans=max(ans,S/d);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
  int x1, y1, x2, y2, x3 = 0, y3 = 0, x4 = 0, y4 = 0;
  cin >> x1 >> y1 >> x2 >> y2;

  int dx = (x2 - x1);
  int dy = (y2 - y1);
  if (dx >= 0) {
    if (dy >= 0) {
      x3 = x2 - dy;
      y3 = y2 + dx;
      x4 = x1 - dy;
      y4 = y1 + dx;
    } else {
      x3 = x2 + (-dy);
      y3 = y2 + dx;
      x4 = x1 + (-dy);
      y4 = y1 + dx;
    }
  } else if (dx < 0) {
    if (dy >= 0) {
      x3 = x2 - dy;
      y3 = y2 - (-dx);
      x4 = x1 - dy;
      y4 = y1 - (-dx);
    } else {
      x3 = x2 + (-dy);
      y3 = y2 + dx;
      x4 = x1 + (-dy);
      y4 = y1 + dx;
    }
  }
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}


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

using namespace std;

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

    return gcd(y, x%y);
}

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

    int left[100001], right[100001];

    left[0] = a[0];
    right[n-1] = a[n-1];
    for(int i = 1; i < n; i++){
        left[i] = gcd(left[i-1], a[i]);
        right[n-1-i] = gcd(right[n-i], a[n-1-i]);
    }

    int g[100001];
    g[0] = right[1];
    g[n-1] = left[n-2];

    for(int i = 1; i < n-1; i++){
        g[i] = gcd(left[i-1], right[i+1]);
    }
    
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = max(ans, g[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"

using namespace std;

ssize_t cost(vector<int> w, vector<int> v, int W)
{
    int n = w.size();
    if (!n) return 0;

    vector<ssize_t> ans(W + 1, -1);

    ans[0] = 0;
    for (int i = 0; i < n; ++i)
    {
        const int cw = w[i], cv = v[i];

        for (int j = W; j >= cw; --j)
        {
            if (ans[j-cw] >= 0) ans[j] = max(ans[j], ans[j - cw] + cv);
        }
    }

    ssize_t a = 0;
    for (int i = 0; i <= W; ++i) a = max(a, ans[i]);
    return a;
}

int main(int argc, char *argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, fw; cin >> n >> fw;
    vector<int> w(n);
    vector<int> v(n);
    for (int i = 0; i < n; ++i) { cin >> w[i] >> v[i]; };
    cout << cost(w, v, fw) << endl;
    return 0;
}


Measured memory_bytes: 1024