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

using Graph = vector<vector<pair<ll,double>>>;

// MOD確認

int main(){
    /*string S;
    cin >> S;
    if(S[2] == S[3] && S[4] == S[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }*/
    ll X;
    cin >> X;
    cout << (X / 500) * 1000 + ((X % 500) / 5) * 5 << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
s = str(input())

print (s[:4] + " " + s[4:])


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] values = new int[w];
            for (int i = 0; i < values.length; i++) {
                values[i] = i + 1;
            }
            for (int i = 0; i < n; i++) {
                String str = sc.next();
                String[] ab = str.split(",");
                int a = Integer.parseInt(ab[0]) - 1;
                int b = Integer.parseInt(ab[1]) - 1;
                int value = values[a];
                values[a] = values[b];
                values[b] = value;
                //aとbを使ってvaluesを操作
            }
            for (int i = 0; i < values.length; i++) {
                System.out.println(values[i]);
            }
            //valuesを出力
        }
    }
}



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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    string s; cin >> s;
    if(s[0] == s[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7724
#include<bits/stdc++.h>
typedef long long     ll;
#define fast          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr            first
#define sc            second
#define com(i,n)      for(int i=0;i<n;i++)
#define dom(i,n)      for(int i=1;i<=n;i++)
#define mom(i,n)      for(int i=n;i>=0;i--)
#define sortI(a,n)    sort(a,a+n)
#define sortD(a,n)    sort(a,a+n,greater<int>())
#define sortvi(a)     sort(a.begin(),a.end())
#define sortvd(a)     sort(a.begin(),a.end(),greater<int>())
#define sumall(a,x)   accumulate(a.begin(),a.end(),x)
#define pi            3.14159265358979323846264338327950
using namespace std;
void solve()
{
    int n;
    cin>>n;
    vector<ll>a(n);
    com(i,n)
    {
        cin>>a[i];
    }
    string s;
    cin>>s;
    vector<ll>b;
    mom(i,n-1)
    {
        ll v=a[i];
        for(auto x:b)
        {
            v=min(v,v^x);
        }
        if(v)
        {
            if(s[i]=='1')
            {
                cout << 1 << endl;
                return;
            }
            b.push_back(v);
        }
    }
    cout << 0 << endl;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io

    ll n, p;
    cin>>n>>p;

    ll ans=1;

    for(ll i=2;i*i<=p;i++){
        int num=0;
        while(p%i==0){
            num++;
            p/=i;
        }
        int cnt=num/n;
        for(int j=0;j<cnt;j++) ans*=i;
    }
    if(n==1) ans*=p;
    cout<<ans<<endl;
    return 0;

}


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

using namespace std;

  struct student{
    int index;
    int A;

    bool operator<(const student &s) const
    {
      return A < s.A;
    };
  };

int main(void) {

  int n,buff;
  cin >> n;
  vector<student> a;
  for(int i = 0;i < n;i++){
    cin >> buff;
    a.push_back({i + 1,buff});
  }
  sort(a.begin(),a.end());
  for(int i = 0;i < n;i++){
    cout << a[i].index << endl;
  }

  return 0;
}


Measured memory_bytes: 1780
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;

int main() {
    int n; cin >> n;
    double ans = 0;
    REP(i, n) {
        double a;
        cin >> a;
        ans += (double)1 / a;
    }
    printf("%.10f", 1/ans);
    getchar(); getchar();
}


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

using namespace std;

int MapData[255][255], DpResult[4][255][255], Ans[4], MaxLen;
string strOfRow;

void solve(int n) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (MapData[i][j] == 0) {
				continue;
			}

			//上下
			if (i > 0) {
				DpResult[0][i][j] = DpResult[0][i - 1][j] + 1;
			}
			//左右
			if (j > 0) {
				DpResult[1][i][j] = DpResult[1][i][j - 1] + 1;
			}
			//左斜め
			if (i > 0 && j > 0) {
				DpResult[2][i][j] = DpResult[2][i - 1][j - 1] + 1;
			}
			//右斜め
			if (i > 0 && j < n-1) {
				DpResult[3][i][j] = DpResult[3][i - 1][j + 1] + 1;
			}

			for (int k = 0; k < 4; k++) {
				Ans[k] = max(Ans[k], DpResult[k][i][j]);
				MaxLen = max(MaxLen, Ans[k]);
			}
		}
	}
	
}

void show(int n) {
	cout << "Dp:" << endl;
	for (int k = 0; k < 4; k++) {
		cout << "k=" << k << endl;
		for (int row = 0; row < n; row++) {
			for (int j = 0; j < n; j++) {
				cout << DpResult[k][row][j];
			}
			cout << endl;
		}
		cout << "ans=" << Ans[k] << endl << endl;
	}
}

int main() {
	int n;

	while (cin >> n, n) {
		memset(MapData, 0, sizeof(MapData));
		memset(DpResult, 0, sizeof(DpResult));
		memset(Ans, 0, sizeof(Ans));
		MaxLen = 0;
		for (int row = 0; row < n; row++) {
			cin >> strOfRow;
			for (int col = 0; col < n; col++) {
				MapData[row][col] = DpResult[0][row][col] = DpResult[1][row][col] = DpResult[2][row][col] = DpResult[3][row][col] = strOfRow[col] - '0';
			}			
		}
		solve(n);
		//show(n);
		cout << MaxLen << endl;
	}

	return 0;
}



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int a, b, c;cin >> a >> b >> c;
    int ans = 3;
    if(a == b) ans--;
    if(b == c) ans--;
    if(c == a) ans--;
    if(a == b && b == c && c == a) ans++;
    cout << ans << endl;
    return 0;
}


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

void insertionSort(int* A, int n);

int main(void){
	int n,i;
	int* A;

	scanf("%d",&n);
	A = (int *)malloc(n * sizeof(int));  /* ?????¢?????????????¢???? */
 
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	printf("%d",A[0]);
	for(i=1;i<n;i++)  printf(" %d",A[i]);
	printf("\n");

	insertionSort(A,n);

	free(A);
	return 0;
}

void insertionSort(int* A, int n){
	int i,j, v;
	for(i=1;i<n;i++){
    	v = A[i];
    	j = i - 1;
     	while (j >= 0 && A[j] > v){
    	   	A[j+1] = A[j];
    	   	j--;
    		A[j+1] = v;
 		}
 		printf("%d",A[0]);
 		for(j=1;j<n;j++)  printf(" %d",A[j]);
 		printf("\n");
   	}
}

Measured memory_bytes: 600
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int res = s.find_last_of('Z') - s.find_first_of('A') + 1;
  cout << res << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,i;
  long sum;
  sum=0;
  cin>>N;
  int A[N+1];
  int B[N];
  for(i=0;i<(N+1);i++){
  cin>>A[i];
   
  }
  for(i=0;i<N;i++){
  cin>>B[i];
   
  }
  for(i=0;i<N;i++){
    
  if(B[i]<=A[i]) {
    sum=sum+B[i];
  }else{
  sum=sum+A[i];
    B[i]=B[i]-A[i];
    if(B[i]<=A[i+1]){
    A[i+1]=A[i+1]-B[i];
      sum=sum+B[i];
    }else{
    sum=sum+A[i+1];
      A[i+1]=0;
    }
  }
  }
  
  cout<<sum<<endl;
  
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
struct Node{
  int key;
  Node *parent,*left,*right;
};

Node *root,*NIL;

void Preorder(Node *pp){
  if(pp==NIL)return;
  cout<<" "<<pp->key;
  Preorder(pp->left);
  Preorder(pp->right);
}
void Inorder(Node *in){
  if(in==NIL)return;
  Inorder(in->left);
  cout<<" "<<in->key;
  Inorder(in->right);
}

void insert(int k){
  Node *z;
  Node *y=NIL; //x's parent
  Node *x=root; //T's root
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(1){
    if(x==NIL)break;
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else {
    if(z->key<y->key){
      y->left=z;
    }
    else {
      y->right=z;
    }
  }
}
int main(){
  int n=0,in=0,j=0;
  int i=0;
  char cel[10];
  cin>>n;
  for(i=0;i<n;i++){
    cin>>cel;
    if(!strcmp(cel, "insert")){
      cin>>in;
      insert(in);
    }
    else if(!strcmp(cel, "print")){
      Inorder(root);
      cout<<endl;
      Preorder(root);
      cout<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 26508
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> // Include for built in treap
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
const int MOD = 1e9 + 7;
#define ll long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define in insert
#define ff first
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define si set<int>
#define mpii map<int, int>
#define prq priority_queue
#define sz(s) (int) s.size()
#define pf(a) printf("%d ",a)
#define si1(a) scanf("%d",&a)
#define si2(a,b) scanf("%d%d",&a,&b)
#define si3(a,b,c) scanf("%d%d%d",&a,&b,&c)
//#define scan(v) for(int i = 0; i<n; i++){int x;cin>>x;v.pb(x);}
#define pi 2 * acos (0.0)
#define inf 1e9
#define dbg cout<<"___________ok____________"<<endl;
#define yes() puts("YES");
#define no() puts("NO");
#define FOR(i, j, k) for(int i=(j); i<(k); i++)
#define REV(i, j, k) for(int i=(n-1); i>=k; i--)
#define all(v) v.begin(), v.end()
#define rnd(a, b) ((((rand()<<15)^rand())%((b)-(a) + 1))+(a))
#define FAST_IO ios_base::sync_with_stdio(false),cin.tie(NULL)
#define mem(x, y) memset(x, y, sizeof(x))
//typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_ds;
const double EPS = 1e-9;
const int MXX = 4e5 + 5;


int main()
{
    FAST_IO;
    string s;cin>>s;
    if(s == "zyxwvutsrqponmlkjihgfedcba")cout<<-1<<endl;
    else
    {
        if(sz(s)<26)
        {
            map<char, int>mp;
            for(int i = 0; i<sz(s); i++)mp[s[i]]=1;
            for(char i = 'a' ; i<='z'; i++)if(!mp[i])return cout<<s<<i<<endl, 0;
        }
        else
        {
            string t = s;
            do
            {
                if(s == t)continue;
                for(int i = 0; i<sz(t); i++)
                {
                    cout<<t[i];
                    if(s[i]!=t[i])return 0;
                }
            }while(next_permutation(all(t)));
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
set<string>st;
map<string,ll>dp;
ll mod = 1e9+7;
string c[] = {"A","C","G","T"};
bool check(string s){
    if(s.substr(0,3) == "AGC" or s.substr(1,3) == "AGC")return false;
    rep(i,3){
        string ss = s;
        swap(ss[i],ss[i+1]);
        if(ss.substr(0,3) == "AGC" or ss.substr(1,3) == "AGC")return false;
    }
    return true;
}
int main(){
    int n;
    cin >> n;
    rep(i,4)rep(j,4)rep(k,4){
        string s = c[i] + c[j] + c[k];
        if(s != "AGC" and s!=  "ACG" and s!= "GAC"){
            dp[s]++;
        }
    }
    rep(_,n-3){
        map<string,ll>ndp;
        rep(i,4){
            for(auto x:dp){
                string s = x.first + c[i];
                if(check(s)){
                    ndp[s.substr(1,3)] = (ndp[s.substr(1,3)]+x.second)%mod;
                }
            }
        }
        swap(ndp,dp);
    }
    ll ans = 0;
    for(auto x:dp){
        ans = (ans + x.second) % mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import copy
import itertools
r,g, b = map(int,input().split())
k = int(input())
#hl = list(map(int,input().split()))

lst = [r,g,b]
for v in itertools.product([0,1,2], repeat=k):
    tmplst = copy.deepcopy(lst)
    for i in v:
        tmplst[i] *= 2
    if tmplst[0] < tmplst[1] < tmplst[2]:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 9344
#include"iostream"

using namespace std;

char S[3];

int main() {
	bool A = false, B = false;
	for (int i = 0; i < 3; i++) {
		cin >> S[i];
		if (S[i] == 'A')A = true;
		if (S[i] == 'B')B = true;
	}
	if (!A || !B) { cout << "No" << endl; }
	else { cout << "Yes" << endl; }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll ceil(ll a, ll b) {  // a÷b以上の最小の整数
    if(b == 0) {
        return 0;
    }
    return (a+b-1)/b;
}

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

    vl x(5);
    rep(i, 5) {
        cin >> x[i];
    }
    sort(all(x));
    
    out(ceil(n, x[0]) + 4);
    re0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
int main(){
	priority_queue<int > q1;
	priority_queue<int > q2;
	int i=0;
	int w=0; //q1
	int k=0; //q2
	
	for(i=0;i<10;i++){
		cin>>w;
		q1.push(w);
	}
	for(i=0;i<10;i++){
		cin>>k;
		q2.push(k);
	}
	w=0;
	k=0;
	
	int x=0;
	int y=0;
	
	for(i=0;i<3;i++){
		x=q1.top();
		w+=x;
		q1.pop();
	}
	for(i=0;i<3;i++){
		y=q2.top();
		k+=y;
		q2.pop();
	}
	cout<<w<<" "<<k<<endl;
	
	return 0;
}
	
	

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

struct edge{
  ll from, to, cost;
  edge(){}
  edge(ll t, ll c){ to = t; cost = c;}
  edge(ll f, ll t, ll c){ from = f; to = t; cost = c;}
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M, r;
  cin >> N >> M >> r;
  vector<vector<edge>> G(N, vector<edge>(0));
  while(M--){
    int s, t, d;
    cin >> s >> t >> d;
    G.at(s).push_back(edge(t, d));
  }
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, r));
  vi ans(N, INT_INF);
  while(!que.empty()){
    int v = que.top().second;
    int c = que.top().first;
    que.pop();
    if(ans.at(v) < c) continue;
    ans.at(v) = c;
    for(int i = 0; i < sz(G.at(v)); i++){
      int next = G.at(v).at(i).to;
      int cost = G.at(v).at(i).cost;
      que.push(P(c+cost, next));
    }
  }
  for(auto x: ans){
    if(x == INT_INF) cout << "INF" << endl;
    else cout << x << endl;
  }
}


Measured memory_bytes: 24012
#include <iostream>
#include <string>
 
using namespace std;
 
int main(){

    int n;
    string s;

    cin >> n;
    cin >> s;

    int tmp = 0;

    for(int i = 0; i < n; i++){
        if(s[i] == 'R') tmp++;
    }

    if(tmp > n - tmp){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val l = sc.nextInt()
    val a = Array(n) { sc.nextInt() }
    val lst = mutableListOf<Int>()
    var s = -1
    for (i in 0 until n - 1) {
        if (a[i] + a[i + 1] >= l) {
            s = i + 1
            break
        }
    }
    if (s == -1) {
        println("Impossible")
        return
    }
    for (i in s until n) {
        lst.add(i)
    }
    for (i in s - 1 downTo 1) {
        lst.add(i)
    }
    lst.reverse()
    println("Possible")
    println(lst.joinToString("\n"))
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

int main() {
  int n,c = 0;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
    if(data.at(i) != i+1){
      c++;
    }
  }
  if(c > 2){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    string ans="";
    int j=0,i=0;
    for(i=0;i<b.size();i++){
        ans+=a[i];
        ans+=b[i];
    }
    if(a.size() != b.size()){
        ans += a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int cnt = sc.nextInt();
		int amount = sc.nextInt();
		int outCnt = 0;
		int min = 0;
		for(int i=0;i<cnt;i++) {
			int o = sc.nextInt();
			outCnt++;
			amount -= o;
			if(min > o || min == 0) min = o;
		}
		sc.close();
		outCnt += amount/min;
		System.out.println(outCnt);
	}
}

Measured memory_bytes: 22740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{

	static class FastReader {

		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) throws IOException {
		FastReader sc = new FastReader();
		char[][] a = new char[3][3];
		for (int i = 0; i < 3; i++) {
			a[i] = sc.nextLine().toCharArray();
		}
		System.out.println(a[0][0]+""+a[1][1]+""+a[2][2]);
	}
}

Measured memory_bytes: 21332
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;
            var t = cin.Read;

            char[] sAry = s.ToCharArray();
            char[] tAry = t.ToCharArray();

            Array.Sort(sAry);
            Array.Sort(tAry);
            Array.Reverse(tAry);

            string sSorted = new string(sAry);
            string tSorted = new string(tAry);

            //WriteLine(sSorted);
            //WriteLine(tSorted);

            if (String.Compare(sSorted, tSorted) < 0) WriteLine("Yes");
            else WriteLine("No");

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13652
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define      inl(x)              scanf("%lld",&x)
#define      in(x)               scanf("%d",&x)
#define      mxx                 10000000000000
#define      mnn                 -10000000000000
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      max_4(a,b,c,d)      max(a,max(b,max(c,d)))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      min_4(a,b,c,d)      min(a,min(b,min(c,d)))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      O(x)                cout<<x<<endl
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      EMB                 emplace_back
#define      MP                  make_pair
#define      PII                 pair<int,int>
#define      MII                 map<int,int>
#define      InTheNameOfGod      ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;//*(x.find_by_order(i)),x.order_of_key(k)
const ll MOD = 998244353;
//auto it=std:: unique(v.B,v.E);
//v.resize(std::distance(v.B,it));
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cout<<a<<endl;
#define bug2(a,b)  cout<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cout<<a<<" "<<b<<" "<<c<<endl;
/*----*/
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
ll binpow(ll a, ll b){ll res = 1;while (b > 0) {if (b & 1)res*=a;a*=a;b>>=1;}return res;}
ll fact(ll num){ll fac=1;while(num!=1){fac=fac*num;num--;}return fac;}
string to_binary(int x) {string s;while(x > 0) {s += (x % 2 ? '1' : '0');x /= 2;}reverse(s.begin(), s.end());return s;}
ll nsum(ll num){return (num*(num+1))/2;}
/*-----*/
const int N=2e5+5;

/*-----*/
//vector<int> v[202];

/*-----*/
int main(){
   InTheNameOfGod

       ll test=1;
       //cin>>test;
       while(test--){
           int n;
           string s;
           cin>>n;
           int bal=n%1000;
           int dh=1000-bal;
           if(bal==0) dh=0;
           cout<<dh<<endl;
        }
	loser;
}
///////LeArN MoRe AnD Wait FoR ThE Result///////


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;


const int INF = 1001001001;


int main() {
    int n;
    cin >> n;
    vector<int> a(3), b(3);
    rep(i, 3) cin >> a[i];
    rep(i, 3) cin >> b[i];
    vector<ll> dp(n+1, 0);
    rep(i, 3) rep(j, n+1) {
        if (j + a[i] <= n) dp[j+a[i]] = max(dp[j+a[i]], dp[j] + b[i]-a[i]);
    }

    ll m = n;
    rep(i, n+1) m = max(m, dp[i]+n);

    dp.clear();
    dp.resize(m+1, 0);
    rep(i, 3) rep(j, m+1) {
        if (j + b[i] <= m) dp[j+b[i]] = max(dp[j+b[i]], dp[j] + a[i] - b[i]);
    }

    ll ans = m;
    rep(i, m+1) ans = max(ans, dp[i]+m);
    
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 195584
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
   string s;
   cin>>s;
   if(s[0]=='A'){
      cout<<'T'<<endl;
   }else if(s[0]=='T'){
      cout<<'A'<<endl;
   }else if(s[0]=='C'){
      cout<<"G"<<endl;
   }else{
      cout<<"C"<<endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int s;
	cin >> s;
	if(s>999){
		cout << "ABD" << endl;
    }else{
		cout << "ABC" << endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int H, W; cin >> H >> W;
    char C[W];
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) cin >> C[j];
        for(int j = 0; j < W; j++) cout << C[j];
        cout << endl;
        for(int j = 0; j < W; j++) cout << C[j];
        cout << endl;
    }
}

Measured memory_bytes: 256
import itertools

n_len, n_max, q = map(int, input().split())
qs = []
for i in range(q):
    qs.append(tuple(map(int, input().split())))

ans = 0
for seq in itertools.combinations_with_replacement(range(1, n_max+1), n_len):
    point_tmp = 0
    for a, b, c, d in qs:
        if(seq[b-1]-seq[a-1] == c):
            point_tmp += d
            # print(seq, b-1, a-1, c, ans)
    ans = max(ans, point_tmp)
print(ans)


Measured memory_bytes: 9204
#include<cstdio>
using namespace std;
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==b) printf("Draw\n");
    else if((a!=1)&&(b!=1))
    {
        if(a>b) printf("Alice\n");
        else printf("Bob\n");
    }
    else if(a==1) printf("Alice\n");
    else printf("Bob\n");
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
#define endl "\n";
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define POSITIVE_INFINITY 9223372036854775807
#define NEGATIVE_INFINITY -9223372036854775807
#define MOD 1000000007

int main()
{
    FASTER;
    int cnt = 0;
    string str;
    cin >> str;
    
    for (int i = 0; i < str.size(); i++){
        if (str[i] == '2')
            cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}


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



int main(){
	string s;
	cin>>s;
	for(auto it=s.begin();it!=s.end();it++){
		if(*it=='S'&&*(it+1)=='T'){
			s.erase(it);
			s.erase(it);
			it=it-2;
		}
	}
	cout<<s.size();
	
	return 0;
} 

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define  rep(i,a,b) for(i=a;i<b;i++)
#define endl "\n"
#define ll long long int
#define ld long double
using namespace std;
int main()
{
IOS;
ll n,k,q,i;
cin>>n>>k>>q;
ll d=k-q;
ll a[q],b[n];
rep(i,0,q)
cin>>a[i];
if(k>q)
{
    rep(i,0,n)
    cout<<"Yes"<<endl;
}
else
{
    rep(i,0,n)
    b[i]=d;
    rep(i,0,q)
    b[a[i]-1]++;
    rep(i,0,n)
    {
        if(b[i]>0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}
return 0;
}



Measured memory_bytes: 2176
#pragma GCC optimize("Ofast")
#include<iostream>
#include<string>

using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int a[200000],n,b;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    REP(i,n)cin>>a[i];
    REP(i,n)b^=a[i];
    REP(i,n){cout<<(a[i]^b)<<"\n";}
    return 0;
}

Measured memory_bytes: 4344
n = int(input())
a = [0 for i in range(n)]
a[0] = int(input())
max = a[0]
max2 = 0
for i in range(1,n):
    a[i] = int(input())
    if  a[i] >= max:
        max2 = max
        max = a[i]
    elif a[i] >= max2:
        max2 = a[i]
for i in range(n):
    if a[i] == max:
        print(max2)
    else:
        print(max)

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

using namespace std;
typedef long long LL;

#define MAXN 301
#define mod 1000000007

char S[MAXN];
int N;
int dp[MAXN][MAXN][MAXN];

void print(int k) {
    string tmp(S);
    for (int len = 1; len <= N; len++) {
        for (int i = 0; i + len - 1 < N; i++) {
            int j = i + len - 1;
            printf("dp[%d][%d][%d] = %d, %s\n", k, i, j, dp[k][i][j], tmp.substr(i, len).c_str());
        }
    }
    printf("\n");
}

void f(int k) {
    for (int i = 0; i < N; i++) {
        dp[k][i][i] = 1;
    }

    for (int len = 2; len <= N; len++) {
        for (int i = 0; i + len - 1 < N; i++) {
            int j = i + len - 1;
            if (S[i] == S[j]) {
                if (len == 2) {
                    dp[k][i][j] = 2;
                } else {
                    dp[k][i][j] = dp[k][i + 1][j - 1] + 2;
                }
            } else {
                if (k == 0) {
                    if (len == 2) {
                        dp[k][i][j] = 1;
                    } else {
                        dp[k][i][j] = max(dp[k][i + 1][j - 1], max(dp[k][i][j - 1], dp[k][i + 1][j]));
                    }
                } else {
                    if (len == 2) {
                        dp[k][i][j] = 2;
                    } else {

                        dp[k][i][j] = max(dp[k - 1][i + 1][j - 1] + 2, max(dp[k][i][j - 1], dp[k][i + 1][j]));
                    }
                }
            }
        }
    }
}

int main() {
#ifdef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    //    freopen("output.txt", "wt", stdout);
#endif

    scanf("%s", S);
    N = strlen(S);

    int K;
    scanf("%d", &K);

    for (int i = 0; i <= K; i++) {
        f(i);
    }

    //    print(0);
    //    print(1);
    int ans = dp[K][0][N - 1];
    //    for (int i = 0; i <= K; i++)
    //        ans = max(ans, dp[i][0][N - 1]);

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 106752
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++)
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    int dp[n][3]={};
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    printf("%d\n",max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}));
    return 0;
}

Measured memory_bytes: 2560
// 素数判別プログラム
#include <stdio.h>
#include <math.h>
#include <stdbool.h>

bool sosuu_judge(double *amem)
{
    if(*amem == 2) return true;

    if(*amem < 2 || fmod(*amem, 2) == 0.0) return false;

    double n, i = 3;
    while(i <= (n = sqrt(*amem)) ){
        if(fmod(*amem, i) == 0.0)
            return false;
        i = i + 2;
    }
    return true;
}


int main(void)
{
    int n, i;
    scanf("%d", &n);
    
    double array[n];
    int cnt = 0;
    bool judge;
    for(i=0; i<n; i++){
        scanf("%lf", &array[i]);
        judge = sosuu_judge(&array[i]);
        if(judge){
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 2016
def main():
    H, W, M = map(int, input().split())
    bomb_row = [0 for _ in range(H)]  # 爆弾が何行目に何個あるか
    bomb_column = [0 for _ in range(W)]  # 爆弾が何列目に何個あるか
    bomb_map = set()  # 爆弾がどこにあるか

    for _ in range(M):
        r, c = map(int, input().split())
        bomb_row[r - 1] += 1
        bomb_column[c - 1] += 1
        bomb_map.add((r - 1, c - 1))

    max_row = max(bomb_row)  # 行ごとに見て最も多い爆弾の個数
    max_column = max(bomb_column)  # 列ごとに見て最も多い爆弾の個数
    ans = max_row + max_column

    bomb_max_row = []  # 爆弾がmax_row個ある行
    bomb_max_column = []  # 爆弾がmax_column個ある列

    for i in range(H):
        if bomb_row[i] == max_row:
            bomb_max_row.append(i)
    for i in range(W):
        if bomb_column[i] == max_column:
            bomb_max_column.append(i)

    for r in bomb_max_row:
        for c in bomb_max_column:
            if (r, c) not in bomb_map:  # 最多行と最多列の交点に爆弾が無ければ終了
                print(ans)
                return

    print(ans - 1)  # 最多行と最多列の交点に爆弾があればans - 1


if __name__ == "__main__":
    main()


Measured memory_bytes: 83568
#include <bits/stdc++.h>
using namespace std;
long long sum(long long x)
{
    long long ans=0;
    while(x>0)
    {
        ans+=x%10;
        x=x/10;
    }
    return ans;
}
int main()
{
    long long n;
    cin>>n;
    long long d=sum(n);
    if(n%d==0)
    {
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}


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

check=t[0]+k
kyaku=1
ans=1
for i in range(1,n):
    if t[i]<=check and kyaku<c:
        kyaku+=1
        continue
    check=t[i]+k
    kyaku=1
    ans+=1
print(ans)
    


Measured memory_bytes: 7384
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    scanf("%d",&N);
    if(N==1){cout<<1<<endl;return 0;}
    else if(N<4){cout<<2<<endl;return 0;}
    else if(N<8){cout<<4<<endl;return 0;}
    else if(N<16){cout<<8<<endl;return 0;}
    else if(N<32){cout<<16<<endl;return 0;}
    else if(N<64){cout<<32<<endl;return 0;}
    else{cout<<64<<endl;return 0;}
    
    return 0;
}


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

using namespace std;

const int Z = 1e9+7;

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

    int n;
    cin >> n;
    int c[n];
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    sort(c, c+n);

    int pow2[n+1];
    for (int i = 0; i <= n; i++) {
        pow2[i] = i == 0 ? 1 : 2 * pow2[i-1] % Z;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = (ans + (1ll * (n - 1 - i) * pow2[n-2] + pow2[n-1]) % Z * c[i]) % Z;
    }

    ans = 1ll * ans * pow2[n] % Z;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/algorithm>
#include <ext/numeric>
#define endl '\n'
using namespace std;
using namespace __gnu_cxx;

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

/**************************************************************/

	int N;
	cin >> N;
	pair<int,int> array[N];

	int count;
	for(int i = 0; i < N; i++)
	{
		cin >> count;
		array[i] = {count,i};
	}

	sort(array, array+N);
	count = 0;
	for(int i = 0; i < N; i++)
		if(i%2 != array[i].second%2)
			count++;

	cout << (count >> 1) << endl;
}

Measured memory_bytes: 1152
import java.util.Scanner;

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

        int k = sc.nextInt();
        if (k % 2 == 0)
            System.out.println((k / 2) * (k / 2));
        else
            System.out.println(((k / 2) + 1) * (k / 2));
    }
}

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

int main(){
 ll n,m,sum=0; cin >> n >> m;
 if(n==1 && m==1){
    cout << 1 << endl;
    return 0;
  }
  else if(n!=1 && m==1){
    cout << n-2 << endl;
  }
  else if(n==1 && m!=1){
    cout << m-2 << endl;
  }
  else{
    cout << (n-2)*(m-2) << endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

int main(){
	int n;
	int dp[305][305];
	while(cin >> n, n){
		vector<int> a(n);
		cin >> a;

		rep(i,n) rep(j,n) dp[i][j] = 0;

		range(w,2,n + 1){
			rep(i,n){
				int j = i + w - 1;
				if(j > n) break;
				if(abs(a[i] - a[j]) <= 1 and dp[i + 1][j - 1] + 2 == w){
					dp[i][j] = w;
				}
				range(k,i,j){
					dp[i][j] = max(dp[i][j], dp[i][k] + dp[k + 1][j]);
				}
			}
		}
		cout << dp[0][n - 1] << endl;
	}
}



Measured memory_bytes: 3464
import Control.Arrow
import Data.Char
import Data.List

main :: IO ()
main = do
  _ <- getInt
  s <- getString
  print . maximum . map (length . uncurry intersect) . map (unique *** unique) $ zip (inits s) (tails s)

getInt :: IO Int
getInt = read <$> getLine

getString :: IO String
getString = getLine

unique :: Ord a => [a] -> [a]
unique = map head . group . sort


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 1e18

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin >> v[i];
    int dp[n][k+1],cum[n][k+1];
    for(int i=0;i<=v[0];i++)
        dp[0][i]=1;
    for(int i=v[0]+1;i<=k;i++)
        dp[0][i]=0;
    int t=0;
    for(int i=0;i<=k;i++)
    {
        t+=dp[0][i];
        cum[0][i]=t;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            int l=max(0,j-v[i]),r=j;
            int ans=(cum[i-1][r]*1LL-cum[i-1][l]+dp[i-1][l])%mod;
            ans=(ans+mod)%mod;
            dp[i][j]=ans;
        }
        t=0;
        for(int w=0;w<=k;w++)
        {
            t=(t*1LL+dp[i][w])%mod;
            cum[i][w]=t;
        }
    }
    cout << dp[n-1][k] << endl;
}

Measured memory_bytes: 78336
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int digitsum(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main()
{
	int n; cin >> n;
	int min = 1000000;
	for (int i = 1; i < n; i++) {
		int ds = 0;
		ds = digitsum(n - i) + digitsum(i);
		if (ds < min) min = ds;
	}
	cout << min << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int n,max,min,i,a;
  long int sum=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){

    scanf("%d%",&a);

    if(i==0){ max=a; min=a; }

    if(max<a) max = a;
    if(min>a) min = a;

    sum+=a;
  }

  printf("%d %d %ld\n",min,max,sum);

  return 0;
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5000*5000+5;
int n,a,b,c,d,e,f,ma,dp[N];
signed main()
{
	cin>>n;
	cin>>a>>b>>c>>d>>e>>f;
	memset(dp,-63,sizeof(dp));
	dp[0]=0;
	for(int i=a;i<=n;i++)
		dp[i]=max(dp[i],dp[i-a]+d);
	for(int i=b;i<=n;i++)
		dp[i]=max(dp[i],dp[i-b]+e);
	for(int i=c;i<=n;i++)
		dp[i]=max(dp[i],dp[i-c]+f);
	ma=n;
	for(int i=0;i<=n;i++)
		ma=max(ma,dp[i]+n-i);
	for(int i=d;i<=n;i++)
		dp[i]=max(dp[i],dp[i-d]+a);
	for(int i=e;i<=n;i++)
		dp[i]=max(dp[i],dp[i-e]+b);
	for(int i=f;i<=n;i++)
		dp[i]=max(dp[i],dp[i-f]+c);
	int ans=n;
	for(int i=0;i<=n;i++)
		ans=max(ans,dp[i]+n-i);
	memset(dp,-63,sizeof(dp));
	dp[0]=0;
	n=ma;
	for(int i=d;i<=n;i++)
		dp[i]=max(dp[i],dp[i-d]+a);
	for(int i=e;i<=n;i++)
		dp[i]=max(dp[i],dp[i-e]+b);
	for(int i=f;i<=n;i++)
		dp[i]=max(dp[i],dp[i-f]+c);
	ans=max(ans,n);
	for(int i=0;i<=n;i++)
		ans=max(ans,dp[i]+n-i);
	cout<<ans;
}

Measured memory_bytes: 195712