akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int size = scanner.nextInt();
		Graph[] graphs = new Graph[size]; 
		for (int i = 0; i < size; i++) {
			int id = scanner.nextInt();
			int num = scanner.nextInt();
			graphs[i] = new Graph(size);
			for (int j = 0; j < num; j++) {
				graphs[i].tmpElement(scanner.nextInt() - 1);
			}
		}
		
		for (Graph graph : graphs) {
			System.out.println(graph.print());
		}
	}
}
class Graph {
	/** ?????????????????????????????§?????? */
	public int[] iArrays;
	
	/** ??°??????????????¨???StringBuilder??§?????? */
	StringBuilder stringBuilder = new StringBuilder();
	
	public Graph(int size) {
		iArrays = new int[size];
		for (int i = 0; i < size; i++) {
			iArrays[i] = 0;
		}
	}
	
	/** ????´??????\??????????????? */
	public void tmpElement(int e) {
		iArrays[e] = 1;
	}
	
	/** ??°??????????????????????????? */
	public String print() {
		int i = 0;
		for (i = 0; i < iArrays.length - 1; i++) {
			stringBuilder.append(iArrays[i] + " ");
		}
		stringBuilder.append(iArrays[i]);
		return stringBuilder.toString();
	}
}

Measured memory_bytes: 31828
#include <stdio.h>

#define X 1000

int main(void){
  int m[X],f[X],r[X],g[X];
  char result[X];
  int i = 0;
  int j;

  while(1){
    scanf("%d %d %d", &m[i], &f[i], &r[i]);
    g[i] = m[i] + f[i];

    if(m[i] == -1 && f[i] == -1 && r[i] == -1){
      break;
    }
    i++;
  }

  for(j = 0; j < i; j++){
    if(m[j] == -1 || f[j] == -1){
      printf("F\n");
    }
    else if(g[j] >= 80){
      printf("A\n");
    }
    else if(g[j] >= 65 && g[j] < 80){
      printf("B\n");
    }
    else if(g[j] >= 50 && g[j] < 65){
       printf("C\n");
    }
    else if(g[j] >= 30 && g[j] < 50 && r[j] >= 50){
      printf("C\n");
    }
    else if(g[j] >= 30 && g[j] < 50 && r[j] < 50){
       printf("D\n");
    }

    else if(g[j] < 30){
       printf("F\n");
    }

  }

  return 0;
}

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

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    for(int i = 0; i < N; ++i)
        cin >> A[i];
    static ll dp[42][2];
    fill(dp[0], dp[42], -1);
    dp[41][0] = 0;
    for(int i = 40; i >= 0; --i) {
        ll b = 1LL << i;
        int cnt = 0;
        for(int j = 0; j < N; ++j)
            if(A[j] & b)
                cnt++;
        if(dp[i + 1][1] >= 0) {
            int s = max(cnt, N - cnt);
            dp[i][1] = max(dp[i][1], dp[i + 1][1] + b * s);
        }
        if(dp[i + 1][0] >= 0) {
            if(K & b) {
                dp[i][1] = max(dp[i][1], dp[i + 1][0] + b * cnt);
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + b * (N - cnt));
            } else
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + b * cnt);
        }
    }
    cout << max(dp[0][0], dp[0][1]) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if((long)a * b <= 0){
    cout << "Zero" << endl;
  }else if(a > 0){
    cout << "Positive" << endl;
  }else{
    cout << ((b - a) % 2 == 0 ? "Negative" : "Positive") << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string N;
    string seven = "7";
    cin >> N;
    
    if(N.find(seven) == string::npos){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    string s[n];
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, n) {
        cin >> s[i];
        if (s[i] == "AC")
            ac++;
        else if (s[i] == "WA")
            wa++;
        else if (s[i] == "TLE")
            tle++;
        else
            re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 6752
//c++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define sz(x) ((int)(x).size())

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const int INF = 1 << 30;//10^9
const ll MOD = 1000000007;
//const ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A){printf("%.9lf\n", A);}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};


//コンビネーション
const int MAXcomb = 2000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 500010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}

ll disit(ll s, ll base = 10){
  ll res = 0;
  while(s){
    res++;
    s /= base;
  }
  return res;
}

void solve(){
  ll a;
  cin >> a;
  string b;
  cin >> b;
  int p = -1;
  for(int i = 0; i < b.size(); i++){
    if(b[i] == '.'){
      p = b.size() - i - 1;
    }
  }
  if(p == -1){
    ll c = stoi(b);
    cout << a * c << endl;
    return;
  }
  string B = b.substr(0, b.size() - p - 1) + b.substr(b.size() - p, p);
  ll c = stoi(B);
  cout << a * c / pow_long(10, p) << endl;
}


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


Measured memory_bytes: 3596
import sys

n=int(input())
l=list(map(int,input().split()))

if 0 in l:
	print(0)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)

Measured memory_bytes: 21588
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
      
      	if (A <= X && X <= A + B ){
        	System.out.println("YES");
        } else{
          System.out.println("NO");
          }
     
        
      
      
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
const int N = 305;

char s[N][N];
int h,w,k,row[N],ans[N][N];

int main() {
	scanf("%d%d%d",&h,&w,&k);
	rep(i,1,h) scanf("%s",s[i]+1);
	rep(i,1,h) rep(j,1,w) row[i] += (s[i][j]=='#');
	row[h+1] = 1;
	
	int cnt = 1;
	rep(i,1,h){
		int i2 = i, ii;
		while(row[i2]==0) i2++;
		ii = i2, i2++;
		while(row[i2]==0) i2++;
		i2--;
		rep(u,1,w){
			rep(v,i,i2) ans[v][u] = cnt;
			if(s[ii][u]=='#') ++cnt;
		}
		rrep(u,w,1){
			if(s[ii][u]=='#') break;
			rep(v,i,i2) ans[v][u]--;
		}
		
		i = i2;
	}
	
	rep(i,1,h) rep(j,1,w) printf("%d%c",ans[i][j],j==w?'\n':' ');
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
static const int MAX= 20;
char map[MAX][MAX];

int main() {
    int W, H, sx, sy, nx, ny, sum;
    int dx[4] = {0, 0, -1, 1};
    int dy[4] = {-1, 1, 0, 0};
    for (; ;) {
        std::cin >> W >> H;
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                std::cin >> map[i][j];
                if (map[i][j] == '@') sx = i, sy =j;
            }
        }
        std::queue<std::pair<int, int> > q;
        q.push({sx, sy});
        map[sx][sy] = '*';
        while ( !q.empty() ) {
            std::pair<int, int> p = q.front(); q.pop();
            for (int i = 0; i < 4; i++) {
                nx = p.first + dx[i], ny = p.second + dy[i];
                if (0 <= nx && nx < H && 0 <= ny && ny < W && map[nx][ny] == '.') {
                    map[nx][ny] = '*';
                    q.push({nx, ny});
                }
            }
        }
        sum = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) if (map[i][j] == '*') sum++;
        }
        std::cout << sum << std::endl;
    }


    return  0;
}



Measured memory_bytes: 3020
n = gets.to_i
x = gets.to_s
x = x.split(" ").map(&:to_i)
ans = true
x.each do |x|
  if (x % 2 == 0) then
    if (!(x % 3 == 0) && !(x % 5 == 0)) then
      ans = false
    end
  end
end

if ans then
  puts "APPROVED"
else
  puts "DENIED"
end


Measured memory_bytes: 1788
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int As;
int Bs;
int A[100000];
int B[100000];
int M;
int X[100000];
int Y[100000];
int C[100000];
int main(){
  int i;
  int res;
  rd(As);
  rd(Bs);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(As);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    for(e98WHCEY=(0);e98WHCEY<(Bs);e98WHCEY++){
      rd(B[e98WHCEY]);
    }
  }
  {
    int FmcKpFmN;
    for(FmcKpFmN=(0);FmcKpFmN<(M);FmcKpFmN++){
      rd(X[FmcKpFmN]);X[FmcKpFmN] += (-1);
      rd(Y[FmcKpFmN]);Y[FmcKpFmN] += (-1);
      rd(C[FmcKpFmN]);
    }
  }
  {
    int t_ynMSdg;
    int KrdatlYV;
    if(As==0){
      KrdatlYV = 0;
    }
    else{
      KrdatlYV = A[0];
      for(t_ynMSdg=(1);t_ynMSdg<(As);t_ynMSdg++){
        KrdatlYV = min_L(KrdatlYV, A[t_ynMSdg]);
      }
    }
    {
      int a2conNHc;
      int hCmBdyQB;
      if(Bs==0){
        hCmBdyQB = 0;
      }
      else{
        hCmBdyQB = B[0];
        for(a2conNHc=(1);a2conNHc<(Bs);a2conNHc++){
          hCmBdyQB = min_L(hCmBdyQB, B[a2conNHc]);
        }
      }
      res =KrdatlYV+hCmBdyQB;
    }
  }
  for(i=(0);i<(M);i++){
    chmin(res, A[X[i]] + B[Y[i]] - C[i]);
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200308-1

// --- original code ---
// int As, Bs, A[1d5], B[1d5], M, X[1d5], Y[1d5], C[1d5];
// {
//   int res;
//   rd(As, Bs, M, A(As), B(Bs), (X--, Y--, C)(M));
//   res = min(A(As)) + min(B(Bs));
//   rep(i,M) res <?= A[X[i]] + B[Y[i]] - C[i];
//   wt(res);
// }


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD   998244353
#define PI (acos(-1))
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    int H,W,K; cin>>H>>W>>K;
    bool ban[H][W]={};
    int ans[H][W];
    bool ichi[H]={};
    rep(i,H){
        rep(j,W){
            char c; cin>>c;
            if(c=='#') {
                ban[i][j]=true;
                ichi[i]=true;
            }
        }
    }
    rep(i,H){
        rep(j,W){
            ans[i][j]=-1;
        }
    }
    bool noichi=true;
    int now=0;
    rep(i,H){
        if(ichi[i]==false) continue;
        if(true){
            rep(j,W){
                if(ban[i][j]==true){
                    int k=j;
                    ++now;
                    while(k!=-1 and ans[i][k]==-1){
                        ans[i][k]=now;
                        --k;
                    }
                }
                if(j==W-1){
                    int k1=j;
                    while(ans[i][k1]==-1){
                        ans[i][k1]=now;
                        --k1;
                    }
                }
            }
        }

        if(noichi==true){
            noichi=false;
            int i2=i-1;
            while(i2!=-1 and ichi[i2]==false){
                rep(j,W){
                    ans[i2][j]=ans[i2+1][j];
                }
                --i2;
            }
        }
    }

    rep(i,H){
        rep(j,W){
            if(ans[i][j]==-1){
                ans[i][j]=ans[i-1][j];
            }
        }
    }

    rep(i,H){
        rep(j,W){
            cout<< ans[i][j]<<" ";
        }
        cout<<"\n";
    }

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

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

    while(1){
        if(s.at(i)!='1'){
            cout << s.at(i) << endl;
            break;
        }
        else{
            i++;
            if(k==i){
                cout << 1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3624
S = input()
N = len(S)

# 0101...にする場合
cnt1 = 0
for i in range(len(S)):
    if S[i] != str(i % 2):
        cnt1 += 1

# 1010...にする場合
cnt2 = 0
for i in range(len(S)):
    if S[i] != str((i + 1) % 2):
        cnt2 += 1

print(min(cnt1, cnt2))


Measured memory_bytes: 9112
n = int(input())
a = list(map(int,input().split()))
count = 0
ans = 0
i = 0

while i < n-1:
    if a[i] >= a[i+1]:
        count += 1
        i += 1
    else:
        i += 1
        count = 0

    if ans < count:
            ans = count

print(ans)


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

int a, b;
int ans=1;

void f(int x){
     for(int i=2;i*i<=x;i++){
          if(x%i==0){
               if(b%i==0)ans++;
               while(x%i==0)x=x/i;
          }
     }

     if(x!=1){
          if(b%x==0)ans++;
     }
}



int32_t main(){
     cin>>a>>b;
     f(a);
     cout<<ans;
     
}

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

int main() {
  int n; cin >>n;
  vector<int> w(n);
  int sub=0;
  for (int i=0; i<n; i++){
    cin >>w.at(i); sub += w.at(i);
  }
  int buf = sub;
  for (int i=0; i<n-1; i++){
    buf -= 2*w.at(i);
    if (sub*sub>buf*buf){
      sub = buf;
    }
  }
  int ans = max(sub, -sub);
  cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;


vector<vector<int> > V;

ll ami[102][9];
static const ll mod = 1000000007;

int main() {

    int H, W, K;
    cin >> H >> W >> K;

    vector<int> init;
    init.push_back(1);
    V.push_back(init);

    int cnt = 1;

    while (cnt < W) {

        vector<vector<int> > temp;

        for (int i = 0; i < V.size(); i++) {
            vector<int> v = V[i];
            v.push_back(cnt+1);
            
            temp.push_back(v);
            if (v[cnt-1] != cnt) {
                continue;
            }
            else {
                swap(v[cnt], v[cnt-1]);
                temp.push_back(v);
            }
        }
        cnt++;
        V = temp;
    }
    /*
    for (int i = 0; i < V.size(); i++) {
        for (int j = 0; j < V[i].size(); j++) {
            cout << V[i][j] << ' ';
        }
        cout << '\n';
    }
    */

    ami[0][1] = 1;
    for (int h = 0; h < H; h++) {

        for (int w = 1; w <= W; w++) {
            if (ami[h][w] == 0)
                continue;
            for (int i = 0; i < V.size(); i++) {
                ami[h+1][V[i][w-1]] += ami[h][w];
                ami[h+1][V[i][w-1]] %= mod;
            }
        }
    }

    cout << ami[H][K] << '\n';

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll pow(ll a, ll x, ll p){
  	ll tmp=1;
  	while(x>0){
    	if(x%2 == 1){
          	tmp = (a*tmp)%p;
        }
      	a = (a*a)%p;
      	x /= 2;
    }
  	return(tmp);
}

ll inv(ll a, ll p){
  	return pow(a,p-2,p);
}

ll factorial(ll n, ll p){
  	ll res = 1;
  	for(ll i=1;i<=n;i++){
      	res = (res*i)%p;
    }
  	return res;
}

/*
ll combination(ll n, ll r, ll p){
    ll res=1;
  	ll tmp1 = fact.at(n);
  	ll tmp2 = fact.at(n-r);
  	ll tmp3 = fact.at(r);
  	res = ( ( (tmp1 * inv(tmp2,p) ) % p) * inv(tmp3,p) ) % p;
  	return res;
}
*/

ll combination(ll n, ll r, ll p){
  ll ans = 1;
  for(ll i=1;i<=r;i++){
    ll x = (n+1-i)*inv(i,p) % p;
    ans = (ans * x) % p; 
  }
  return(ans);
}

int main(){
  	ll p=1e9+7;
  	ll n,b,r;
	cin >> n >> b;

  	r = n-b;
  	
  	for(ll i=1;i<=b;i++){
      cout << (combination(r+1,i,p)*combination(b-1,i-1,p))%p << endl;
    }
  	
  	
    return(0);
}

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

using namespace std;

int main() {
    int N;
    long long int C, K;
    cin >> N >> C >> K;

    vector<long long int> T(N);
    for(int n=0; n<N; n++) {
        cin >> T[n];
    }
    
    sort(T.begin(), T.end());
    long long int ans=0;
    long long int cnt=0;
    long long int cur=T[0];
    for(int n=0; n<N; n++) {
        if(T[n]-cur<=K && cnt<C) {
            cnt++;
            if(n==N-1) {
                ans++;
            }
        } else {
            ans++;
            cur=T[n];
            cnt=1;
            if(n==N-1) {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int []A = new int[N+10];
		int []B = new int[N+10];
		int []C = new int[N+10];
		int []D = new int[N+10];
		int ans =0;
		
		for(int i=0; i<N; i++){
			A[i] = sc.nextInt();
		}
		B[0]=0;
		B[1]=Math.abs(A[0]-A[1]);
		for(int i=0; i<N; i++){
			C[i] = B[i]+Math.abs(A[i+2]-A[i]);
			D[i] = B[i+1]+Math.abs(A[i+2]-A[i+1]);
			if(D[i]>C[i]){
				B[i+2] = C[i];
			} else {
				B[i+2] = D[i];
			}
		}
			System.out.println(B[N-1]);
	}
}

Measured memory_bytes: 62208
#ifdef LOCAL111
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

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

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

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

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

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<LL> a(n);
		REP(i, n) cin >> a[i];
		multiset<int> dp;
		REP(i, n) {
			DEBUG(i);
			if(dp.empty() || *dp.begin() >= a[i]) {
				dp.insert(a[i]);
			} else {
				int v = *(--dp.lower_bound(a[i]));
				
				dp.erase(dp.find(v));
				dp.insert(a[i]);
			}
			dpite(ALL(dp));
		}
		cout << dp.size() << endl;
	}
	return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int ans=0,a,b,c,X;
	cin >> a >> b >> c >> X;
	for(int x=0;x<=a;x++){
		for(int y=0;y<=b;y++){
			for(int z=0;z<=c;z++){
				if((x*500+y*100+50*z)==X)	ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <math.h>
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
 
 
/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);
 
/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/
 
/*void print1(vector <int> X)
{
    for (int i=0; i<X.size(); i++)
    {
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return;
}
 
void print2(vector <vector <int>> X)
{
    for (int i=0; i<X.size(); i++)
    {
    for (int j=0;j<X[i].size();j++) {
        cout<<X[i][j]<<" ";}
    cout<<endl;}
    return;
}*/

pair <double,double> koo(int a, double kam) {
	double x=sin(kam);
	double y=cos(kam);
	return {a*x,a*y};
	}

double dis(pair <double,double> u, pair <double,double> v) {
	return sqrt((u.first-v.first)*(u.first-v.first)+(u.second-v.second)*(u.second-v.second));
	}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double p=3.14159265358979323846;
    double kam1=30*h+0.5*m;
    kam1=kam1*(p/180);
    double kam2=m*p/30;
    pair <double,double> u=koo(a,kam1);
    pair <double,double> v=koo(b,kam2);
    cout<<setprecision(11)<<dis(u,v)<<endl;
    return 0;
}


Measured memory_bytes: 4104
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1

#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>
#include <ctime>

#define MOD 1000000007

const long long INF = 10000000000000000;

using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	vector<string> A(N),B(M);

	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	for(int i=0;i<M;i++){
		cin>>B[i];
	}
	for(int i=0;i<=N-M;i++){
		for(int j=0;j<=N-M;j++){
			bool flg=true;
			for(int k=0;k<M;k++){
				for(int l=0;l<M;l++){
					if(A[i+k][j+l]!=B[k][l]){
						//cout<<A[i+k][j+l]<<" "<<B[k][l]<<endl;
						flg=false;
						break;
					}
				}
			}
			if(flg){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  int cnt = 0;
  rep(i, n) {
    if (a[i]*m*4 >= sum)
      cnt++;
  }
  if (cnt >= m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
a=[int(i) for i in input().split()]

snuke=0
araiguma=sum(a)
ans=10**15

for i in range(N-2):
    snuke+=a[i]
    araiguma-=a[i]
    ans=min(ans,abs(snuke-araiguma))

if N==2:
    print(abs(a[0]-a[1]))
else:
    print(ans)

Measured memory_bytes: 24832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int d = sc.nextInt();
		int x[][] = new int[n][d];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < d; j++) {
				x[i][j] = sc.nextInt();
			}
		}

		int count = 0;
		for (int i = 0; i < n - 1; i++) {

			for (int j = i + 1; j < n; j++) {
				int dist = 0;
				for (int k = 0; k < d; k++) {
					dist += ((x[i][k] - x[j][k]) * (x[i][k] - x[j][k]));
				}
				int sqrt = (int)Math.sqrt(dist);
//				System.out.println("i:" + i + ", j:" + j);
//				System.out.println("s:" + sqrt + ", d:" + dist + ", s*s:" + (sqrt * sqrt));
				if (sqrt * sqrt == dist) {
					count++;
				}
			}
		}

		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 23764
# -*- coding: utf-8 -*-

n,t = map(int, input().split())

apple_price = list(map(int, input().split()))
price_diff = []
now_min = 10**9


for i in range(n):
    if(now_min > apple_price[i]):
        now_min = apple_price[i]
    else:
        price_diff.append(apple_price[i] - now_min)

if(price_diff):
    print(price_diff.count(max(price_diff)))
else:
    print(0)

Measured memory_bytes: 14252
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda AB: AB[1])

ans = 'Yes'
present_time = 0
for ab in AB:
  present_time += ab[0]
  dead_line = ab[1]
  if present_time > dead_line:
    ans = 'No'
    break

print(ans)

Measured memory_bytes: 53720
fn input<T: std::str::FromStr>() -> T
{
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().parse().ok().unwrap()
}
fn main() {
    let tem=input::<i32>();
	if tem>=30{
		println!{"Yes"};
	}else{
		println!{"No"};
	}
}

Measured memory_bytes: 2096
import copy
def isStable(n,n_old):
  for i in range(len(n)-1):
    for j in range(i+1,len(n),+1):
      for a in range(len(n)-1):
        for b in range(a+1,len(n),+1):
          if n[i][1]==n[j][1]:
            if n[i]==n_old[b] and n[j]==n_old[a]:
              return 'Not stable'
  return 'Stable'
  
m=int(input())
n=list(map(str,input().split()))
n_old=copy.deepcopy(n)

for i in range(m-1):
  for j in range(m-1,i,-1):
    if int(n[j][1])<int(n[j-1][1]):
      n[j],n[j-1]=n[j-1],n[j]

print(' '.join(map(str, n)))
print(isStable(n,n_old))

n=copy.deepcopy(n_old)

for i in range(len(n)-1):
  minj=i
  cnt=0
  for j in range(i+1,len(n)):
    if n[j][1]<n[minj][1]:
      minj=j
      cnt=1
  if cnt==1:
    n[i],n[minj]=n[minj],n[i]

print(' '.join(map(str, n)))
print(isStable(n,n_old))


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

int main() {
	//cout<<"GfG!";
	unsigned long long int h, w;
	cin>>h>>w;
	if (h > 1 && w > 1)
	{
    	if ((h*w) % 2 == 0)
	        cout<<((h*w) / 2);
    	else
	        cout<<((h*w)/2 + 1);
	}
	else
	    cout<<"1";
	return 0;
}

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

bool isMM(char s[]){
    if(s[0] == '0' || s[0] == '1'){
        int t = s[1] - '0';
        if(s[0] == '0' && 0 < t && t <= 9){
            return true;
        }else if(s[0] == '1' && 0 <= t && t <= 2){
            return true;
        }else{
            return false;
        }
    }else{
        return false;
    }
}

int main() {
    char s[4];
    cin >> s;
    char starts[2];
    char ends[2];
    starts[0] = s[0];
    starts[1] = s[1];
    ends[0] = s[2];
    ends[1] = s[3];
    if(isMM(starts)){
        if(isMM(ends)) {
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl;
        }
    }else{
        if(isMM(ends)){
            cout << "YYMM" << endl;
        }else{
            cout << "NA" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define TEST cout << "ococo" << endl;
using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for(int i = 0; i != n + 1; i++)cin >> a[i];
	vector<int> b(n);
	for(int i = 0; i != n; i++)cin >> b[i];
	
	long long count = 0;
	for(int i = 0; i != n; i++){
    int temp;
    if(a[i] <= b[i])temp = a[i];
    else temp = b[i];
    a[i] -= temp;
    b[i] -= temp;
    count += temp;
    //cout << b[i] << endl;

    if(b[i] != 0){
      if(a[i + 1] > b[i]){
        count += b[i];
        a[i + 1] -= b[i];
      }
      else{
        count += a[i + 1];
        a[i + 1] = 0;
      }
    }
    //cout << a[i] << endl;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1024
H, N = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(N)]

dp = [0]*(H+1)
for i in range(1, H+1):
  for j in range(N):
    if j == 0:
      if ls[j][0] <= i:
        dp[i] = dp[i-ls[j][0]] + ls[j][1]
      else:
        dp[i] = ls[j][1]    
    else:
      if ls[j][0] <= i:
        dp[i] = min([dp[i], dp[i-ls[j][0]] + ls[j][1]])
      else:
        dp[i] = min([dp[i], ls[j][1]])
        
print(dp[H]) 

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,k,ans=0;
    cin>>n>>k;
    if(k==0){cout<<n*n<<endl;return 0;}
    REP(i,k+1,n+1){
        ans += (n/i)*(i-k);
        ans += max(0ll,n%i-k+1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=998244353;
const ll INF=1000000010;
const ll LINF=1000000000000000010;
int dx[8]={0,0,1,1,1,-1,-1,-1};
int dy[8]={1,-1,1,-1,0,1,-1,0};
ll a[200010],sum[200010];
struct st{ll ma,mi;};
st rs[200010];
st pq[200010];
int main(){
    int n;cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum[i+1]+=sum[i]+a[i];
    }
    for(int i=2;i<n-1;i++){
        int ok=i;int ng=n;
        while(ng-ok>1){
            int mid=(ok+ng)/2;
            if(sum[mid]-sum[i]<sum[n]-sum[mid]){
                ok=mid;
            }else{
                ng=mid;
            }
        }
        ll s1=sum[ok]-sum[i];ll s2=sum[n]-sum[ok];ll s3=sum[ok+1]-sum[i];ll s4=sum[n]-sum[ok+1];
        if(abs(s2-s1)<abs(s3-s4)){
            rs[i].ma=max(s1,s2);
            rs[i].mi=min(s1,s2);
        }else{
            rs[i].ma=max(s3,s4);
            rs[i].mi=min(s3,s4);
        }
    }
    for(int i=2;i<n-1;i++){
        int ok=0;int ng=i-1;
        while(ng-ok>1){
            int mid=(ok+ng)/2;
            if(sum[mid]-sum[0]<sum[i]-sum[mid]){
                ok=mid;
            }else{
                ng=mid;
            }
        }
        ll s1=sum[ok]-sum[0];ll s2=sum[i]-sum[ok];ll s3=sum[ok+1]-sum[0];ll s4=sum[i]-sum[ok+1];
        if(abs(s2-s1)<abs(s3-s4)){
            pq[i].ma=max(s2,s1);
            pq[i].mi=min(s1,s2);
        }else{
            pq[i].ma=max(s4,s3);
            pq[i].mi=min(s4,s3);
        }
    }
    ll ans=LINF;
    for(int i=2;i<n-1;i++){
        ans=min(max(pq[i].ma,rs[i].ma)-min(pq[i].mi,rs[i].mi),ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
char s[100005];
vector<int> v;
int cnt=1; 
int main()
{
	scanf("%s",s);
	for(int i=1;s[i];i++)
	{
		if(s[i]==s[i-1])
		{
			++cnt;
		}else
		{
			v.push_back(cnt);
			cnt=1;
		}
	}
	v.push_back(cnt);
	printf("%d",v.size()-1);
}


Measured memory_bytes: 4024
package main

import (
	"fmt"
)

func main() {
	var b string
	fmt.Scan(&b)

	if b == "A" {
		fmt.Println("T")
	} else if b == "C" {
		fmt.Println("G")
	} else if b == "G" {
		fmt.Println("C")
	} else if b == "T" {
		fmt.Println("A")
	}
}

Measured memory_bytes: 512
#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>


template <class Abelian> class PotentializedUnionFind {

public:
	using value_type = Abelian;
	using difference_type = std::ptrdiff_t;
	using container_type = std::vector<std::pair<difference_type, value_type>>;
	using size_type = typename container_type::size_type;

protected:
	container_type c;

private:
	value_type potential(size_type x) {
		value_type ret = {};
		while (c[x].first >= static_cast<difference_type>(0)) {
			if (c[static_cast<size_type>(c[x].first)].first >=
				static_cast<difference_type>(0)) {
				c[x].second =
					c[static_cast<size_type>(c[x].first)].second + c[x].second;
				c[x].first = c[static_cast<size_type>(c[x].first)].first;
			}
			ret = ret + c[x].second;
			x = static_cast<size_type>(c[x].first);
		}
		return std::move(ret);
	}

public:
	PotentializedUnionFind() : c() {}
	explicit PotentializedUnionFind(const size_type size)
		: c(size, std::make_pair(-1, value_type())) {}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(size_type x) {
		assert(x < size());
		while (c[x].first >= static_cast<difference_type>(0)) {
			if (c[static_cast<size_type>(c[x].first)].first >=
				static_cast<difference_type>(0)) {
				c[x].second =
					c[static_cast<size_type>(c[x].first)].second + c[x].second;
				c[x].first = c[static_cast<size_type>(c[x].first)].first;
			}
			x = static_cast<size_type>(c[x].first);
		}
		return x;
	}
	value_type diff(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return potential(y) + (-potential(x));
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return static_cast<size_type>(-c[find(x)].first);
	}

	bool unite(size_type x, size_type y, value_type d) {
		assert(x < size());
		assert(y < size());
		d = d + diff(y, x);
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (c[x].first > c[y].first)
			std::swap(x, y), d = -d;
		c[x].first += c[y].first;
		c[y] = std::make_pair(static_cast<difference_type &&>(x), std::move(d));
		return true;
	}
};

#include<iostream>

int main() {
	int n, m;
	std::cin >> n >> m;
	PotentializedUnionFind<int> T(n);
	while (m--) {
		int l, r, d;
		std::cin >> l >> r >> d;
		--l;--r;
		if (!T.unite(l, r, d)) {
			if (T.diff(l, r) != d) {
				std::cout << "No" << std::endl;
				return 0;
			}
		}
	}
	std::cout << "Yes" << std::endl;
	return 0;
}


Measured memory_bytes: 1792
MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

S = [0] * (N + 1)
for i in range(N):
    S[i + 1] = S[i] + A[i]

SN = S[-1]
ans = 0
for i in range(N - 1):
    a = A[i]
    cnt = a * (SN - S[i + 1])
    ans = (ans + cnt) % MOD
print(ans)


Measured memory_bytes: 93940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  ll a;
  cin>>a;
  cout<<a+a*a+a*a*a;
  
}

Measured memory_bytes: 3628
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	long long n; cin >> n;
	long long s = 0;
	vector<long long> a(n); for (long long i = 0; i <= n - 1; i++) cin >> a[i], s ^= a[i];

	for (long long i = 0; i <= n - 1; i++) cout << (s ^ a[i]) << " ";

	return 0;
}

Measured memory_bytes: 4772
m, k = map(int, input().split())
if m == 1 and k == 1:
    print(-1)
elif m == 1 and k == 0:
    print("0 0 1 1")
elif 2**m > k:
    ans = str(k)
    y = []
    for i in range(2**m):
        if i == k:
            continue
        y.append(str(i))
    ans =  ' '.join(reversed(y)) + ' ' + ans + ' ' + ' '.join(y) + ' ' +ans
    print(ans)
else:
    print(-1)


Measured memory_bytes: 16788
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int sum=0,ans=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            sum++;
        }
        else{
          if(ans<sum){
                ans=sum;
            }
            sum=0;
        }
    }
    if(ans<sum){
                ans=sum;
            }
    cout<<ans<<endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

ll fexp(ll a, ll n)
{
	ll res = 1;
	while(n)
	{
		if(n & 1)
		res *= a;
		a *= a;
		n >>= 1;
	}
	return res;
}

void solve(int T)
{
	ll n;
	cin>>n;
	VL N;
	ll tx = n;
	while(tx)
	{
		N.pb(tx%10);
		tx /= 10;
	}
	reverse(N.begin(), N.end());
	ll res = 0;
	for(ll i=1;i<=n;i++)
	{
		VL Z;
		tx = i;
		while(tx)
		{
			Z.pb(tx%10);
			tx /= 10;
		}
		if(!Z[0])
		{
			//cout<<(res - pr)<<"\n";
			continue;	
		}	
		if((ll)N.sz() >= 2)
		{
			if(N[0] < Z[0])
			res += (fexp(10, (ll)N.sz()-2) - 1)/9;
			else if(N[0] > Z[0])
			res += (fexp(10, (ll)N.sz()-1) - 1)/9;
			else
			{
				res += (fexp(10, (ll)N.sz()-2) - 1)/9;
				ll df = 0;
				for(int j=1;j<(int)N.sz()-1;j++)
				df = 10*df + N[j];	
				if(N[(ll)N.sz()-1] >= Z[(ll)Z.sz()-1])
				res += (df+1);
				else res += df;	
			}	
		}
		if(Z[0] == Z[(ll)Z.sz()-1])
		res++;	
	}	
	cout<<res<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 256
/*input
11 10 9
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	ll a, b, n;
	cin >> a >> b >> n;
	auto f = [&](ll a, ll b, ll x) {
		return ((a * x) / b) - (a * (x / b));
	};
	ll l=0, r=n, ret = 0;
	while(l <= r) {
		ll m1 = (l + l + r) / 3ll;
		ll m2 = (l + r + r) / 3ll;
		ll f1 = f(a, b, m1);
		ll f2 = f(a, b, m2);
		if(f1 > f2) {
			ret = max(ret, f1);
			r = m2 - 1;
		}
		else {
			ret = max(ret, f2);
			l = m1 + 1;
		}
	}
	cout << ret << endl;
}

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2;
}


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

int main(){
	int i;
//	char s[4];

//	for(i=0;i<4;i++) scanf("%c",&s[i]);
  int N, A, B;
//int *agi;int min = 1000;
  scanf("%d",&N);
  scanf("%d",&A);
  scanf("%d",&B);

  double y = fmin(N*A, B);

  printf("%d", (int) y);

  return 0;


/*
	for(i=0;i<3;i++){
		if(s[i]==s[i+1]){
			printf("Bad\n");
			return 0;
		}
	}
	printf("Good\n");*/
}

Measured memory_bytes: 128
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;


public class my
{
	
	private static StringBuilder sb = new StringBuilder();
	
	public static void Main()
	{
		string s;
 
		while( null != ( s = Console.ReadLine() ) ){
			var t =s.Split(' ');
			var a = int.Parse(t[0]);
			var b = int.Parse(t[1]);
			
			var c = a + b;
			
			if(c > 0) {
				var digit = 0;
				
				while(c  > 0) {
					digit++;
					c /= 10;
				}
				
				my.AppendLine(digit);
			} else {
				sb.AppendLine("0");	//?
			}
		}
		
		my.Flush();
	}
	
	private static int CountChar(string s, char c)
	{
		return s.Length - s.Replace(c.ToString(), "").Length;
	}
	
	private static void Flush()
	{
		Console.Write(sb);
		sb.Length = 0;
	}
	
	private static void AppendLine(int v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(long v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(string[] v)
	{
		sb.AppendLine(string.Join(" ", v));
	}

	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

Measured memory_bytes: 9128