akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, a[114514];

signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	cout << a[n / 2] - a[n / 2 - 1] << endl;
}


Measured memory_bytes: 1024
N = int(input())
a = [0]+list(map(int,input().split()))
b = [0]*(N+1)
b[-1] = a[-1]
for i in range(N-1,0,-1):
    hoge = a[i]
    for j in range(i,N+1,i):
        hoge += b[j]
    b[i] = hoge%2
print(sum(b))
for i in range(N+1):
    if b[i] == 1:
        print(i,end = " ")


Measured memory_bytes: 7148
n=int(input())
l1=[0]*61
l=list(map(int,input().split()))
for j in range(n):
  s=list(str(bin(l[j])))
  for i in range(61):
    if i==len(s)-2:
      break
    if s[-i-1]=='1':
      l1[i]+=1
c=0
for i in range(61):
  c+=pow(2,i,10**9+7)*(n-l1[i])*l1[i]%(10**9+7)
print(c%(10**9+7))

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

using namespace std;

void compute(void){

  string s;

  int ten = 0;
  int out = 0;
  int hit = 0;

  while( out != 3 ){

    cin >> s;

    if( s == "HIT"){
      hit++;
      if(hit > 3 ){
	ten++;
	hit = 3;
      }
    }
    else if( s == "HOMERUN" ){
      ten = ten + hit + 1;
      hit = 0;
    }
    else{
      out++;
    }
  }
  cout << ten << endl; 
}

int main(void){
  
  int n;  
  cin >> n;
  
  while( n-- ){
    compute();
  }

  return 0;
}

Measured memory_bytes: 1212
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;
    string s = to_string(n);

    int total = 0;
    for(int i = 0; i < s.size(); i++){
        total += s[i] - '0';
    }

    if(n % total == 0){
        cout << "Yes" << endl; 
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    A, B = map(int, input().split())
    print((A + B) % 24)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
// https://atcoder.jp/contests/aising2020/tasks/aising2020_a
#include<iostream>

int main() {
	int L, R, d;
	int ans = 0;
	std::cin >> L >> R >> d;

	int ima = L;

	for (int i = L; i <= R; i++) {
		// std::cout << i << std::endl;
		if (i % d == 0) {
			ans++;
		}
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 3628
#文字列(str)で入力
s = input()
#文字列の間なので1を引く
n = len(s) - 1
ans = 0

#bit全検索
for bit in range(2 ** n):
    f = s[0]
    for i in range(n):
        #if bit & (1 << i):
        mask = 1 << i
        if bit & mask:
            f += "+"
        f += s[i + 1]
        
    ans += eval(f)

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
using namespace std;
long long INF = pow(10.0, 9.0) + 7.0;

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

    long long res = 0;
    long long sum_max, sum_min;
    for (long long n = K; n <= N+1; n++) {
        sum_min = n * (n - 1) / 2;
        sum_max = n * (2 * N - n + 1) / 2;
        res += sum_max - sum_min + 1;
    }

    res = res % INF;
    cout << res << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll mod=1e9+7;
const int MAXN=3010;
ll dp[MAXN][MAXN],f[MAXN][MAXN];
ll s[MAXN];
int t[MAXN][MAXN],a[MAXN];
int x,y,q,n;
ll ans;
int main()
{
	scanf("%d",&n);
	scanf("%d",&q);
    for (int i=1;i<=n;i++){
    	scanf("%d",&a[i]);
    }
    for (int i=1;i<=n;i++)
    	 for (int j=1;j<=n;j++)
    	 	  if (a[i]>a[j]) f[i][j]=1;
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++) t[i][j]=1;	 	
    s[0]=1;
    for (int i=1;i<=q;i++) 
    s[i]=(s[i-1]*2)%mod;	 	
    for (int j=1;j<=q;j++) {
    	scanf("%d%d",&x,&y);
        for (int i=1;i<=n;i++) {
        	dp[i][x]=(f[i][x]*s[j-t[i][x]])%mod;
        	dp[x][i]=(f[x][i]*s[j-t[x][i]])%mod;
        }
        for (int i=1;i<=n;i++){
        	dp[i][y]=(f[i][y]*s[j-t[i][y]])%mod;
        	dp[y][i]=(f[y][i]*s[j-t[y][i]])%mod;
        }
    	for (int i=1;i<=n;i++)
    	if (i!=x)
    	{ 
    		f[i][x]=(dp[i][y]+dp[i][x])%mod; f[x][i]=(dp[y][i]+dp[x][i])%mod;
    		t[i][x]=j+1; t[x][i]=j+1;
    	}
    	for (int i=1;i<=n;i++)
    	if (i!=y)
    	{
            f[i][y]=(dp[i][x]+dp[i][y])%mod; f[y][i]=(dp[x][i]+dp[y][i])%mod;
            t[i][y]=j+1; t[y][i]=j+1;
    	}
    	f[x][y]=(dp[x][y]+dp[y][x])%mod; t[x][y]=j+1;
    	f[y][x]=(dp[x][y]+dp[y][x])%mod; t[y][x]=j+1;
    	// cout << t[1][2] << ' ' << t[1][3] << ' ' << t[2][3] << endl;
    }
    for (int i=1;i<=n;i++)
    	 for (int j=i+1;j<=n;j++) 
    	 {
    	 	 ans=(ans+f[i][j]*s[q+1-t[i][j]]%mod)%mod;
    	 	 // cout << i << ' ' << j << ' ' << f[i][j]*s[q+1-t[i][j]]%mod << endl;
    	 }

    cout << ans << endl;	 	
}

Measured memory_bytes: 177024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	v := make([]int, n)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = nextInt()
	}
	for i := 0; i < n; i++ {
		c[i] = v[i] - nextInt()
	}

	maxans := 0
	for i := 0; i < n; i++ {
		if c[i] > 0 {
			maxans += c[i]
		}
	}
	fmt.Println(maxans)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1788
N,W=map(int,input().split())
C=[0]*-~W
for _ in[0]*N:
 v,w=map(int,input().split())
 for i in range(W,w-1,-1):
  t=v+C[i-w]
  if t>C[i]:C[i]=t
print(C[W])


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> vec(2*m);
  for(int i=0;i<2*m;i++) cin>>vec.at(i);
  vector<int> ans(n);
  for(int i=0;i<n;i++) {
    for(int j=0;j<2*m;j++) {
      if(vec.at(j)==i+1) ans.at(i)++;
    }
  }
  for(int i=0;i<n;i++) {
    cout<<ans.at(i)<<endl;
  }
}

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

int main(void){
	int n;
	int cnt[168];
	int sosu[170]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
	scanf("%d",&n);
	long long int ans=1;
	for(int i=0; i<168; i++)cnt[i]=1;
	for(int i=1; i<n+1; i++){
		int tmp=i;
		//printf("num=%d\n",i);
		for(int j=0; j<168; j++){
			if(tmp<sosu[j])break;
			while(tmp%sosu[j]==0){
				tmp/=sosu[j];
				cnt[j]++;
			}
		}
		//printf("cnt=%d\n",tmp);
	}
	for(int i=0; i<168; i++){
		//printf("%d ",cnt[i]);
		ans=(ans*cnt[i])%1000000007;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 128
var i,j,n,m,x,y,ans:longint;
    a:string;
begin
  readln(a);
  n:=length(a);
  for i:=1 to n do
  if x=y then
  begin
    inc(x);
    if a[i]='p' then dec(ans);
  end
  else
  begin
    inc(y);
    if a[i]='g' then inc(ans);
  end;
  writeln(ans);
end.

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

#define long long long

struct _ { _() { ios_base::sync_with_stdio(0); cin.tie(0); } } _;
// template<class... T> inline void read(T&... x) { ((cin >> x), ...); }

template<class T> inline void MIN(T &a, T b) { if (a > b) a = b; }
template<class T> inline void MAX(T &a, T b) { if (a < b) a = b; }

string s;
bool has[26];

int main() {

	cin >> s;
	for (char c : s) has[c - 'a'] = true;

	for (char c = 'a'; c <= 'z'; ++c) {
		if (!has[c - 'a']) {
			cout << s << c << endl;
			return 0;
		}
	}
	while (s.length() >= 1) {
		char cur = s.back();
		has[cur - 'a'] = false; s.pop_back();
		for (++cur; cur <= 'z'; ++cur) {
			if (!has[cur - 'a']) {
				cout << s << cur << endl;
				return 0;
			}
		}
	}

	cout << -1 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  if (n&1)cout << 2*n << endl;
  else cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
const int maxn=3005;
double dp[maxn][maxn];
double p[3005];

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>p[i];
	
	dp[1][0]=1.0-p[1];
	dp[1][1]=p[1];
	
	for(int i=2;i<=n;i++) 
		for(int j=0;j<=i;j++)
		{
			if(j==0) dp[i][j]=dp[i-1][j]*(1.0-p[i]);
			else dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1.0-p[i]);
		}
	double sum=0;
	for(int i=(n+1)/2;i<=n;i++)
	sum+=dp[n][i];
	cout<<fixed<<setprecision(10)<<sum<<endl;
	return 0;
	
}


Measured memory_bytes: 49952
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 基本はdouble
//map<キー,値> p は辞書。p[キー] = 値
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}   // 


int main() {
	int N, L; cin >> N >> L;
	vector<string> S(N);
	for (int i = 0; i < N; i++)cin >> S[i];

	sort(ALL(S));

	string ans;
	for (int i = 0; i < N; i++) ans += S[i];

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
main(){
    string s,t;
    cin >> s >> t;
    for(int i = 0;i < min(s.length(),t.length());i++){
        cout << s[i] << t[i];
    }
    if(s.length() > t.length())cout << s.back();
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long H, long long W){
  if(H==1 || W==1){cout << 1 << endl; return;}
  cout << roundup((H*W),2) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    solve(H, W);
}



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

int main(void){

    int takahashi[2];
    int aoki[2];

    int count = 0;


    //入力部分
    scanf("%d%d",&takahashi[0],&takahashi[1]);
    scanf("%d%d",&aoki[0],&aoki[1]);

    //計算部分
    while(0==0){
        count++;
        if(count > 10000)break;

        aoki[0] -= takahashi[1];

        if(aoki[0] <= 0){
            printf("Yes\n");
            break;
        }

        takahashi[0] -= aoki[1];

        if(takahashi[0] <= 0){
            printf("No\n");
            break;
        }


    }

    //出力部分
    return 0;
}

Measured memory_bytes: 1660
/*		Author : Kaustubh Gangwar
		||S||A||M||R||A||T||
*/
#include <bits/stdc++.h>
using namespace std;
#define modo 1000000007
#define ff first
#define ss second 
#define ld long double
#define pb push_back
#define gcd __gcd
#define vi vector<int>
#define vll vector<long long>
#define all(x) (x).begin(),(x).end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define nl '\n'
typedef long long  ll;
typedef pair<int,int> pii;

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

int32_t main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	ll test=1;
	//cin>>test;
	while(test--)
	{
		int n,k;
		cin>>n>>k;
		int a[n+1];
		fe(i,1,n)
		cin>>a[i];
		fe(i,k+1,n)
		{
			if(a[i]>a[i-k])
			cout<<"Yes\n";
			else
			cout<<"No\n";
		}
		
	}
return 0;
}


Measured memory_bytes: 4400
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int P[] = new int[N];
    int countI = 1;
    for(int i=0; i<N; i++) {
    int b = scan.nextInt();
    P[i] = b;
    }
    int j = 1;
    int Min = P[0];
    while(j<N) {
    	if(P[j]<Min) {
    		Min = P[j];
    		countI++;
    	}
    	j++;
    }
    System.out.println(countI);
  }
}

Measured memory_bytes: 65056
N = int(input())
A,B = [0]*N,[0]*N
for i in range(N):
    A[i],B[i] = map(int,input().split())
A = sorted(A)
B = sorted(B)
if N%2 == 1:
    ans = B[int((N-1)/2)] - A[int((N-1)/2)] + 1
elif N%2 == 0:
    ans = B[int(N/2)] + B[int(N/2-1)] - A[int(N/2)] - A[int(N/2-1)] + 1
print(ans)

Measured memory_bytes: 85408
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define f first
#define s second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<pair<int,int>> vii;
typedef vector<pair<ll,ll>> vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

ll ppow(ll x,ll y,ll mod) {
    ll res=1;
    while(y) {
        if(y&1) res=res*x%mod;
        y>>=1;
        x=x*x%mod;
    }
    return res;
}



int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    vi a(n);
    map<int,ll> cnt;
    for (int i=0;i<n;++i) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    ll ans=0;
    for (auto x : cnt) {
        ans+=x.s*(x.s-1)/2;
    }
    for (int i=0;i<n;++i) {
        cout << ans-(cnt[a[i]]-1) << "\n";
    }
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	long long A,B;
	cin>>n>>A>>B;
	vector<int>a(n+2);
	a[n+1]=n+1;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	vector<long long>dp(n+2);
	dp[0]=0;
	for(int i=1;i<=n+1;i++){
		dp[i]=(long long) 1e18;
		int bigger=0;
		for(int j=i-1;j>=0;j--)
			if(a[j]>a[i])
				bigger++;
			else{
				dp[i]=min(dp[i],dp[j]+bigger*A+(i-1-j-bigger)*B);
			}
	}
	cout<<dp[n+1]<<endl;
	
}


Measured memory_bytes: 384
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main() {
  auto n = readln.chomp;
  int sum;
  for (int i = 0; i < n.length; ++i) {
    sum += (n[i] - '0');
  }
  if (n.to!int % sum == 0) {
    "Yes".writeln;
  }
  else {
    "No".writeln;
  }
}

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

int main(void){
	string str;
	cin >> str;
	if(str.size()==1){
		cout << str[0] << endl;
	}else{
		if(str[0]=='o' && str[str.size()-1]=='o')cout << "o" << endl;
		if(str[0]=='x' && str[str.size()-1]=='x')cout << "x" << endl;
		if(str[0]!=str[str.size()-1])cout << "o" << endl;
	}
    return 0;
}

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

int main(){
  int h,w;cin >> h >> w;
  char s[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> s[i][j];
    }
  }

  int ans = 0;
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j] != '#'){
        for(int k=-1;k<2;k++){
          for(int l=-1;l<2;l++){
            if(s[i + k][j + l] == '#'){
              if(i+k<0||i+k>h-1||j+l<0||j+l>w-1){
                
              } else ans += 1;
            }
          }
        }
        cout << ans;
      } else {
        cout << '#';
      }
      ans = 0;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
n,d = map(int, input().split())
r=0
for i in range(n):
  x,y = map(int, input().split())
  
  if math.sqrt(x*x+y*y) <= d:
    r=r+1 
print(r)


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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	string S;
	cin >> N >> S;

	for( char& c: S ) {
		int x = c - 'A' + N;
		int y = 'Z' - 'A' + 1;

		c = (char)(x % y + 'A');
	}

	cout << S << endl;

	return 0;
}


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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define dbg(x) cout<<#x<<"="<<x<<endl

#define all(x) x.begin(),x.end()
#define uni(x) x.erase(unique(x.begin(),x.end()),x.end())

typedef long long ll;
typedef unsigned long long ull;

typedef pair<ll,ll> P;

const ll mod = 1000000033;

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

typedef vector<ll> vec;
typedef vector<vec> mat;

ll getrank(mat A){
  ll H=A.size(),W=A[0].size();
  ll r=0;
  for(ll x=0;x<W;x++){
    ll pivot=-1;
    for(ll y=r;y<H;y++)if(A[y][x]){
      pivot=y;
      break;
    }
    if(pivot==-1)continue;
    swap(A[r],A[pivot]);
    for(ll y=r+1;y<H;y++){
      ll value=A[y][x]*mod_pow(A[r][x],mod-2)%mod;
      if(value)for(ll x2=x;x2<W;x2++)A[y][x2]=((A[y][x2]-A[r][x2]*value)%mod+mod)%mod;
    }
    r++;
  }
  return r;
}

ull y;
ull xorshift(){
  y ^= y << 7;
  y ^= y >> 9;
  return y;
}

int main(){

  y=42;

  int N,M;
  cin>>N>>M;
  vector<vector<int>> vs;
  rep(i,M){
    int k;
    cin>>k;
    vector<int> tmp;
    rep(j,k){
      int v;
      cin>>v;
      v--;
      tmp.push_back(v);
    }
    vs.push_back(tmp);
  }

  vector<vector<int>> ds(N);
  rep(i,M){
    rep(j,vs[i].size()){
      ds[vs[i][j]].push_back(i);
    }
  }

  set<int> st;
  ll ans=0;
  rep(i,N){
    if(ds[i].size()==0){
      ans++;
    }else if(ds[i].size()==1){
      st.insert(ds[i][0]);
    }
  }

  ans+=st.size();

  vector<P> es;
  mat A(M,vec(M,0));

  rep(i,N){
    if(ds[i].size()==2){
      int a=ds[i][0];
      int b=ds[i][1];
      if(st.count(a)==0&&st.count(b)==0){
        es.push_back(P(min(a,b),max(a,b)));
      }
    }
  }
  sort(all(es)); uni(es);

  vector<ll> rs;
  rep(i,es.size()){
    ull rr=xorshift();
    rr%=mod;
    ll rrr=rr;
    A[es[i].first][es[i].second]=rrr;
    A[es[i].second][es[i].first]=mod-rrr;
  }

  ans+=getrank(A)/2;

  cout<<ans<<endl;

  return 0;
}



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


//TEMPLATE
#define pb              push_back
#define mp              make_pair
#define ll              long long int
#define pi              3.1415926536
#define mod             1000000007
#define newline         printf("\n")
#define scand(n)        scanf("%lld", &n)
#define printd(n)       printf("%lld\n", n)
#define scandd(n)       scanf("%lf", &n)
#define printdd(n)      printf("%lf\n", n)
#define reversed(s)     reverse(s.begin(), s.end())
#define asorted(s)      sort(s.begin(), s.end())
#define dsorted(s)      sort(s.begin(), s.end(), descending_func)
#define for0(i, n)      for (i = 0; i < n; i++)
#define for1(i, n)      for (i = 1; i <= n; i++)
#define paired          pair <ll, ll>

//USER DEFINED FUNCTION
bool descending_func(ll a, ll b) {
    return (a > b);
}

bool pair_afsort(paired a, paired b) {
    return (a.first < b.first);
}

bool pair_assort(paired a, paired b) {
    return (a.second < b.second);
}

bool pair_dfsort(paired a, paired b) {
    return (a.first > b.first);
}

bool pair_dssort(paired a, paired b) {
    return (a.second > b.second);
}


int main() {
    ll n, h, i, max = 0;
    scand(n);
    scand(h);

    vector <ll> a(n), b(n);

    for0(i, n) {
        scand(a[i]);
        scand(b[i]);

        if (max < a[i]) {
            max = a[i];
        }
    }

    dsorted(b);

    for0(i, n) {
        if (max >= b[i]) {
            break;
        }
    }
    n = i;

    ll count = 0, sum = 0;

    for0(i, n) {
        sum += b[i];
        count++;
        if (sum >= h) {
            printd(count);
            return 0;
        }
    }

    h = h - sum;

    if (h%max == 0) {
        count += h / max;
    }
    else {
        count += h / max + 1;
    }

    printd(count);

    return 0;
}


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

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inverse(ll a) {
    return modpow(a, mod-2);
}

ll inv[MAX_N];  // inv[i] : iの逆数のmod
ll fact[MAX_N];  // fact[i] : iの階乗のmod
ll invfact[MAX_N];

void init() {
    inv[0] = fact[0] = invfact[0] = 1;
    inv[1] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        if(i >= 2) {
            inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        }
        fact[i] = (i*fact[i-1])%mod;
        invfact[i] = inverse(fact[i]);
    }
}
 
ll Comb(ll n, ll r) {
    if(r < 0 || n < 0 || n < r) {
        return 0;
    }
    ll res = fact[n];
    res = (res * invfact[r])%mod;
    res = (res * invfact[n-r])%mod;
    return res;
}

//--- main関数でinit()を呼び出すのを忘れるな ---//
int main() {
    ll n;
    cin >> n;

    vl a(n+1);
    map<ll, ll> mp;
    rep(i, n+1) {
        cin >> a[i];
        mp[a[i]]++;
    }

    ll b;
    for(auto p : mp) {
        if(p.second == 2) {
            b = p.first;
            break;
        }
    }

    ll x = -1, y = -1;
    rep(i, n+1) {
        if(x == -1) {
            if(b == a[i]) {
                x = i;
            }
        }
        else {
            if(b == a[i]) {
                y = n-i;
            }
        }
    }

    init();

    exrep(k, 1, n+1) {
        ll ans = (Comb(n+1, k) + mod - Comb(x+y, k-1))%mod;
        out(ans);
    }

    re0;
}

Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i ++) {
    int x;
    cin >> x;
    if (x <= k - x) {
      ans += 2 * x;
    }
    else {
      ans += 2 * (k - x);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;



int main(){
	string s;
	cin >> s;
	if (s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,minN=1001,maxN=0;
    cin>>n;
    for(int i;i<n; i++){
        int x;
        cin>>x;
        minN=min(minN,x);
        maxN=max(maxN,x);
    }
    cout<<maxN-minN;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<string>

using namespace std;

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

	vector<int>from_one;
	vector<int>to_n;

	int from = 0;
	int to = 0;
	for (int i = 0; i < m; i++) {
		int ai, bi;
		cin >> ai >> bi;
		if (ai == 1) {
			from_one.push_back(bi);
			from++;
		}
		if (bi == n) {
			to_n.push_back(ai);
			to++;
		}
	}

	sort(from_one.begin(), from_one.end());
	sort(to_n.begin(), to_n.end());

	int i = from-1;
	int j = to-1;
	int ope = 0;
	while (from_one.size() !=0 && to_n.size() != 0) {
		if (from_one[i] == to_n[j]) {
			ope++;
			break;
		}
		else if (from_one[i] < to_n[j]) {
			to_n.pop_back();
			j--;
		}
		else {
			from_one.pop_back();
			i--;
		}
	}

	if (ope == 0)cout << "IMPOSSIBLE" << endl;
	else cout << "POSSIBLE" << endl;


	return 0;
}

Measured memory_bytes: 1276
# coding: utf-8
# Your code here!

for i in range(20):
    n = int(input())
    if n == 0:
        break
    a = [0]*10
    for i in range(n):
        b = int(input())
        a[b] += 1
    for b in a:
        if b > 0:
            print("*"*b)
        else:
            print("-")


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == 7 && b == 5 && c == 5) cout << "YES" << endl;
  else if (a == 5 && b == 7 && c == 5) cout << "YES" << endl;
  else if (a == 5 && b == 5 && c == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
c = defaultdict(int)

for i in range(n):
    a, b = MAP()
    c[a] = c[a] + b

d = sorted(c.items(), key=itemgetter(0))
reg = 0
for x in d:
    reg += x[1]
    if reg >= k:
        print(x[0])
        exit()

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

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a+b==c||a+c==b||a==b+c) puts("Yes");
    else puts("No");

    return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, sum = 0;
  cin >> N;
  
  for(int i = 0; i < N; i++){
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

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

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

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n, c, k; cin>>n>>c>>k;
    vector<int> bus(100010, 0), t(n);
    for(int i=0; i<n; i++) cin>>t[i];
    sort(t.begin(), t.end());
    int cnt=0, cur=t[0], ans=1;
    for(int i=0; i<n; i++){
        if(cur+k<t[i] || c==cnt){
            cnt=1;
            ans++;
            cur=t[i];
        }
        else cnt++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))

def gcm(x, y):
    x, y = max(x, y), min(x, y)
    while x%y > 0:
        x, y = y, x%y
    return y

a_gcd = a[0]
for i in range(n):
    a_gcd = gcm(a_gcd, a[i])
print(a_gcd)


Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/

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

	ll n;
	cin >> n;
	vector<ll> a(n), b(n), c(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];

	sort(allof(a));
	sort(allof(b));
	sort(allof(c));

	vector<ll> sum(n + 1, 0);

	ll ans = 0;
	int rear = 0;

	rep(i, n) {
		ll value = c[i];
		int index = lower_bound(allof(b), value) - b.begin();
		if (index == rear) {
			ans += sum[index];
			continue;
		}
		Rep(j, rear,index) {
			ll value2 = b[j];
			int index2 = lower_bound(allof(a), value2) - a.begin();
			sum[j + 1] = sum[j] + index2;
		}
		rear = index;
		ans += sum[index];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        if(s == "AC") ac++;
        if(s == "WA") wa++;
        if(s == "TLE") tle++;
        if(s == "RE") re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const ll MOD = 1e9+7;
const ll INV = 5e8+4;

class UFDS {
private: vector<int> p, rank;
public:
	UFDS(int N) {
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;
		rank.assign(N, 0);
	}
	int find_set(int i) { return (p[i] == i) ? i : (p[i] = find_set(p[i])); }
	bool same_set(int i, int j) { return find_set(i) == find_set(j); }
	void union_set(int i, int j) {
		if (same_set(i, j)) return;
		int x = find_set(i), y = find_set(j);
		rank[x] > rank[y] ? p[y] = x : p[x] = y;
		if (rank[x] == rank[y]) rank[y]++;
 	}
};

vector<pair<int, ll>> G[1001], H[1001];
vector<pair<ll, ii>> E, A, B;
bitset<1001> vis;

ll dfs(int u, int d) {
	vis[u] = 1;
	for (auto& v : H[u]) {
		if (!vis[v.f]) {
			if (v.f == d) return v.s;
			ll x = dfs(v.f, d);
			if (x) return max(x, v.s);
		}
	}
	return 0;
}

int main() {
	ll N, M, X;
	cin >> N >> M >> X;
	while (M--) {
		int u, v, w;
		cin >> u >> v >> w;
		E.emplace_back(w, ii(u, v));
		G[u].emplace_back(v, w);
		G[v].emplace_back(u, w);
	}
	sort(E.begin(), E.end());

	UFDS U(N + 1);
	ll cost = 0, num = 1;
	for (auto& e : E) {
		if (!U.same_set(e.s.f, e.s.s)) {
			U.union_set(e.s.f, e.s.s);
			H[e.s.f].emplace_back(e.s.s, e.f);
			H[e.s.s].emplace_back(e.s.f, e.f);
			cost += e.f;
			A.push_back(e);
			num = 2 * num % MOD;
		}
		else {
			B.push_back(e);
		}
	}

	if (cost > X) {
		cout << 0 << '\n';
	}
	else {
		ll ans = 1, cnt = (cost == X ? num * INV % MOD : 1);
		for (auto& e : B) {
			vis.reset();
			ll x = e.f - dfs(e.s.f, e.s.s) + cost;
			if (x > X) ans = 2 * ans % MOD;
			if (x == X) cnt = 2 * cnt % MOD;
		}
		cout << 2 * (cnt - 1 + MOD) * ans % MOD << '\n';
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i = 0; i < (n); i++)
typedef pair<int, int> P;
const double PI=3.14159265358979323846;

int main() {
    double a,b,x;
    cin >> a >> b >> x; 
    double pi = PI;

    double ans;
    if(x >= 0.5*a*a*b){
        ans = atan((2*(a*a*b-x))/pow(a,3.0));
        // cout << ans << endl;
    }else{
        ans = atan(a*b*b/x/2);
        // cout << ans << endl;
    }

    ans = ans*180/pi;
    cout << fixed;
    cout << setprecision(10) << ans << endl;
    
    return 0;
}  

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, x;
    cin >> N >> x;

    if(x == 1 || x == 2 * N - 1){
        cout << "No";
        return 0; 
    }

    vec ans(2 * N - 1);
    REP(i, ans.size()) ans[i] = i + 1;
    REP(i, 3) ans.erase(ans.begin() + x - 2);

    cout << "Yes" << endl;
    REP(i, ans.size() / 2) cout << ans[i] << endl;
    REP(i, 3) cout << x - 1 + i << endl;
    REP(i, ans.size() / 2) cout << ans[i + ans.size() / 2] << endl;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

using namespace std;
typedef long long LL;
static long long INF = (1LL<<62);

int N, C;
vector<vector<int>> D;
vector<vector<int>> GC0, GC1;

int DF[4][31] = {0};
void calcDF(){
	for(int r=0; r<3; r++){
		for(int c=0; c<C; c++){
			int w = 0;
			for(int i=0; i<N; i++){
				for(int j=0; j<N; j++){
					if((i+j)%3 != r) continue;
					w += D[GC0[i][j]][c];
				}
			}
			DF[r][c] = w;
		}
	}
}

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

	cin >> N >> C;
	D.assign(C, vector<int>(C, 0));
	GC0.assign(N, vector<int>(N, 0));
	GC1.assign(N, vector<int>(N, 0));
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++){
			int d; cin >> d;
			D[i][j] = d;
		}
	}
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			int c; cin >> c; c--;
			GC0[i][j] = c;
		}
	}

	calcDF();
	LL ans = INF;
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++){
			if(j == i) continue;
			for(int k=0; k<C; k++){
				if(k==i || k==j) continue;
				LL w = DF[0][i]+DF[1][j]+DF[2][k];
				if(ans > w){
					ans = w;
				}
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 5608
N,T=gets.chomp.split(" ").map { |e| e.to_i }

min = 10**5

N.times do
  c,t = gets.chomp.split(" ").map { |e| e.to_i }
  if t<=T
    min = c > min ? min : c
  end
end

if min == 10**5
  puts "TLE"
else
  puts min
end

Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int H, W;
    	char[][] A;
    	boolean possible = true;
    	
        void solve(InputReader in, PrintWriter out) {
        	H = in.nextInt();
        	W = in.nextInt();
        	A = new char[H][W];
        	for (int i = 0; i < H; ++i) {
				A[i] = in.next().toCharArray();
			}
        	
        	for (int i = 0; i < H; ++i) {
				for (int j = 0; j < W; ++j) {
					if (A[i][j] == '#' && i > 0 && j < W - 1) {
						possible &= A[i - 1][j + 1] == '.';
					}
				}
			}
        	
        	out.println(possible ? "Possible" : "Impossible");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 23380
#abc171d
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
d=(10**5+100)*[0]
res=sum(A)
for x in A:
 d[x]+=1
for i in range(Q):
 b,c=map(int,input().split())
 res+=d[b]*(c-b)
 d[c]+=d[b]
 d[b]=0
 print(res)


Measured memory_bytes: 20972
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a,b,h = 0;
    cin >> a >> b;
    rep(i, b - a + 1)h += i;
    cout << h - b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

typedef double number;
typedef valarray<number> point;
const int dim = 2;

number dot(const point& a, const point& b) {
  return (a * b).sum();
}
point cross(const point& a, const point& b) {
  return a.cshift(+1)*b.cshift(-1)
       - a.cshift(-1)*b.cshift(+1);
}
number dist2(const point& a, const point& b) {
  return dot(a-b, a-b);
}

// http://www.prefield.com/algorithm/geometry3D/min_ball.html
struct min_ball {
  point center;
  number radius2;
  void add(const point& p) {
    ps.push_back(p);
  }
  void compile() {
    m = 0;
    center.resize(dim, 0);
    radius2 = -1;
    make_ball(ps.end());
  }
  template <class OUT>
  void support(OUT out) {
    copy(ps.begin(), supp_end, out);
  }
  min_ball() {
    for (int i = 0; i <= dim; ++i) {
      c[i].resize(dim, 0);
      v[i].resize(dim, 0);
    }
  }
private:
  list<point> ps;
  list<point>::iterator supp_end;
  int m;
  point v[dim+1], c[dim+1];
  number z[dim+1], r[dim+1];
  void pop() { --m; }
  void push(const point& p) {
    if (m == 0) {
      c[0] = p; r[0] = 0;
    } else {
      number e = dist2(p, c[m-1]) - r[m-1];
      point delta = p - c[0];
      v[m] = p - c[0];
      for (int i = 1; i < m; ++i)
        v[m] -= v[i] * dot(v[i], delta) / z[i];
      z[m] = dot(v[m], v[m]);
      c[m] = c[m-1] + e*v[m]/z[m]/2;
      r[m] = r[m-1] + e*e/z[m]/4;
    }
    center  = c[m];
    radius2 = r[m]; ++m;
  }
  void make_ball(list<point>::iterator i) {
    supp_end = ps.begin();
    if (m == dim + 1) return;
    for (list<point>::iterator k = ps.begin(); k != i; ) {
      list<point>::iterator j = k++;
      if (dist2(*j, center) > radius2) {
        push(*j); make_ball(j); pop();
        move_to_front(j);
      }
    }
  }
  void move_to_front(list<point>::iterator j) {
    if (supp_end == j) ++supp_end;
    ps.splice (ps.begin(), ps, j);
  }
};

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

  ll n;
  cin >> n;
  vector<double> x(n), y(n);
  rep(i, n) {
    cin >> x[i] >> y[i];
  }

  min_ball mb;
  rep(i, n) {
    point p = {x[i], y[i]};
    mb.add(p);
  }
  mb.compile();
  printf("%.10lf", sqrt(mb.radius2));
}


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

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

int main() {
  ll k;
  cin >> k;
  ll sum = 0;
  for(ll i = 1; i <= k; i++){
    for(ll j = 1; j <= k; j++){
      for(ll p = 1; p <= k; p++){
        sum += gcd(i,gcd(j,p));
      }
    }
  }
  
  cout << sum;
    
  return 0;
}

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

using namespace std;

struct book {
    int w;
    int t;
};

int binSearch(vector<book> &c_sum, int start, book limit) {
    int ok = start;
    int ng = c_sum.size();

    while (ng - ok > 1) {
        int mid = ok + (ng - ok) / 2;

        if (c_sum[mid].w - c_sum[start].w <= limit.w &&
            c_sum[mid].t - c_sum[start].t <= limit.t) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return ok;
}

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

    vector<book> c_sum(m + 1);
    for (int i = 0; i < m; i++) {
        book now;
        cin >> now.w >> now.t;

        c_sum[i + 1].w = c_sum[i].w + now.w;
        c_sum[i + 1].t = c_sum[i].t + now.t;
    }

    vector<book> shelf(n);
    for (int i = 0; i < n; i++)cin >> shelf[i].w >> shelf[i].t;

    vector<int> dp(1 << n, -1145141919);
    dp[0] = 0;
    for (int i = 1; i < 1 << n; i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                int back = i ^(1 << j);
                dp[i] = max(dp[i], binSearch(c_sum, dp[back], shelf[j]));
            }
        }
    }

    int ret = 0;
    for (int i = 0; i < 1 << n; i++)ret = max(ret, dp[i]);
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 4276
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
using namespace std;

int main() {
	long long A, B, C, K, count = 0, total = 0;
	cin >> A >> B >> C >> K;

	long long a, b, c;
	a = min(A, K);
	b = min(B, K - a);
	c = min(C, K - a - b);
	total = a;
	if (c > 0) total -= c;
	cout << total << endl;
	return 0;
}

Measured memory_bytes: 3636
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//  
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

template<class T> inline bool chmin(T& a, T b){ if(a>b){a=b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b){ if(a<b){a=b; return 1;} return 0;}

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
// const double PI=3.1415926535897932;

//#define __DBG__


void solve(void){
  
  int N;

  cin >> N;
  
  cout << N*N*N << endl;

  return;
   
}


int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    solve();
 
    return 0;
}




Measured memory_bytes: 256