akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int d;
	cin >> d;
	vector<int> c(30);
	vector<int> co(d+5);

	rep(i,26) {
		cin >> c[i];
	}

	vector<int> last(26);

	rep(i, 26) {
		last[i]=0;
	}

	int s[30][370];

	rep(j,d) {
		rep(i, 26) {
			cin >> s[i][j];
		}
	}

	int coun = 0;
	/*
	rep(j, d) {
		vector<int> s(26);
		int count = 0;

		rep(i, 26) {
			cin >> s[i];
		}
		int max=s[0];
		int max_d=0;

		rep(i, 26) {
			if (max <= s[i]) {
				max = s[i];
				max_d = i;
			}
		}

		last[max_d] = j+1;
		count = max;

		rep(i, 26) {
			count -= c[i] * (j+1-last[i]);
		}
		co[j] = count;
	}
	*/
	vector<int> t(d + 5);
	rep(i, d) {
		cin >> t[i];
	}

	rep(j, d) {
	
		rep(i, 26) {

			if ( (t[j]-1) != i) {
				coun -= c[i]*(j + 1 - last[i]);
			}
			else {
				coun += s[i][j];
			//	cout << s[i][j] << endl;
				last[i] = j+1;
			}
		}
		co[j] = coun;
	}


	rep(j, d) {
		cout << co[j]<<endl;
	}

	return 0;
}

Measured memory_bytes: 3664
from bisect import bisect_left
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while 2**t<=A[i]:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
flag=[0]*N
for i in range(N-1,0,-1):
    if flag[i]==1:
        continue
    flag[i]=1
    b=bisect_left(A,B[i])
    if A[b]==B[i] and flag[b]==0:
        flag[i]=1
        flag[b]=1
        A[b]-=1
        count+=1
print(count)


Measured memory_bytes: 27060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) (1e18)
#define mod (ll) (1e9 + 7)
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)

const int mxn = 1*(1e5) + 5;
ll n;

int solve(){
	cin>>n;
	ll a=1;
	ll t;
	ll b[n];
	// bool zer = false;
	for(int i=0; i<n; i++) {
		cin>>b[i];
		if(!b[i]) {
			cout<<"0";
			return 0;
		}
	}
	sort(b, b+n);
	for(int i=0; i<n; i++) {
		if(INF/a < b[i]) {
			cout<<"-1";
			return 0;
		}
		else{
			a *= b[i];
		}
	}
	cout<<a;
	return 0;
}
 
int main(){
	fast;
	// tt
		solve();
}


Measured memory_bytes: 4408
program main
  implicit none
  integer(8) :: n, x, i
  integer(8), allocatable :: a(:)
  read(*, *) n, x
  allocate(a(n))
  read(*, *) (a(i), i = 1, n)

  write(*, "(i0)") processes(n, x, a)

  deallocate(a)
  contains

  function processes(n, x, a)
    implicit none
    integer(8), intent(in) :: n, x
    integer(8), intent(inout) :: a(:)
    integer(8) :: i, processes, eat
    processes = 0
    do i = 2, n
      eat = max(0, a(i) + a(i - 1) - x)
      processes = processes + eat
      a(i) = max(0, a(i) - eat)
    end do
  end function processes

end


Measured memory_bytes: 1536
import Data.Vector.Unboxed (Vector, (!), fromList, cons)
import Control.Applicative ((<$>))
import Control.Monad (forM_)


main :: IO ()
main = do
    n  <- readLn :: IO Int
    ns <- cons 0 . fromList . map read . words <$> getLine :: IO (Vector Int)
    forM_ [1..n] $ \i -> do
        putStr $ "node " ++ show i ++ ": "
        putStr $ "key = " ++ show (ns ! i) ++ ", "
        putStr $ if i == 1
                    then ""
                    else "parent key = " ++ show (ns ! (i `div` 2)) ++ ", "
        putStr $ if (i * 2) > n
                    then ""
                    else "left key = " ++ show (ns ! (i * 2)) ++ ", "
        putStr $ if (i * 2 + 1) > n
                    then ""
                    else "right key = " ++ show (ns ! (i * 2 + 1)) ++ ", "
        putStrLn ""



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
#define nl cout<<"\n"
//cout<<fixed<<setprecision(11);
const ll MOD=1e9+7;
const ll ARR_MAX = 1e5+1;
const ll VAL_MAX = 1e5+1;
const ll INF=1e14;

void solve(){
    int n,m;
    cin>>n>>m;
    int ac[n]={},wa[n]={};
    for(int i=0;i<m;i++){
        int x;string s;
        cin>>x>>s;
        x--;
        if(s=="AC"){
            ac[x]=1;
        }
        else{
            if(ac[x]==0){
                wa[x]++;
            }
        }
    }
    int cor=0,pen=0;
    for(int i=0;i<n;i++){
        if(ac[i]==1){
            cor++;
            pen+=wa[i];
        }
    }
    cout<<cor<<" "<<pen,nl;
}

int main(){
    fastio();
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 1024
import itertools

N, K = map(int, input().split())
a = list(map(int, input().split()))
beautiful_num = []

for i in range(N):
    temp = 0
    for n in a[i:]:
        temp += n
        beautiful_num.append("{:040b}".format(temp))

ma_b_cnt = 0
target_set = None

result = 0
for i in range(40):
        for b in beautiful_num:
            if b[i] == "1":
                ma_b_cnt += 1
        if ma_b_cnt >= K:
            result += 2**(40-i-1)
            beautiful_num = [b for b in beautiful_num if b[i] == "1"]
        ma_b_cnt = 0

print(result)

Measured memory_bytes: 55692
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static int a,b;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            a=sc.nextInt();
            b=sc.nextInt();
            if(a==0&&b==0){
                sc.close();
                return;
            }
            int ans=0;
            for(int i=1;i<=a;i++){
                for(int j=i+1;j<=a;j++){
                    for(int k=j+1;k<=a;k++){
                        if(i+j+k==b) ans++;
                    }
                }
            }
            System.out.printf("%d\n",ans);
        }
    }
    public static long sumDigits(long n) {
        long sum=0;
        while(n!=0){
            sum+=n%10;
            n/=10;
        }
        return sum;
    }
}


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

int cnt[3];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		if(x % 4 == 0) cnt[0]++;
		else if(x % 2 == 0) cnt[1]++;
		else cnt[2]++;
	}
	if(cnt[0] >= n / 2) printf("Yes\n");
	else if(cnt[0] >= cnt[2]) printf("Yes\n");
	else printf("No\n");
}


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

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

  string s;
  cin >> s;
  
  auto posA = s.find("A");
  auto posB = s.rfind("Z");
  cout << posB - posA + 1 << endl;
}


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

int main() {
    int K, S;
    cin >> K >> S;

    int count = 0;
    for (int i=0; i<=K; i++) {
        for (int j=0; j<=K; j++) {
            if (S-i-j >= 0 && S-i-j <= K) {
                count++;
            } 
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3536
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(e) for e in input().split()]

    A.sort()
    m = {}
    for i in range(N):
        if A[i] not in m:
            m[A[i]] = 1
        else:
            m[A[i]] += 1

    n = 0
    for k in m:
        if k < m[k]:
            n += m[k] - k
        elif k > m[k]:
            n += m[k]

    print(n)

main()


Measured memory_bytes: 17700
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/* libnum {{{*/
void amax(N, Args...)(ref N x, Args y) {
  x = x.max(y);
}
void amin(N, Args...)(ref N x, Args y) {
  x = x.min(y);
}
auto maxE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amax(y);
  return x;
}
auto minE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amin(y);
  return x;
}
/*}}}*/

/+---test
2 2
1 2
3 4
3 4
2 1
---+/
/+---test
2 3
1 10 80
80 10 1
1 2 3
4 5 6
---+/

void main(string[] args) {
  long H, W;
  readf(" %d %d ", &H, &W);

  auto map = new long[][](H, W);
  foreach (ref row; map) {
    const a = readln.split.map!(to!long).array;
    row[] = a[];
  }
  foreach (ref row; map) {
    const b = readln.split.map!(to!long).array;
    foreach (i; 0..W) row[i] = abs(row[i] - b[i]);
  }

  const max_diff = (H+W)*80;
  auto  dp       = new bool[][][](H, W, max_diff*2);

  dp[0][0][max_diff+map[0][0]] = true;
  dp[0][0][max_diff-map[0][0]] = true;
  foreach (y; 0..H) foreach (x; 0..W) foreach (s; 0..max_diff*2) {
    if (dp[y][x][s]) {
      if (y+1 < H) {
        dp[y+1][x][s+map[y+1][x]] = true;
        dp[y+1][x][s-map[y+1][x]] = true;
      }
      if (x+1 < W) {
        dp[y][x+1][s+map[y][x+1]] = true;
        dp[y][x+1][s-map[y][x+1]] = true;
      }
    }
  }
  zip(iota(-max_diff, max_diff), dp[$-1][$-1]).
    filter!"a[1]".
    map!(x => x[0].abs).
    minE.
    writeln;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

#define int long long
struct UnionFind {
    int size_;
    vector<int> par;
    vector<int> rank;
    vector<int> sz;

    UnionFind(int size_) : size_(size_) {
        par.resize(size_);
        rank.resize(size_);
        sz.resize(size_);

        for (int i = 0; i < size_; i++) {
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }

    int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        if (rank[y] < rank[x]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;

        par[x] = y;
        sz[y] += sz[x];
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return sz[find(x)]; }
};
int N;
using P = pair<int, int>;
vector<P> pos;
struct Edge {
    int from, to, cost;
    Edge(int from, int to, int cost) : from(from), to(to), cost(cost) {}
    bool operator<(const Edge &rhs) const { return cost < rhs.cost; }
};
vector<Edge> es;
map<P, int> ids;
int cost(P p1, P p2) {
    return min(abs(p1.first - p2.first), abs(p1.second - p2.second));
}
void add_edge(P p1, P p2) {
    int a = ids[p1];
    int b = ids[p2];
    int c = cost(p1, p2);
    es.push_back(Edge(a, b, c));
    es.push_back(Edge(b, a, c));
}
void add() {
    sort(all(pos));
    rep(i, N) if (i) {
        add_edge(pos[i - 1], pos[i]);
        if (i + 1 < N) add_edge(pos[i], pos[i + 1]);
    }
    sort(all(pos), [](const P &p1, const P &p2) {
        return P(p1.second, p1.first) < P(p2.second, p2.first);
    });
    rep(i, N) if (i) {
        // cout << pos[i].first << ", " << pos[i].second << endl;
        add_edge(pos[i - 1], pos[i]);
        if (i + 1 < N) add_edge(pos[i], pos[i + 1]);
    }
}
signed main() {
    cin >> N;
    es.reserve(2 * N);
    rep(i, N) {
        P p;
        cin >> p.first >> p.second;
        if (ids.count(p)) continue;
        int n = ids.size();
        ids[p] = n;
        pos.push_back(p);
    }
    N = pos.size();
    add();
    // cout << es.size() << endl;
    sort(all(es));
    UnionFind uf(N);
    long long ans = 0;
    for (auto e : es) {
        if (!uf.same(e.from, e.to)) {
            ans += e.cost;
            uf.unite(e.from, e.to);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 29184
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;

int main(){
  int a,b; cin >>a>>b;
  if(a!=b){
  cout << 2*max(a,b)-1<<endl;
}
  else cout<< a+b <<endl;
  }


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

using namespace std;

int main(){
    int W,H,x,y;
    int ans = 0;
    double maxs = 0;
    cin >> W >> H >> x >> y;

    maxs = (double)W*H*0.50;

    if(x*2 == W && y*2 == H){
        ans = 1;
    } 
    
    cout << fixed << setprecision(10)<<maxs << " " << ans<<endl;

    

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

ll a, b;
int main() {
   cin >> a >> b;
   if (a > b) {
      cout << a-1 << endl;
   } else {
      cout << a << endl;
   }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

//convert a integer to h:m:s
int main()
{
    int a, b;
    cin >> a >> b;

    if (a < b)
        cout << "a < b" << endl;
    else if (a == b)
        cout << "a == b" << endl;
    else
        cout << "a > b" << endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	Int K, N;
	cin >> K >> N;
	vector<Int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }

	Int x = (K - a.back()) + a[0];
	for (int i = 0; i + 1 < N; ++i) {
		x = max(x, a[i + 1] - a[i]);
	}
	cout << K - x << endl;

	return 0;
}


Measured memory_bytes: 1920
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
    
        int r = in.nextInt();
        int c = in.nextInt(); in.nextLine();
        int area = r*c;
        int[] dx = {0,-1,0,1};
        int[] dy = {-1,0,1,0};
        char[][] map = new char[r][c];
        int blackSquares = 1;
        for( int i = 0; i < r; i++ ) {
            String l = in.nextLine();
            for( int j = 0; j < c; j++ ) {
                map[i][j] = l.charAt(j);
                if(map[i][j]=='#') blackSquares++;
            }
        }

        PriorityQueue<Node> q = new PriorityQueue<>();
        int[][] distance = new int[r][c];
        for( int[] i : distance ) Arrays.fill(i,-1);
        q.add(new Node(0,0,0));
        distance[0][0] = 0;
        boolean reached = false;
        while(!q.isEmpty()) {
            Node curr = q.remove();
            if( curr.r == r-1 && curr.c == c-1 ) reached = true;
            for( int i = 0; i < 4; i++ ) {
                int x = curr.r + dx[i];
                int y = curr.c + dy[i];
                if( x < 0 || x >= r || y < 0 || y >= c ) continue;
                if( map[x][y] == '#' ) continue;
                int temp = 1+curr.distance;
                if( distance[x][y] == -1 || distance[x][y] > temp) {
                    distance[x][y] = temp;
                    q.add(new Node(x,y,distance[x][y]));
                }
            }
        }
        if( reached ) System.out.println((area-blackSquares)-distance[r-1][c-1]);
        else System.out.println(-1);
    }
    static class Node implements Comparable<Node>{
        int r,c;
        int distance;
        public Node(int r, int c, int distance) {
            this.r = r;
            this.c = c;
            this.distance = distance;
        }
        public int compareTo(Node n) {
            return distance - n.distance;
        }
    }
}

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

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

int main()
{
    vector<int> ok;
    int a, b;
    scanf("%d %d", &a, &b);
    for (int i = 1; i <= min(a, b); i++) {
        if (a % i == 0 && b % i == 0)
            ok.push_back(i);
    }

    int k;
    scanf("%d", &k);
    reverse(ok.begin(), ok.end());
    printf("%d\n", ok[k - 1]);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

#define mkp make_pair
const ll INF=-1e16;

class LazySegmentTree{
private:
  int n;
  vector<ll> node,lazy;
  vector<bool> lazyFlag;

public:
  LazySegmentTree(vector<ll> v){
      n=1;
      while(n<v.size()) n*=2;
      node.resize(2*n-1,INF);
      lazy.resize(2*n-1,0);
      lazyFlag.resize(2*n-1,false);
      
      for(int i=0;i<v.size();i++) node[i+n-1]=v[i];
      for(int i=n-2;i>=0;i--) node[i]=max(node[2*i+1],node[2*i+2]);
  }

  void eval(int k,int l,int r){
      if(lazyFlag[k]){
          node[k]+=lazy[k];
          if(r-l>1){
              lazyFlag[2*k+1]=true;
              lazyFlag[2*k+2]=true;
              lazy[2*k+1]+=lazy[k];
              lazy[2*k+2]+=lazy[k];
          }
          lazy[k]=0;
          lazyFlag[k]=false;
      }
  }

  void update(int a,int b,ll x,int k=0,int l=0,int r=-1){
      if(r<0) r=n;
      eval(k,l,r);
      if(b<=l||r<=a) return;
      if(a<=l&&r<=b){
          lazy[k]=x;
          lazyFlag[k]=true;
          eval(k,l,r);
      }else{
          update(a,b,x,2*k+1,l,(r+l)/2);
          update(a,b,x,2*k+2,(r+l)/2,r);
          node[k]=max(node[2*k+1],node[2*k+2]);
      }
  }

  ll getMax(int a,int b,int k=0,int l=0,int r=-1){
      if(r<0) r=n;
      eval(k,l,r);
      if(b<=l||r<=a) return INF;
      if(a<=l&&r<=b) return node[k];

      ll vl,vr;
      vl=getMax(a,b,2*k+1,l,(l+r)/2);
      vr=getMax(a,b,2*k+2,(l+r)/2,r);
      return max(vl,vr);
  }

  void add(int a,int b,ll x,int k=0,int l=0,int r=-1){
      if(r<0) r=n;
      eval(k,l,r);
      if(b<=l||r<=a) return;
      if(a<=l&&r<=b){
          lazy[k]+=x;
          lazyFlag[k]=true;
          eval(k,l,r);
      }else{
          add(a,b,x,2*k+1,l,(r+l)/2);
          add(a,b,x,2*k+2,(r+l)/2,r);
          node[k]=max(node[2*k+1],node[2*k+2]);
      }
  }
};

int N,M;
vector<int> L,R;
vector<ll> A;

vector<pair<int,ll>> ed[200020];

int main(){
  cin>>N>>M;
  L.resize(M);
  R.resize(M);
  A.resize(M);
  for(int i=0;i<M;i++) cin>>L[i]>>R[i]>>A[i];

  for(int i=0;i<M;i++) ed[R[i]].push_back(mkp(L[i],A[i]));

  LazySegmentTree seg(vector<ll>(N+1,0));
  for(int i=1;i<=N;i++){
    ll ma=seg.getMax(0,i);
    seg.add(i,i+1,ma);
    for(auto a:ed[i]){
      ll l,c;
      tie(l,c)=a;
      seg.add(l,i+1,c);
    }
  }

  cout<<seg.getMax(0,N+1)<<endl;

  return 0;
}


Measured memory_bytes: 24192
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	string A, B, C;
	cin >> A >> B >> C;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		set<char> st;
		st.insert(A[i]);
		st.insert(B[i]);
		st.insert(C[i]);
		ans += st.size() - 1;
	}
	cout << ans << endl;
	return 0;
}

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

int main(void)
{

	
		int ans[100];
	int N,K;
	cin>>N>>K;
	for(int i=1;i<=N;i++)
		cin>>ans[i];
	sort(ans+1,ans+1+N);
	
	int sum = 0;
	for(int i=N;i>N-K;i--)
	{
		sum+=ans[i];
	}
	cout<<sum<<endl;
	
	
		
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    int n; cin >> n;
    map<string , int> mp;
    rep(i , n){
        string s; cin >> s;
        mp[s]++;
    }
    int max_ = 0;
    for(auto x : mp){
        max_ = max( max_ , x.second);
    }
    for(auto x : mp){
        if( x.second == max_ ) cout << x.first << endl; 
    }
}

Measured memory_bytes: 25216
while True:
    try:
        t1, t2 = map(float, raw_input().split())
        if t1 < 35.5 and t2 < 71:
            print "AAA"
        elif t1 < 37.5 and t2 < 77:
            print "AA"
        elif t1 < 40 and t2< 83:
            print "A"
        elif t1 < 43 and t2 < 89:
            print "B"
        elif t1 < 50 and t2 < 105:
            print "C"
        elif t1 < 55 and t2 < 116:
            print "D"
        elif t1 < 70 and t2 < 148:
            print "E"
        else:
            print "NA"
    except (EOFError):
        break

Measured memory_bytes: 4260
#include<bits/stdc++.h>
using namespace std;
int main()
{
 string s;
 cin>>s;
 int i;
 for(i=0;i<s.length()-1;i++)
 {
 	if(s[i]==s[i+1])
 	{
 	 cout<<i+1<<" "<<i+2<<endl;	
 	 return 0;
	}
 }
 for(i=0;i<s.length()-2;i++)
 {
 	if(s[i]==s[i+2])
 	{
 		cout<<i+1<<" "<<i+3<<endl;
 		return 0;
	 }
 }
 cout<<"-1 -1"<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 2000000
#define MOD 1000000007
#define INF 10000000000000000

vector<vector<ll>> ans;
ll dfs(vector<vector<int>> &G,int v,int p,int color){
  if(ans.at(v).at(color)!=-1){
    return ans.at(v).at(color);
  }
  ll counter=1;
  for(auto nv:G.at(v)){
    if(nv==p){
      continue;
    }
    if(color==0){
      counter*=(dfs(G,nv,v,0)+dfs(G,nv,v,1))%MOD;
      counter%=MOD;
    }else{
      counter*=dfs(G,nv,v,0);
      counter%=MOD;
    }
  }
  return ans.at(v).at(color)=counter;
}

int main(){
  int N;
  cin>>N;
  vector<vector<int>> G(N);
  for(int i=0;i<N-1;i++){
    int x,y;
    cin>>x>>y;
    x--,y--;
    G.at(x).push_back(y);
    G.at(y).push_back(x);
  }

  ans.resize(N);
  for(int i=0;i<N;i++){
    ans.at(i).resize(2,-1);
  }

  cout<<(dfs(G,0,-1,0)+dfs(G,0,-1,1))%MOD<<endl;
}


Measured memory_bytes: 20864
def main():
    n = int(input())
    d = []
    for i in range(n):
        d.append(list(map(int,input().split())))
    d_set = list(map(set,d))
    cnt = 0
    ans = 'No'
    for i in d_set:
        if len(i)==1:
            cnt += 1
        else:
            cnt = 0
        if cnt >= 3:
            ans = 'Yes'
            break
    print(ans)



if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define For(i, a, b) for (ll i = (a); i < (b); i++)
#define all(A) (A).begin(), (A).end()

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if (A <= C and C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main() {
    long long ans = 0;
    int n;
    std::cin >> n;
    std::vector<long> a(n+1), b(n);
    for (int i = 0; i < n+1; i++) std::cin >> a[i];
    for (int i = 0; i < n; i++) std::cin >> b[i];

    for (int i = 0; i < n; i++){
        int left = std::min(a[i], b[i]);
        a[i] -= left;
        b[i] -= left;

        int right = std::min(a[i+1], b[i]);
        a[i+1] -= right;
        b[i] -= right;
        ans += left+right;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using P=pair<int,int>;
using V=vector<vector<int>>;

int main(){
  int P, Q, R;
  cin >> P >> Q >> R;
  vector<int>time(3);
  time = {P+Q, Q+R, R+P};

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

  cout << time[0] << endl;
     
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(void) {
  int x1, x2, x3, x4, x5;
  scanf("%d", &x1);
  scanf("%d", &x2);
  scanf("%d", &x3);
  scanf("%d", &x4);
  scanf("%d", &x5);

  if(x1 == 0)
  puts("1");
  else if(x2 == 0)
  puts("2");
  else if(x3 == 0)
  puts("3");
  else if(x4 == 0)
  puts("4");
  else if(x5 == 0)
  puts("5");


}


Measured memory_bytes: 1620
k = int(input())
a, b = [int(i) for i in input().split(" ")]

kk = k
ok = False
while not ok:
    if kk >= a and kk <= b:
        print("OK")
        ok = True
    if kk > b:
        print("NG")
        ok = True
    kk = kk + k

Measured memory_bytes: 9180
a = [0 for i in range(6)]
for i in range(3):
    a[2 * i], a[2 * i + 1] = map(int, input().split())

b = [0 for i in range(4)]
for i in range(6):
    b[a[i] - 1] += 1

if (max(b)) == 3:
    print('NO')
elif (min(b)) == 0:
    print('NO')
else:
    print('YES')


Measured memory_bytes: 3064
#define mod 1000000007
#define PI acos(-1)
#include<time.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll INF=0x7fffffffffffffff;
const int inf=0x7fffffff;
const int N=1e5+5;
clock_t start,finish;
void time_in(){start=clock();}
void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}
inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}
inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}
inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}
inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}
inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}
int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};
int st[4][2]={1,0,0,1,-1,0,0,-1};
//vector<int>vt[N];
//priority_queue<int>q;
int t,cas;
ll inv(ll a)
{
	return a==1?1:((mod-mod/a)*inv(mod%a))%mod;
}
ll v[2005];
void get()
{
	v[0]=1;
	for(ll i=1;i<=2000;i++)
	{
		v[i]=(v[i-1]*i)%mod;
	}
}
ll C(ll n,ll m)
{
	if(n<m||m<0)return 0;
	m=n-m<m?n-m:m;
	return (v[n]*inv(v[n-m])%mod)*inv(v[m])%mod;
}
int main()
{
	get();
	ll a,b,ans;
	while(~scanf("%lld%lld",&a,&b))
	{
		for(ll i=1;i<=b;i++)
		{
			ans=(C(b-1,i-1)*C(a-b+1,i))%mod;
			printf("%lld\n",ans);
		}
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace atcoderBeginnerContest134
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            int[] A = new int[N];
            List<int> ls = new List<int>()
            {
                -1
            };
            for (int i = 0; i < N; ++i)
            {
                A[i] = Convert.ToInt32(Console.ReadLine());

                if (ls[ls.Count - 1] >= A[i])
                    ls.Add(A[i]);
                else if (ls[0] < A[i])
                    ls[0] = A[i];
                else
                {
                    int idx = BinarySearch(ls, A[i]);
                    while (ls[idx] == A[i])
                        ++idx;
                    ls[idx] = A[i];
                }
            }
            Console.WriteLine(ls.Count);
        }

        private static int BinarySearch(List<int> ls, int elem)
        {
            int ini = 0;
            int fin = ls.Count;

            while(ini < fin)
            {
                int md = (ini + fin) >> 1;
                if (ls[md] >= elem)
                    ini = md + 1;
                else
                    fin = md; 
            }

            return fin;
        }
    }
}


Measured memory_bytes: 17320
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>

using namespace std;

int main()
{
    int a, b;
    string s;
    stack<int> St;

    while(cin >> s) {
        if (s == "+") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a+b);
        }
        else if (s == "-") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a-b);
        }
        else if (s == "*") {
            b = St.top(); St.pop();
            a = St.top(); St.pop();
            St.push(a*b);
        }
        else {
            St.push(atoi(s.c_str()));
        }
    }
    cout << St.top() << endl;

    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int ret = INT_MAX;
int n;
int a[110];

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    for (int i = -100; i <= 100; ++i) {
	int t = 0;
	rep(j, n) t += (a[j] - i) * (a[j] - i);
	ret = min(ret, t);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,k,j;
	vector<int> a;
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		cin>>j;
		a.push_back(j);

	}
	sort(all(a));
	int cnt=0;
	for (int i = n-1; i >= 0; --i)
	{
		if(a[i]>=k){
		 cnt++;	
		}
	}
	cout<<cnt;

   return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define si(a) scanf("%d", &a)
#define fore(i,a,b) for(int i = a; i < b; ++i)
#define N_MAX 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
int n,k;
vi v;
vi dp;
void leer(){
    si(n); 
    si(k);//B
    //k=2; //A
    v.assign(n+1,0);
    dp.assign(n+1,INT_MAX);
    fore(i,1,n+1)
        si(v[i]);
    int x;
    x = v[1];
    if(k>n)
        k = n;
    fore(i,1,k+1)
        dp[i] = abs(x-v[i]);
    fore(i,k+1,n+1){
        fore(j,1,k+1){
            dp[i] = min(dp[i],dp[i-j] + abs(v[i]-v[i-j]));
        }
    }
}
void solve(){
	leer();
    printf("%d\n", dp[n]);
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 3976
// Example program
#include <iostream>
#include <string>
using namespace std;

int n, a, b, c, d;
string s;


bool solve_simple(string &s, int x, int y) {
    for (int i = x; i < y - 1; i++) {
        if (s[i] == '#' && s[i + 1] == '#') {
            return false;
        }
    }
    return true;
}


bool can_skip(string &s, int a, int b, int c, int d) {
    if (d > c) {
        return true;
    }

    // WA #1    
    //for (int i = b - 1; i < d - 3; i++) {
    
    // WA #2
    // 9 1 3 9 6
    // .#.#...#.
    //for (int i = b - 1; i <= d - 3; i++) {

    // WA #3 -- Jump over B, while B stays at the beginning position
    // 9 1 4 9 7
    // .#.#...#.
    //for (int i = b - 1; i <= d - 3; i++) {
    for (int i = max(0, b - 2); i <= d - 2; i++) {
        if (s.substr(i, 3) == "...") {
            return true;
        }
    }
    return false;
}


int main()
{
    cin >> n >> a >> b >> c >> d >> s;
    
    bool ans = solve_simple(s, a, c) && solve_simple(s, b, d) && can_skip(s, a, b, c, d);
    cout << (ans ? "Yes" : "No") << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
//using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
const double PI = acos(-1.0);

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W, D;
  cin >> H >> W >> D;
  // vector<vector<int>> A(H, vector<int>(W));
  vector<P> A(H * W);
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      int a;
      cin >> a;
      a--;
      A[a].first = i;
      A[a].second = j;
    }
  }
  vector<int> S(H * W + 1);
  for (int i = 0; i < D; i++)
  {
    int s = i;
    S[s] = 0;
    for (int j = 1; s + D * j < H * W; j++)
    {
      int now = s + D * j;
      S[now] = S[now - D] + abs(A[now].first - A[now - D].first) + abs(A[now].second - A[now - D].second);
    }
  }
  int Q;
  cin >> Q;
  vector<int> L(Q), R(Q);
  for (int i = 0; i < Q; i++)
  {
    cin >> L[i] >> R[i];
    L[i]--;
    R[i]--;
  }
  for (int i = 0; i < Q; i++)
  {
    ll ans = 0;
    if (L[i] == R[i])
      cout << ans << endl;
    else
    {
      ans = S[R[i]] - S[L[i]];
      cout << ans << endl;
    }
  }
  return 0;
}

// 累積和 Lは含まれないからLごと引く


Measured memory_bytes: 2944
n = int(input())
ans = 'Yes'
t_before,x_before,y_before = 0,0,0
for _ in range(n):
    t,x,y = map(int, input().split())
    delta_x = abs(x-x_before)
    delta_y = abs(y-y_before)
    delta_t = t-t_before
    if ((delta_x+delta_y)%2 != delta_t%2) or (delta_x+delta_y>delta_t):
        ans = 'No'
        break
    t_before = t
    x_before = x
    y_before = y
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

signed main(){
	int n;
	cin>>n;
	int a[3],b[3];
	r(i,3)cin>>a[i];
	r(i,3)cin>>b[i];

	int ans=n;

	for(int i=0;i*a[0]<=n;i++){
		int A=i*a[0];
		for(int j=0;j*a[1]+A<=n;j++){
			int B=j*a[1];
			int x=n-A-B;
			if(a[2]>=b[2]){
				ans=max(ans,i*b[0]+j*b[1]+x);
			}
			else{
				int y=x/a[2];
				int z=x%a[2];
				ans=max(ans,i*b[0]+j*b[1]+y*b[2]+z);
			}
		}
	}

	if(a[0]<=b[0] && a[1]<=b[1] && a[2]<=b[2]){
		cout<<ans<<endl;
		return 0;
	}	

	int sum=0;
	r(i,3)if(a[i]>b[i])sum++;

	n=ans;

if(sum<=2){

	vector<P>v;
	r(i,3)if(a[i]>b[i])v.push_back(P(a[i],b[i]));
	r(i,v.size())a[i]=v[i].S,b[i]=v[i].F;

	for(int i=0;i*a[0]<=n;i++){
		int A=i*a[0];
		int x=n-A;
		if(v.size()==2){
			int y=x/a[1];
			int z=x%a[1];
			ans=max(ans,i*b[0]+y*b[1]+z);
		}
		else{
			ans=max(ans,i*b[0]+x);
			//cout<<n<<endl;
		}
}}
else{
	//cout<<0<<endl;
	r(i,3)swap(a[i],b[i]);
	for(int i=0;i*a[0]<=n;i++){
		int A=i*a[0];
		for(int j=0;j*a[1]+A<=n;j++){
			int B=j*a[1];
			int x=n-A-B;
			if(a[2]>=b[2]){
				ans=max(ans,i*b[0]+j*b[1]+x);
			}
			else{
				int y=x/a[2];
				int z=x%a[2];
				ans=max(ans,i*b[0]+j*b[1]+y*b[2]+z);
			}
		}
	}
}

	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    bool w = true;
    rep(i, n){
        rep(j, n){
            if(s[i][j] == '#'){
                w = false;
            }
        }
    }
    if(w){
        cout << -1 << endl;
        return 0;
    }

    int c = 0;
    rep(i, n){
        int ok = false;
        rep(j, n){
            if(s[j][i] == '.'){
                ok = true;
            }
        }
        if(ok){
            c++;
        }
    }

    int ans = INF;
    rep(i, n){
        int x = 0;
        rep(j, n){
            if(s[i][j] == '.'){
                x++;
            }
        }
        bool ok = false;
        rep(j, n){
            if(s[j][i] == '#'){
                ok = true;
            }
        }
        if(not ok){
            x++;
        }

        ans = min(ans, x);
    }

    if(ans == INF){
        cout << -1 << endl;
    }else{
        cout << ans + c << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
using namespace std;
int N,p[50];
signed main(){
	cin>>N;
	for(int i=0;i<N;i++)
		cin>>p[i];
	bool f;
	int u=0,v;
	for(int i=0;i<N;i++)
		if(u<abs(p[i])){
			u=abs(p[i]);
			v=i;
			f=(p[i]<0);
		}
	if(u==0){
		cout<<0<<endl;
		return 0;
	}
	if(f){
		for(int i=0;i<N;i++)
			p[i]=-p[i];
		reverse(p,p+N);
		v=N-v-1;
	}
	vector<pair<int,int>> ve;
	for(int i=1;i<N;i++)
		if(p[i-1]>p[i]){
			p[i]+=u;
			ve.push_back({v,i});
			if(p[i-1]>p[i]){
				p[i]+=u;
				ve.push_back({v,i});
			}
			u=p[i];
			v=i;
		}
	cout<<ve.size()<<endl;
	for(auto x:ve)
		if(f)
			cout<<N-x.first<<" "<<N-x.second<<endl;
		else
			cout<<x.first+1<<" "<<x.second+1<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, W;
long long int w[100001], v[100001];
long long int dp[101][100001];

int main(){
  cin >> N >> W;
  long long int ans;
  for(int i=0; i<N; i++) cin >> w[i] >> v[i];
  for(int i=0; i<=N; i++) dp[i][0] = 0;
  for(int j=0; j<=W; j++) dp[0][j] = 0;
  for(int i=0; i<N; i++){
    for(int j=0; j<=W; j++){
      if(j - w[i] < 0) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
    }
  }
  for(int j=0; j<=W; j++){
    if(j == 0) ans = dp[N][j];
    if(dp[N][j] > ans) ans = dp[N][j];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 80128
import java.lang.Integer;
import java.lang.String;
import java.lang.System;
import java.util.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner cin = new Scanner(System.in);
        int rabbit = cin.nextInt();
        int count = 0;
        List<Integer> rabbitarray = new ArrayList<Integer>();
        for(int i=0;i < rabbit;i++){
            int next = cin.nextInt();
            rabbitarray.add(next);
        }
        for(int j=0;j < rabbit;j++) {
            int check = rabbitarray.get(j);
            if (check > 0){
            int check2 = rabbitarray.get(check - 1);
                if(check2 > 0) {
                    if (check == rabbitarray.get(check2 - 1)) {
                        count++;
                        if (check != 0) {
                            rabbitarray.set(check - 1, 0);
                        }
                        if (check2 != 0) {
                            rabbitarray.set(check2 - 1, 0);
                        }
                    }
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 48568
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N,K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i,N){
    cin >> A.at(i);
    if(i>=K){
      if(A.at(i)>A.at(i-K)) {
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }
  }
}


Measured memory_bytes: 4836
fn main() {
  let (n, m): (usize, usize) = read_tuple();
  let edges: Vec<(usize, usize)> = read_tuples(m);
  
  let mut ans = 0;
  for &(v,w) in &edges {
    let removed = edges.iter().filter(|&&e|e!=(v,w));
    let mut uf = UnionFind::new(n);
    for &(v,w) in removed {
      uf.unite(v-1, w-1);
    }
    ans += if uf.count() != 1 {1} else {0};
  }
  
  println!("{:?}", ans);
}

struct UnionFind {
  n: usize,
  rp: Vec<usize>,
  rk: Vec<usize>
}

impl UnionFind {
  fn new(n: usize) -> UnionFind {
    UnionFind {
      n: n,
      rp: (0..n).collect(),
      rk: vec![1; n]
    }
  }

  fn rep(&self, p: usize) -> usize {
    if self.rp[p] == p {p} else {self.rep(self.rp[p])}
  }

  fn rank(&self, p: usize) -> usize {
    self.rk[self.rep(p)]
  }

  fn count(&self) -> usize {
    let mut reps = (0..self.n).map(|x|self.rep(x)).collect::<Vec<_>>();
    reps.sort();
    reps.dedup();
    reps.len()
  }
  
  fn unite(&mut self, p: usize, q:usize) {
    let rkp = self.rank(p);
    let rkq = self.rank(q);
    let (p, q) = if rkp <= rkq {(p, q)} else {(q, p)};

    let repp = self.rep(p);
    let repq = self.rep(q);
    self.rp[p] = repq;
    self.rp[repp] = repq;
    self.rk[repq] += self.rk[repp];
  }
}       

fn read_tuple<T1: std::str::FromStr, T2: std::str::FromStr>() -> (T1, T2) {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  let mut it = buf.trim().split_whitespace();
  let x = it.next().unwrap().parse::<T1>().ok().unwrap();
  let y = it.next().unwrap().parse::<T2>().ok().unwrap();
  (x, y)
}

fn read_tuples<T1: std::str::FromStr, T2: std::str::FromStr>(n: usize) -> Vec<(T1, T2)> {
  let mut vec: Vec<(T1, T2)> = vec![];
  for _ in 0 .. n {
    vec.push(read_tuple());
  }
  vec
}

Measured memory_bytes: 4352
N = int(input())

A = list(map(int, input().split()))

loop = 1000000
for a in A:
    num = 0
    b = a
    while True:
        if b%2 == 0:
            num += 1
            b /= 2
        else:
            break
    loop = min(num,loop)

print(loop)


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

const int MAXN = 1005;
const int MAXV = MAXN*(MAXN-1)/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i, int j) {
  if (i > j) swap(i,j);
  return id[i][j];
}

bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV]; // max length of path from v
int dfs(int v) {
  if (visited[v]) {
    if (!calculated[v]) return -1;
    return dp[v];
  }
  visited[v] = true;
  dp[v] = 1;
  for (int u : to[v]) {
    int res = dfs(u);
    if (res == -1) return -1;
    dp[v] = max(dp[v], res+1);
  }
  calculated[v] = true;
  return dp[v];
}

int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n-1));
  rep(i,n) {
    rep(j,n-1) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }
  int V = 0;
  rep(i,n)rep(j,n) {
    if (i < j) {
      id[i][j] = V++;
    }
  }
  rep(i,n) {
    rep(j,n-1) {
      a[i][j] = toId(i,a[i][j]);
    }
    rep(j,n-2) {
      to[a[i][j+1]].push_back(a[i][j]);
    }
  }
  int ans = 0;
  rep(i,V) {
    int res = dfs(i);
    if (res == -1) {
      puts("-1");
      return 0;
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 38528
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        char a;
        cin>>a;
        if(a>='a' && a<='z')
        cout<<"a";
        else
        cout<<"A";
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

#define N 1000

int main(){
	int x, y, cnt =0;

	cin >> x >> y;

	if (x == 1 && y == 1) {
		cnt += 400000;
	}

	if (x == 1) {
		cnt += 300000;
	}
	else if (x == 2) {
		cnt += 200000;
	}
	else if(x ==3){
		cnt += 100000;
	}

	if (y == 1) {
		cnt += 300000;
	}
	else if (y == 2) {
		cnt += 200000;
	}
	else if(y == 3){
		cnt += 100000;
	}

	cout << cnt << endl;

	return 0;
}

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

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define ll long long

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;

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

	int n,k;cin>>n>>k;
	vi a;
	for(int i=0;i<n;i++) {
        int c;cin>>c;
        a.pb(c);
	}

	vector<int> dp(n,INT_MAX);

	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++) {
        for(int j=1;j<=k;j++) {
            if(i-j>=0) {
                dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
            }
        }
	}

//	for(auto x: dp)
//        cout<<x<<" ";

    cout<<dp[n-1];

    return 0;
}


Measured memory_bytes: 1144
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>


using namespace std;

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


int main(void) {
    long long a,b,c,d;
    // long long count=0;
    cin >> a >> b >>  c >> d;
    long long ans1,ans2;
    long long GCD = gcd(c,d);
    a--;
    ans1 = a/c + a/d - a/((c*d)/GCD);
    ans2 = b/c + b/d - b/((c*d)/GCD);
    // cout <<  a/c << " " << a/d << " " <<  a/((c*d)/GCD) << endl;
    // cout <<  b/c << " " << b/d << " " <<  b/((c*d)/GCD) << endl;
    
    // cout << ans1 << " " << ans2 << endl;
    cout << (b-a) - (ans2 - ans1) << endl;
    // cout << (long long)ceil(range - (ceil(range/c) + ceil(range/d) - ceil(range/(c*d))))  << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int X, Y, Z, N, M, S, T; cin >> X >> Y >> Z >> N >> M >> S >> T;
    S--, T--;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) cin >> A[i] >> B[i], A[i]--, B[i]--;
    vector<int> C(M), D(M);
    for (int i = 0; i < M; i++) cin >> C[i] >> D[i], C[i]--, D[i]--;
    int OS = 0;
    int OK = X;
    int OC = X + Y;
    vector<vector<int>> G(X + Y + Z);
    for (int i = 0; i < N; i++) {
        G[A[i] + OS].push_back(B[i] + OK);
        G[B[i] + OK].push_back(A[i] + OS);
    }
    for (int i = 0; i < M; i++) {
        G[C[i] + OK].push_back(D[i] + OC);
        G[D[i] + OC].push_back(C[i] + OK);
    }
    using P = pair<int, int>;
    deque<P> Q;
    Q.emplace_back(0, A[S] + OS);
    Q.emplace_back(0, B[S] + OK);
    int g0 = C[T] + OK;
    int g1 = D[T] + OC;
    vector<bool> visited(X + Y + Z);
    while (!Q.empty()) {
        int dist, node; tie(dist, node) = Q.front(); Q.pop_front();
        if (visited[node]) continue;
        visited[node] = true;
        if (node == g0 || node == g1) {
            cout << dist + 1 << endl;
            return 0;
        }
        for (int next : G[node]) {
            Q.emplace_back(dist + 1, next);
        }
    }
    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 18612