akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        var w = sc.nextInt();
        var h = sc.nextInt();
        var x = sc.nextInt();
        var y = sc.nextInt();

        int ans = 0;
        if (x * 2 == w && y * 2 == h) ans = 1;

        Console.WriteLine("{0} {1}", (double)w * h / 2, ans);
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
k = int(input())

def forndigit(l1):
    l = []
    for i in l1:
        if i[-1] == '1':
            l.append(i+'0')
            l.append(i+'1')
            l.append(i+'2')
        elif i[-1] == '2':
            l.append(i+'1')
            l.append(i+'2')
            l.append(i+'3')
        elif i[-1] == '3':
            l.append(i+'2')
            l.append(i+'3')
            l.append(i+'4')
        elif i[-1] == '4':
            l.append(i+'3')
            l.append(i+'4')
            l.append(i+'5')
        elif i[-1] == '5':
            l.append(i+'4')
            l.append(i+'5')
            l.append(i+'6')
        elif i[-1] == '6':
            l.append(i+'5')
            l.append(i+'6')
            l.append(i+'7')
        elif i[-1] == '7':
            l.append(i+'6')
            l.append(i+'7')
            l.append(i+'8')
        elif i[-1] == '8':
            l.append(i+'7')
            l.append(i+'8')
            l.append(i+'9')
        elif i[-1] == '9':
            l.append(i+'8')
            l.append(i+'9')
        elif i[-1] == '0':
            l.append(i+'0')
            l.append(i+'1')
    return l

l1 = [str(i) for i in range(1,10)]
r = [l1]
for i in range(2,11):
    r.append(forndigit(r[i-2]))
ans = []
for item in r:
    ans += item
print(ans[k-1])

Measured memory_bytes: 18796
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

string f(int a, int b) {
	string rez;
	for(int i = 0; i < a; ++i) rez.push_back('0' + b);
	return rez;
}

void solve() {
	int a = fetch<int>();
	int b = fetch<int>();
	cout << min(f(a, b), f(b, a)) << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
import sys, re
input = sys.stdin.readline

n = int(input())  # 目指したい合計金額

cake = n // 4 + 1   # max iteration
donut = n // 7 + 1  # max iteration

count = 0

for c_i in range(cake):
  if count == 1:
    break
  else:
    for d_i in range(donut):
      if n == c_i * 4 + d_i * 7:
        count = 1
        break

print('Yes' if count else 'No')

Measured memory_bytes: 3188
#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 = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

ll md = 1e9+7;

ll mexp(ll a, ll e){
	ll res = 1;
	for(; e; e /= 2){
		if(e & 1) res = res * a % md;
		a = a*a%md;
	}
	return res;
}

ll inv(ll a){
	return mexp(a, md-2);
}

const int mx = 1e5+10;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	vector<ll> fs(mx);
	fs[0] = 1;
	rep(i,1,mx) fs[i] = fs[i-1]*i%md;

	auto c = [&](int n, int k){
		if(n < 0) return 0LL;
		if(k < 0 || k > n) return 0LL;
		ll denom = fs[n], num = fs[k]*fs[n-k]%md;
		return denom*inv(num)%md;
	};

	int n;
	cin >> n;
	vi as(n+1);
	trav(x, as) cin >> x;
	ll sum = 0;
	trav(x, as) sum += x;
	rep(i,1,n+1) sum -= i;
	int x=-1, y;
	rep(i,0,n+1) if(as[i] == sum){
		if(x==-1) x = i;
		else y = i;
	}

	int len = y-x + 1;


	rep(k,1,n+2){
		ll ans = 0;
		ans += c(n-1, k);
		ans += c(n-1, k-2);
		ans += 2*c(n-1, k-1);
		ans -= c(n+1-len, k-1);
		ans %= md;
		if(ans < 0) ans += md;
		cout << ans << endl;
	}
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



string s;

main(){
  cin>>s;
  int n=s.size();
  int ans=0;
  int suma=0;

  int i=0;
  while(i<n){
    if(i<n-2&&s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
      ans+=suma;
      suma++;
      int sum=1;
      int j=i+3;
      while(true){
        if(j+2<n&&s[j]=='A'&&s[j+1]=='B'&&s[j+2]=='C'){
          suma++;
          ans+=suma;
          j+=3;
        }else break;
      }
      i=j;

    }else if(s[i]=='A'){
      suma++;
      i++;
    }else if(i<n-1&&s[i]=='B'&&s[i+1]=='C'&&suma>0){
      ans+=suma; 
      i+=2;
    }else{
      suma=0;
      i++;
    }
    //cout<<i<<' '<<ans<<endl;
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 640
import sys
from math import floor
from heapq import heappush, heappop, heappushpop
input = sys.stdin.readline
sys.setrecursionlimit(10**7)


# 10**5
n, m = map(int, input().split())
# 10**9
a = sorted(map(lambda s: -int(s), input().split()))


for _ in range(m):
    x = heappop(a)
    heappush(a, x/2)

print(sum(map(lambda x: floor(-x), a)))


Measured memory_bytes: 14380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int,int> pii;
typedef priority_queue<int,vector<int>,greater<int> > small_heap;
typedef priority_queue<int> big_heap;
char str[110];
int main()
{
    scanf("%s",str+1);
    int len=strlen(str+1);
    int flag=0;
    for(int i=1;i<=(len-1)/2;i++){
        if(str[i]!=str[len+1-i]){
            flag=1;
            break;
        }
    }
    if(flag){
        cout<<"No"<<endl;return 0;
    }
    int lll=1,rr=(len-1)/2;
    while(lll<rr){
        if(str[lll]!=str[rr]){
            flag=1;break;
        }
        else lll++,rr--;
    }
    if(flag){
        cout<<"No"<<endl;return 0;
    }
    int l=(len+3)/2,r=len;
    while(l<r){
        if(str[l]!=str[r]){
            flag=1;break;
        }
        else l++,r--;
    }
    if(flag){
        cout<<"No"<<endl;return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 201001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
//ll P[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
//ll dp[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
ll H[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．


ll MOD = 1000000007;
int digit_length(int num)
{
    int count = 0;
    while (num) {
        num = num / 10;
        ++count;
    }
    return count;
}


ll gcd(ll a, ll b) {
    ll v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}


// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//ll lcm(ll a, ll b) {
//    return a / (gcd(a, b) % MOD) * (b % MOD);
//}

ll lcm(ll a, ll b) {
    return( (a % MOD) *modinv(gcd(a, b), MOD) * (b % MOD)) % MOD;
}
       // Main program
void solve() {
    string S;
    cin >> S;

    for(int i=0;i<S.length();i++){
        cout << "x";
    }
}



int main() {
    solve();
    return 0;
}








Measured memory_bytes: 256
#!/usr/bin/ruby
w,h,t=gets.split.map(&:to_i)
z=Hash.new(0)
r=0
gets.to_i.times{
	x,y,_=gets.split.map(&:to_i)
	z[[x,y]]+=1
}
h.times{|i|
	a=gets.split.map(&:to_i)
	w.times{|j|
		r+=a[j]*z[[j,i]]
	}
}
p r

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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int n;
V<int> v;

int main(){
    INIT;
    cin >> n;
    v.resize(n);
    REP(i,n) cin >> v[i];
    std::sort(ALL(v),DESC(int));

    int ans = 1;
    FOR(i,1,n) {
        if(v[i-1] > v[i]) ans++;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function compareNumber(a, b) {
    if (a < b) {
        return -1;
    }
    if (a > b) {
        return 1;
    }
    return 0;
}

function Main(input) {

    var n = parseInt(input[0], 10);

    var a = new Array(n);
    var astr = input[1].split(' ');
    for (var i = 0; i < n; i++) {
        a[i] = parseInt(astr[i], 10);
    }
    a.sort(compareNumber);

    var b = new Array(n);
    var bstr = input[2].split(' ');
    for (var i = 0; i < n; i++) {
        b[i] = parseInt(bstr[i], 10);
    }
    b.sort(compareNumber);

    var c = new Array(n);
    var cstr = input[3].split(' ');
    for (var i = 0; i < n; i++) {
        c[i] = parseInt(cstr[i], 10);
    }
    c.sort(compareNumber);


    var ans = 0;
    for (var i = 0; i < n; i++) {
        var anum = lower_bound(a, b[i]);
        var cnum = n - upper_bound(c, b[i]);
        ans += anum * cnum;
    }

    console.log(ans);

    return 0;
}

function lower_bound(array, target) {
    var min = 0;
    var max = array.length - 1;
    while (min <= max) {
        var middle = min + Math.floor((max - min) / 2);
        if (array[middle] < target) {
            min = middle + 1;
        }
        else {
            max = middle - 1;
        }
    }

    return min;
}

function upper_bound(array, target) {
    var min = 0;
    var max = array.length - 1;
    while (min <= max) {
        var middle = min + Math.floor((max - min) / 2);
        if (array[middle] <= target) {
            min = middle + 1;
        }
        else {
            max = middle - 1;
        }
    }

    return min;
}


Measured memory_bytes: 48472
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int H1 = sc.nextInt();
	int M1 = sc.nextInt();
	int H2 = sc.nextInt();
	int M2 = sc.nextInt();
	int K = sc.nextInt();
	int st = H1*60 + M1;
	int fi = H2*60 + M2;
	System.out.print(fi-st -K);
    }
}


Measured memory_bytes: 35784
'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''
from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=int(read())

max_val=-1

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
    max_val = max(dict[item],max_val)
#max_val=max(dict.values())
for k,v in dict.items():
    
    if(max_val==v):
        output.append(k)
    
    
output.sort()
print('\n'.join(output))


Measured memory_bytes: 36444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    ll a,b,k=0,i;
    cin >> a >> b >> k;
    for(i=a;(i<a+k && i<=b);i++){
        cout << i <<endl;
    }
    for(ll j=b-k+1;j<b+1;j++){
        if(j>=i){
            cout << j <<endl;
        }
    }   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

namespace std {
template <> struct hash<pair<int, int>> {
  size_t operator()(const pair<int, int> &p) const {
    constexpr static unsigned s = CHAR_BIT * sizeof(size_t) / 2;
    return (size_t)p.first << s | p.second;
  }
};
}

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.clear(), graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

void dfs(Graph &g, int v, int p, int prev_col, unordered_map<pair<int, int>, int> &cmap) {
  int col = 0;
  for (const auto &e : g[v]) {
    if (e.dst == p) continue;
    ++col;
    if (col == prev_col) ++col;
    cmap[{ v, e.dst }] = col;
    dfs(g, e.dst, v, col, cmap);
  }
}

void bfs(Graph &g, unordered_map<pair<int, int>, int> &cmap) {
  queue<tuple<int, int, int>> que;
  que.push(make_tuple(0, -1, 0));
  while (!que.empty()) {
    int v = get<0>(que.front()), p = get<1>(que.front()), pc = get<2>(que.front());
    que.pop();
    int col = 1;
    for (const auto &e : g[v]) {
      if (e.dst == p) continue;
      if (col == pc) ++col;
      cmap[{ v, e.dst }] = cmap[{ e.dst, v }] = col;
      que.push(make_tuple(e.dst, v, col));
      ++col;
    }
  }
}

Graph graph;
int main(void) {
  int n;
  cin >> n;
  Edges edges(n - 1);
  rep (i, n - 1) {
    int a, b;
    cin >> a >> b;
    edges[i] = {--a, --b, 0};
  }
  edges_to_graph(graph, edges, n, false);
  int maxi = 0;
  rep (i, n) maxi = max(maxi, (int)graph[i].size());
  unordered_map<pair<int, int>, int> cmap;
  dfs(graph, 0, -1, 0, cmap);
  // bfs(graph, cmap);
  cout << maxi << "\n";
  rep (i, n - 1) cout << cmap[{ edges[i].src, edges[i].dst }] << "\n";
  return 0;
}

Measured memory_bytes: 13860
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int maxn = 240000;
char s[maxn];
template<typename T> void no(const T&s){cout << s; exit(0);}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D >> (s + 1);
	if(C > D){
		swap(A, B);
		swap(C, D);
	}
	while(B < D){
		if(s[B + 1] == '.'){
			if(A != B + 1) B += 1;
			else{ 
				if(s[B + 2] == '.') B += 2;
				else if(s[B + 3] == '.') A += 2;
				else no("No");
			}
		}
		else if(s[B + 2] == '.'){
			if(A != B + 2) B += 2;
			else{
				if(s[A + 1] == '.') A += 1;
				else if(s[A + 2] == '.') A += 2;
				else no("No");
			}
		}
		else no("No");
	}
	if(A > C) no("No");
	while(A < C){
		if(s[A + 1] == '.') A += 1;
		else if(s[A + 2] == '.') A += 2;
		else no("No");
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 512
/**
 * @author: Mackenzie
**/

#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int c;
    cin>>c;
    if(c>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3656
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::Read;
use std::io::{stdout, BufWriter, Write};
use std::cmp::min;

use std::collections::HashMap;
 
fn main() {
    let mut buf = String::new();
    
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
 
    std::io::stdin().read_to_string(&mut buf).unwrap();
 
    let mut iter = buf.split_whitespace();
 
    let n: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();
    
    let mut item_count: Vec<usize> = vec![0; n];
    
    for _ in 0..k {
        let d: usize = iter.next().unwrap().parse().unwrap();
        for _ in 0..d {
            let a: usize = iter.next().unwrap().parse().unwrap();
            item_count[a-1] += 1;
        }
    }
    
    // println!("{:?}", item_count);
    
    let ans : isize = item_count.iter().map(|k| {
        if k == &0 {1} else {0}
        }).sum();
    
    println!("{}",ans);
    
}

Measured memory_bytes: 2168
#define INF 10000000000
#define MOD 1000000007

#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < (up); ++i)
#define repp(i, up) for (ll i = 0; i <= (up); ++i)
#define rrep(i, lo, up) for (ll i = (lo); i < (up); ++i)
#define rrepp(i, lo, up) for (ll i = (lo); i <= (up); ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))
#define feach(it, vec) for (auto it = (vec).begin(); it != (vec).end(); ++it)
#define emax(l, r) l = max(l, r)
#define vmin(l, r) l = min(l, r)

template<class T, class U>
bool contains(const T & vec, const U & value) {
    return vec.find(value) != vec.end();
}

ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

#endif  // end of use_templates


int main()
{
    ll n;
    cin >> n;
    vector<pair<ll, ll>> d(n);
    rep(i, n) {
        cin >> d[i].first >> d[i].second;
    }
    vector<bool> flg(n);
    rep(i, n) {
        flg[i] = d[i].first == d[i].second;
    }
    rrep(i, 2, n) {
        if (flg[i - 2] && flg[i - 1] && flg[i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3128
from collections import deque

def main():
    dq = deque()
    n = int(input())
    for _ in range(n):
        com = input().split()
        if com[0]=='insert':dq.appendleft(com[1])
        elif com[0]=='delete':
            try:dq.remove(com[1])
            except:pass
        elif com[0]=='deleteFirst':dq.popleft()
        else:dq.pop()
    print(' '.join(dq))



if __name__ == '__main__':
    main()




Measured memory_bytes: 69732
#include<iostream>
#include<functional>
#include<algorithm>
#include<vector>
#include<queue>
#define MAX_N 100010
#define LL long long
struct edge{
    LL to,ce,cs;
};

struct node{
    LL cost, now;
    bool operator<(const node& e1) const {
        return e1.cost < cost;
    }
};
const LL wel = 1e15;
int n, m, s, t;
std::vector<edge> G[MAX_N];
LL D[2][MAX_N];
LL ans[MAX_N];

int main(){
    std::cin >> n >> m >> s >> t;
    for(int i = 1; i <= n; i++){
        ans[i] = 1e16;
        D[0][i] = 1e16;
        D[1][i] = 1e16;
    }
    D[0][s] = D[1][t] = 0;
        for(int i = 0; i < m; i++){
        int u, v, a, b;
        std::cin >> u >> v >> a >> b;
        G[u].push_back(edge{v, a, b});
        G[v].push_back(edge{u, a, b});
    }
    std::priority_queue<node> pq;
    pq.push(node{0,s});
    while(!pq.empty()){
        node p = pq.top();
        pq.pop();
        if(D[0][p.now] < p.cost)continue;
        for(auto &u:G[p.now]){
            if(D[0][u.to] > p.cost + u.ce){
                D[0][u.to] = p.cost + u.ce;
                pq.push(node{D[0][u.to], u.to});
            }
        }
    }
    pq.push(node{0,t});
    while(!pq.empty()){
        node p = pq.top();
        pq.pop();
        if(D[1][p.now] < p.cost)continue;
        for(auto &u:G[p.now]){
            if(D[1][u.to] > p.cost + u.cs){
                D[1][u.to] = p.cost + u.cs;
                pq.push(node{D[1][u.to], u.to});
            }
        }
    }
    ans[n] = D[0][n] + D[1][n];
    
    for(int i = n - 1; i > 0; i--){
        ans[i] = std::min(ans[i + 1], D[0][i] + D[1][i]);
    }
    for(int i = 1; i <= n; i++){
        std::cout << wel - ans[i] << std::endl; 
    }
    return 0;
}

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

#define ll long long

unsigned euclidean_gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(void){
 
    ll n,m;
    cin >> n >> m;
    ll ans = 0;
    vector<ll>euclid;
    for(int i=0;i<=pow(m,0.5);i++){
        ll tmp = euclidean_gcd(m,i);
        euclid.push_back(tmp);
        euclid.push_back(m/tmp);
    }
    sort(euclid.rbegin(),euclid.rend());
    for(ll i=0;i<euclid.size();i++){
        // cout << euclid[i]<<endl;
        if(euclid[i]<=m/n){
            cout << euclid[i]<<endl;
            break;
        }
    }


}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,k,sum=0,i;
	cin>>n>>k;
	int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n,greater<int>());
	for(i=k;i<n;i++)
	{
		sum+=a[i];
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(X, Y):
    if abs(X-Y) > 1:
        return 'Alice'
    return 'Brown'


def main():
    X, Y = read_int_n()
    print(slv(X, Y))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61640
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
 
#[fastout]
fn main() {
    input! {
        s: String,
    }
    let ans = if s == "ABC" {
        "ARC"
    } else {
        "ABC"
    };
    println!("{}", ans);
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
#define fname "C"
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define bug(x) cerr << (#x) << " = " << (x) << '\n'
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define X first
#define Y second

using namespace std;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<float, float> ff;
typedef pair<double, double> dd;
const int Nmax = 100, R = 3000, T = 2500;
int n, A, arr[Nmax];
ll current[2*T + R], Next[2*T + R];

int main()
{
	if (fopen(fname".INP", "r")) {
		freopen(fname".INP", "r", stdin);
		freopen(fname".OUT", "w", stdout);
	}
	ios_base::sync_with_stdio(false); cin.tie(0);
	scanf("%d %d", &n, &A);
	REP1(i, n) {
		scanf("%d", &arr[i]);
		arr[i] -= A;
	}
	REP1(i, n) {
		fill(Next, Next + sizeof(Next)/sizeof(ll), 0);
		Next[arr[i] + R] = 1;
		FOR(j, -T, T) Next[j + R] += current[j + R] + current[j - arr[i] + R];
		FOR(j, -T, T) current[j + R] = Next[j + R];
	}
	cout << Next[R];
	return 0;
}

Measured memory_bytes: 384
loop do
    n = gets.to_i
    break if n == 0
    bs = n.times.map{gets.split.map(&:to_i)}
    bs.push([0,50000])
    dp = Array.new(n+1).map{Array.new(4, Float::INFINITY)}
    if bs[0][1] < bs[0][0]
        puts "NG 1"
        next
    end
    pos = bs[0][0]
    time = bs[0][1]
    dp[0][0] = pos
    bl = true
    1.upto(n-1) do |i|
        bl = false
        b = bs[i]
        dist = (pos - b[0]).abs
        dt = (time - b[1]).abs
        0.upto(3) do |j|
            next if dp[i-1][j] == Float::INFINITY
            if (pos * (j + 2)) + b[0] <= dt
                bl = true
                dp[i][0] = dp[i-1][j] + pos + b[0] if dp[i-1][j] + pos + b[0] < dp[i][0]
            end
            if dist * (j + 2) <= dt && j < 2
                bl = true
                dp[i][j+1] = dp[i-1][j] + dist if dp[i-1][j] + dist < dp[i][j+1]
            end
        end
        pos = b[0]
        time = b[1]
        if !bl
            puts "NG #{i+1}"
            break
        end
    end
    0.upto(3) do |i|
        dp[n][i] = dp[n-1][i] + bs[n-1][0]
    end
    puts "OK #{dp[n].min}" if bl
end

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c){
        cout << "No" <<endl;
    }else if (a != b && b != c && c != a){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){
            while (true) {
                String s = in.readLine();
                if (s.equals("0")) break;

                int sum = 0;
                for (int i = 0; i < s.length(); i++) {
                    int n = Character.digit(s.charAt(i), 10);
                    sum += n;
                }
                System.out.println(sum);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Measured memory_bytes: 24584
s=list(map(int,input().split()))

for i in range(1,10000):
  if s[i-1]%2==0:
    s.append(int(s[i-1]/2))
  elif s[i-1]%2==1:
    s.append(3*s[i-1]+1)
  if s[i] in s[:i]:
    break
print(i+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
typedef    long long          ll;
typedef    vector<long long>    vi; 
typedef    vector<vi>         vvi; 
typedef    pair<long,long>      ii; 
#define    sz(a)              long((a).size()) 
#define    pb                 push_back 
#define    mp                   make_pair
#define    all(c)             (c).begin(),(c).end() 
#define    tr(c,i)            for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define    present(c,x)       ((c).find(x) != (c).end()) 
#define    cpresent(c,x)      (find(all(c),x) != (c).end())  
#define    input(v,n)           for(ll i = 0 ; i<n ; i++) cin>>v[i]
#define    output(v,n)          for(ll i = 0 ; i<n ; i++) cout<<v[i]<<" "
#define    ff           first
#define    ss           second


ll cont[1000010];


vi prime_vec;
vi smallest_prime_divisor;
vector< bool > prime;

void sieve(ll n) 
{ 
    prime.clear();
    prime_vec.clear();
    smallest_prime_divisor.clear();
    prime.resize(n+2,1);
    smallest_prime_divisor.resize(n+2,0);

  
    for (ll p=2; p<=n; p++) 
    {   
        if (prime[p] == true) 
        {         

            smallest_prime_divisor[p]=p;
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                  smallest_prime_divisor[i] = p;
                }
        } 
    } 
    prime[0]=0;
    prime[1]=0;
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          prime_vec.pb(p);
} 
  


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


    sieve(1000010);

    ll n,i;
    cin>>n;
    ll gcd = 0;
    vi a(n);
    for(i=0;i<n;i++)
    {
      cin>>a[i];
      if(i == 0)gcd = a[i];
        else 
      gcd = __gcd(gcd,a[i]);
       set<ll> st;
      while(a[i]>1)
      {
       
        st.insert(smallest_prime_divisor[a[i]]);
        a[i]/=smallest_prime_divisor[a[i]];
      }
      for(auto it=st.begin();it!=st.end();it++)
      {
        cont[*it]++;
      }

    }
    ll par = 0;
    for(i=2;i<=1000000;i++)
    {
        if(cont[i]>1)par = 1;
    }

    if(par == 0)
    {
      cout<<"pairwise coprime\n";
    }else if(gcd == 1)
    {
      cout<<"setwise coprime\n";
    }
    else {
      cout<<"not coprime\n";
    }


  return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

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

int main() {
    cin >> n;
    map<ll, ll> m;
    NREP() {
        cin >> tmp;
        m[tmp]++;
        mini = min(mini, tmp);
        maxi = max(maxi, tmp);
    }

    REP(i, mini - 1, maxi + 1) {
        ans = max(m[i-1] + m[i] + m[i+1], ans);
    }
    MSG(ans)
}


Measured memory_bytes: 6528
#include <cstdio>
#include <cctype>
#include <climits>
#include <vector>
using namespace std;

#define si static inline
#define gcu getchar_unlocked
si int in() {
	int c, n = 0;
	// bool minus = false; if ((c = gcu()) == '-') minus = true; else ungetc(c, stdin);
	while ((c = gcu()) >= '0' && c <= '9') n = 10 * n + (c - '0');
	return n; }
	// return minus ? -n : n; }
si void scan(char *s) {while (!isspace(*s++ = gcu()));}
#define pcu putchar_unlocked
#define svo si void out
template <typename T>
svo(T n) {
	static char buf[20];
	char *p = buf;
	//if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
svo(const char *s){while(*s)pcu(*s++);}
svo(char *s){while(*s)pcu(*s++);}
svo(char c){pcu(c);}
template <typename T>
//svo(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
svo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
template <typename head, typename... tail>
svo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef svo
#undef si

template <typename T>
struct heap{
	vector<T> h = {T()};

	void insert(T x) {
		h.push_back(x);
		int c = h.size() - 1;
		for (int p = c / 2; p; c = p, p /= 2)
			if (h[p] < x)
				h[c] = move(h[p]);
			else
				break;
		h[c] = move(x);
	}
	T extract() {
		T res = move(h[1]);
		h[1] = h.back();
		T v = move(h[1]);
		h.pop_back();

		int p = 1, H = h.size();
		for (int c = 2; c < H; p = c, c = p * 2) {
			if (c + 1 < H && h[c] < h[c + 1])
				c++;
			if (h[c] < v)
				break;
			h[p] = move(h[c]);
		}
		h[p] = move(v);

		return move(res);
	}

	bool empty() {
		return h.size() == 1;
	}
};

#define v vector
struct graph {
	struct node {int n, w;};
	v<v<node>> nodes;

	void read(int n) {
		nodes.resize(n);
		for (auto &x: nodes) {
			in();
			for (int k = in(); k--;) {
				int c = in();
				x.push_back({c, in()});
			}
		}
	}

	v<node> dks() {
		v<node> w(nodes.size(), {0, INT_MAX});
		w[0].w = 0;
		heap<node> q;
		q.insert({0, 0});
		while (!q.empty()) {
			node n = q.extract();
			if (w[n.n].n)
				continue;
			w[n.n].n = 1;
			for (node &x: nodes[n.n]) {
				int a = n.w + x.w;
				if (w[x.n].w > a) {
					w[x.n].w = a;
					q.insert({x.n, a});
				}
			}
		}
		return move(w);
	}
};

bool operator < (const graph::node &a, const graph::node &b) {
	return a.w > b.w;
}

int main() {
	graph g;
	g.read(in());
	int i = 0;
	for (auto &x: g.dks())
		out(i++, ' ', x.w, '\n');
}


Measured memory_bytes: 7280
#include <stdio.h>
#include<math.h>
#include<bitset>
#include<string>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include <iomanip>
using namespace std;

int main()
{
    int n,k,ans=0; cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++) cin>>h[i];
    
    for(int i=0;i<n;i++){
        if(h[i]>=k)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll D, G;
    cin >> D >> G;

    vector<ll> ps;
    vector<ll> cs;
    for (unsigned int i = 0; i < D; i++){
        ll p, c;
        cin >> p >> c;
        ps.emplace_back(p);
        cs.emplace_back(c);
    }

    ll min_solved = numeric_limits<ll>::max();
    for (ll i = 0; i < (1u << D); i++){
        bitset<10> state(i);
        ll score = 0;
        ll solved = 0;
        for (ll j = 0; j < D; j++){
            if (state[j]){
                score += (100 * (j + 1)) * ps.at(j);
                score += cs.at(j);
                solved += ps.at(j);
            }
        }
        for (ll j = D - 1; j >= 0; j--){
            if (G < score) continue;
            if (!state[j]){
                ll score_max = (100 * (j + 1)) * (ps.at(j) - 1);
                if (G > score + score_max){
                    score += score_max;
                    solved += ps.at(j) - 1;
                } else {
                    ll num_q = (G - score) % (100 * (j + 1)) == 0 ? (G - score) / (100 * (j + 1)) : (G - score) / (100 * (j + 1)) + 1;
                    score += (100 * (j + 1)) * num_q;
                    solved += num_q;
                }
            }
        }
        if (score >= G) {
            min_solved = min(min_solved, solved);
        }
    }
    cout << min_solved;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
d={}
for i in range(n):
    p=int(input())
    d[p]=i+1
ans=s=1
while s<n:
    f=d[s]
    cnt=0
    for i in range(s,n+1):
        if d[i]>=f:
            f=d[i]
            s=i
            cnt+=1
        else:
            s=i
            break
    ans=max(ans,cnt)
print(n-ans)

Measured memory_bytes: 70744
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)

using namespace std;
int main() {
    int N, K;
    cin >> N >> K;
    int l[N];
    REP(i, N) cin >> l[i];
    sort(l, l+N, greater<int>());
    int ans = 0;
    REP(i, K) {
        ans += l[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    int a, b;
    cin >> a >> b;
    cout << a * b  << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
int n,l,r,a[100001],b[100001],f;
main(){
  cin>>l>>r;
  string s[l];
  r(i,l)cin>>s[i];
  for(int i=1;i<l;i++){
    for(int j=0;j<r-1;j++){
      if(s[i][j]=='#'&&s[i-1][j+1]=='#')f++;
    }
  }
  if(f)cout<<"Impossible"<<endl;
  else cout<<"Possible"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[100][100];
int b[100];
int main(){
	int n,m; cin >> n >> m;
	for(int i=0;i<n;++i){
		for(int j=0;j<m;++j) cin >> a[i][j];
	}
	for(int i=0;i<m;++i) cin >> b[i];
	for(int i=0;i<n;++i){
		int sum=0;
		for(int j=0;j<m;++j){
			sum+=a[i][j]*b[j];
		}
		cout << sum << '\n';
	}
}

Measured memory_bytes: 1200
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fst first
#define snd second
typedef long long ll;
inline void Fail(){printf("0");exit(0);}

const int maxn=200005;
int n,m,ans,mn=INF;
pii pos[maxn];

class segtree{
public:
	int t[maxn*8],tag[maxn*8];
	void push_down(int v){
		if(tag[v]){
			t[v]+=tag[v];
			tag[v<<1]+=tag[v];
			tag[v<<1|1]+=tag[v];
			tag[v]=0; 
		}
	}
	void push_up(int v){t[v]=max(t[v<<1]+tag[v<<1],t[v<<1|1]+tag[v<<1|1]);}
	void build(int v,int l,int r){
		if(l==r){
			t[v]=l;
			tag[v]=0;
			return;
		}
		int mid=(l+r)>>1;
		build(v<<1,l,mid);
		build(v<<1|1,mid+1,r);
		push_up(v);
	}
	void update(int v,int l,int r,int vl,int vr){
		if(l>vr||r<vl)return;
		if(l>=vl&&r<=vr){
			tag[v]++;
			return;
		}
		push_down(v);
		int mid=(l+r)>>1;
		update(v<<1,l,mid,vl,vr);
		update(v<<1|1,mid+1,r,vl,vr);
		push_up(v);
	}
	int query(int v,int l,int r,int vl,int vr){
		if(l>vr||r<vl)return 0;
		if(l>=vl&&r<=vr)return t[v]+tag[v];
		int mid=(l+r)>>1;
		int sl=query(v<<1,l,mid,vl,vr),sr=query(v<<1|1,mid+1,r,vl,vr);
		return max(sl,sr)+tag[v];
	}
}T;

inline void mod(int cur){if(cur<0)ans=max(ans,-cur);}
 
int main(){
	scanf("%d%d",&n,&m);
	REP(i,n)scanf("%d%d",&pos[i].fst,&pos[i].snd);
	sort(pos+1,pos+1+n);
	T.build(1,1,m+1);
	REP(i,n){
		T.update(1,1,m+1,1,pos[i].snd);
		int cur=T.query(1,1,m+1,pos[i].fst+1,pos[i].snd);
		mn=min(mn,pos[i].snd);
		mod(pos[i].fst+m+1-cur);
		if(mn<=pos[i].fst+1)mod(m-i);
	}
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 9984
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll ans, r, g, b, n;
int main() {
	cin >> r >> g >> b >> n;
	REP(i, n + 1) {
		REP(j, n + 1) {
			ll now = n - r * i - g * j;
			if (now >= 0) {
				if (now % b == 0)ans++;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
#N=input()
A=[input() for i in range(N)]
B=[input() for i in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        t=True
        for x in range(M):
            if A[i+x][j:j+M]!=B[x]:
                t=False
                break
        if t:
            print("Yes")
            quit()
print("No")


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

#define ll long long
#define PB push_back
#define MP make_pair
#define PF push_front
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define ft first
#define sc second

#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(i, a, b, c) for(int i = (a); i <= (b); i += (c))
#define FORL(i, a, b) for(int i = (a); i < (b); i++)
#define ROF(i, a, b) for(int i = (a); i >= (b); i--)
#define ROFL(i, a, b) for(int i = (a); i > (b); i--)
#define LLFOR(i, a, b) for(ll i = (a); i <= (b); i++)
#define LLFORL(i, a, b) for(ll i = (a); i < (b); i++)
#define LLROF(i, a, b) for(ll i = (a); i >= (b); i--)
#define LLROFL(i, a, b) for(ll i = (a); i > (b); i--)


using namespace std;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

const int mod = 1e9 + 7;
const double PI = acos(-1);

template<typename T>
T exp(T x,ll n){
    if(n == 0) return 1;
    if(n == 1) return x;
    if(n%2 == 0) return exp((x*x)%mod,n/2);
    if(n%2 == 1) return (x*exp((x*x)%mod,n/2))%mod;
}

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

    int x;
    cin >> x;
    
    if(x) cout << "0";
    else cout << "1";

    return 0;
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;


int main() {
    ll x, y, z, k;
    cin >> x >> y >> z >> k;

    vector<ll> as(x), bs(y), cs(z);
    rep(i, x) cin >> as[i];
    rep(i, y) cin >> bs[i];
    rep(i, z) cin >> cs[i];


    vector<ll> xys;
    for (ll a : as) {
        for (ll b : bs) {
            xys.push_back(a + b);
        }
    }
    sort(xys.rbegin(), xys.rend());
    sort(cs.rbegin(), cs.rend());

    vector<ll> use_xys;
    rep(i, min((ll) k, (ll) xys.size())) {
        use_xys.push_back(xys[i]);
    }

    vector<ll> ans;
    for (ll ab : use_xys) {
        for (ll c : cs) {
            ans.push_back(ab + c);
        }
    }

    sort(ans.rbegin(), ans.rend());

    rep(i, k) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 43400