akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//?????????
		
		String[] arrayString1 = bf.readLine().split(" ");
		String[] arrayString2 = arrayString1.clone();
		
		bubbleSort(arrayString1,num);
		System.out.println("Stable");
		selectionSort(arrayString2,num);
		if(isStable(arrayString1, arrayString2, num)){
			System.out.println("Stable");
		}else{
			System.out.println("Not stable");
		}
	}
	
	private static void selectionSort(String[] arrayString, int num) {
		
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(getNum(arrayString[j])<getNum(arrayString[min])){
					min=j;
				}
			}
			if(min!=i){
			String tmp=arrayString[i];
			arrayString[i]=arrayString[min];
			arrayString[min]=tmp;
			
			}
		}
		
		for(int i=0;i<arrayString.length;i++){
			System.out.printf("%s",arrayString[i]);
			if(i!=arrayString.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
	}
	
	private static void bubbleSort(String[] arrayString, int num) {
		boolean flag=true;
		
		
		while(flag){
			flag=false;
			for(int i=num-1;i>=1;i--){
				if(getNum(arrayString[i])<getNum(arrayString[i-1])){
					String tmp=arrayString[i];
					arrayString[i]=arrayString[i-1];
					arrayString[i-1]=tmp;
					flag=true;
					
				}
			}
		}
		for(int i=0;i<arrayString.length;i++){
			System.out.printf("%s",arrayString[i]);
			if(i!=arrayString.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
	}
	public static  int getNum(String card){
		return Integer.parseInt(card.substring(1,2));
	}
	
	public static boolean isStable(String[] arrayString1,String[] arrayString2 ,int num){
		for(int i=0;i<num;i++){
			if(!arrayString1[i].equals(arrayString2[i])){
				return false;
			}
		}
		return true;
	}
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strAry = br.readLine().split(" ");
		double a = Double.parseDouble(strAry[0]);
		double b = Double.parseDouble(strAry[1]);
		double c = Double.parseDouble(strAry[2]);
		System.out.println(a * (b * Math.sin(Math.toRadians(c))) / 2);
		System.out.println(a + b + Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(Math.toRadians(c)))));
		System.out.println(b * Math.sin(Math.toRadians(c)));
	}
}

Measured memory_bytes: 24352
<?php

fscanf(STDIN, "%d", $n);
$d = explode(" ", trim(fgets(STDIN)));

sort($d);

$abc = $d[$n/2 -1];
$arc = $d[$n/2];

if($abc == $arc){
    echo 0;
    exit;
}

echo $arc - $abc;
exit;

Measured memory_bytes: 12792
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip> // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <bits/stdc++.h>
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    string str;

    cin >> str;

    REP(i,str.size()){
        cout << str[i];
        if(i == 3) cout << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int x,k;
int r[125252];

int main(){
  scanf("%d%d",&x,&k);
  r[0] = 0;
  REP(i,k)scanf("%d",r+i+1);
  k++;
  int add = 0;
  int low = 0;
  int high = x;
  int iter = 0;
  int q;
  scanf("%d",&q);
  while(q--){
    int t,a;
    scanf("%d%d",&t,&a);
    while(iter+2<k && t >= r[iter+2]){
      // iter step
      int g = r[iter+1] - r[iter];
      int h = r[iter+2] - r[iter+1];
      if(low==high){
        low = x - max(0,low-g);
        low = x - max(0,low-h);
        high = low;
      }else{
        CHMIN(g,x);
        CHMIN(h,x);
        CHMAX(low, g-add);     CHMIN(low,x);
        if(high<=low){
          low = high = h;
          add = 0;
        }else{
          add -= g;
          CHMIN(high,x-h-add);   CHMAX(high,0);
          if(high<=low){
            low = high = x;
            add = 0;
          }else{
            add += h;
          }
        }
      }
      iter += 2;
    }
    CHMAX(a,low);
    CHMIN(a,high);
    a += add;
    if(iter+1<k && t>=r[iter+1]){
      a = max(0,a-(r[iter+1]-r[iter]));
      a = x-a;
      a = max(0,a-(t-r[iter+1]));
      a = x-a;
    }else{
      a = max(0,a-(t-r[iter]));
    }
    printf("%d\n",a);
  }
  return 0;
}


Measured memory_bytes: 1664
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

K = In.int()
A, B = In.ints()

found=False
for i in range(A, B+1):
    if i%K==0:
        found=True

if found:
    Out.str("OK")
else:
    Out.str("NG")

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 85896
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    int n,z,w;
    scanf("%d%d%d",&n,&z,&w);
    int a[2145];
    REP(i,n) scanf("%d",&a[i]);

    printf("%d\n",max(abs(a[n-1]-w),abs(a[n-1]-a[n-2])));
    return 0;
}

Measured memory_bytes: 256
using System;

public class Hello{
    
    public static void Main(string[] args){
        
        var input = Console.ReadLine().Split(' ');
        var a = int.Parse(input[0]);
        var b = int.Parse(input[1]);
        
        Console.WriteLine((a * b) % 2 == 0 ? "Even" : "Odd");
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
bool check(double d){
    return floor(d) == d;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int ans = 0;
    int n,d;
    cin >> n >> d;
    vvi x(n,vi(d));
    rep(i,n){
        rep(j,d){
            cin >> x[i][j];
        }
    }

    rep(i,n-1){
        repk(j,i+1,n){
            double m=0;
            rep(k,d){
                double tmp = abs(x[i][k]-x[j][k]);
                m += tmp*tmp;
            }
            if(check(sqrt(m))) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# 入力
N = int(input())

# pfacから次数がn以上の素数の数を返す
def p_deg_le(pfac, n):
    ret = 0
    for p_deg in pfac:
        if p_deg[1] >= n: ret += 1
        else: break
    return ret


# 100までの素数
P = [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]

# N!を素因数分解
pfac = {} # N!の素因数分解
for i in range(1, N + 1):
    for p in P:
        while i % p == 0:
            if p in pfac:   pfac[p] += 1
            else:           pfac[p] = 1
            i //= p

# 次数の多い素数が前にくるようソート
pfac = sorted(pfac.items(), reverse = True, key = lambda x : x[1])

fact = 1
for p_deg in pfac:
    fact *= p_deg[0] ** p_deg[1]


# 約数が75 = 3 * 5 * 5個あるN!の約数は以下のいずれかの形のq
# q = p1^74, q = p1^24 * p2^2, q = p1^14 * p2^4,
# q = p1^4 * p2^4 * p3^2
p_deg = {}
for deg in (2, 4, 14, 24, 74):
    p_deg[deg] = p_deg_le(pfac, deg)

# q = p1^4 * p2^4 * p3^2
ans = (p_deg[4] * (p_deg[4] - 1) // 2) * (p_deg[2] - 2)
# q = p1^14 * p2^4
ans += p_deg[14] * (p_deg[4] - 1)
# q = p1^24 * p2^2
ans += p_deg[24] * (p_deg[2] - 1)
# q = p1^74
ans += p_deg[74]

print(ans)


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    string s;
    cin >> s;
    int first = (s[0] - '0') * 10 + (s[1] - '0');
    int second = (s[2] - '0') * 10 + (s[3] - '0');
    if (1 <= first && first <= 12) {
        //MMYY,AMBIGUOUS
        if (1 <= second && second <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if (1 <= second && second <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}


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

using namespace std;

bool palindrome(string s) {
      int i = 0;
      int j = s.size() - 1;
      while (i < j) {
            if (s[i] != s[j]) {
                  return false;
            }
            i++;
            j--;
      }
      return true;
}

void no() {
      cout << "No" << endl;
      exit(0);
}

void Task() {
      string s;
      cin >> s;
      int n = s.size();
      string s1 = s.substr(0, (n - 1) / 2);
      string s2 = s.substr((n + 3) / 2 - 1);
      cerr << s1 << " " << s2 << endl;
      if (palindrome(s) == false or palindrome(s1) == false or palindrome(s2) == false) {
            no();
      }
      cout << "Yes" << endl;
}

signed main() {
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr); cout.tie(nullptr);

      if (fopen("in.txt", "r")) {
            freopen("in.txt", "r", stdin);
      }

      int tc = 1;
      while (tc--) {
            Task();
      }
}


Measured memory_bytes: 3608
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		// 計算
		String result = "No";
		if(n == m) result = "Yes";
		
		// 出力
		System.out.println(result);
	}
}




Measured memory_bytes: 25172
num, bricks, count, smash = int(input()), [int(x) for x in input().split(" ")], 1, 0
for x in bricks:
    if count == x: count += 1
    else: smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)


Measured memory_bytes: 26268
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }


int n,maxi;
mi mp,vis;

void solve() {
    cin>>n;
    vi a(n,0);
    rep(i,0,n) {
		cin>>a[i];
		maxi=max(maxi,a[i]);
		vis[a[i]]++;
	}
    sort(all(a));
    int ct=0;
    rep(i,0,n) {
		    if(mp[a[i]]>0) {
				  mp[a[i]]=2;
				}
		    else { 
			     for(int j=a[i];j<=maxi;j+=a[i]) {
					    mp[j]++;
					 }
					
			  }  
		}
		
		rep(i,0,n) {
			  if(mp[a[i]]==1) ct++;
			}     
		
      cout<<ct<<endl;
      
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


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

const int MAX_N=1e4+10;

int N,M,D,P,ans,d;
vector<pair<int,int>> road(MAX_N);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M,N){
        ans=0;
        for (int i=0;i<N;++i){
            cin >> D >> P;
            road[i]={-P,D};
            ans+=D*P;
        }
        sort(road.begin(),road.begin()+N);
        for (int i=0;i<N&&M;++i){
            d=min(M,road[i].second);
            ans+=road[i].first*d;
            M-=d;
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main(){
    
    int ans=0,i,j,k,n,m,D,t,ans1=0,ans2=0;
    string s;  
    cin>>n;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        ans+=a[i];
    }
    t=ans/n;
    t=t+1;
    for(i=0;i<n;i++){
        ans1+=(t-a[i])*(t-a[i]);
    }
    t=t-1;
    for(i=0;i<n;i++){
        ans2+=(t-a[i])*(t-a[i]);
    }
    cout<<min(ans1,ans2)<<endl;
    
   // cout<<"YES"<<endl;
  //  cout<<"NO"<<endl;
   // cout<<"Yes"<<endl;
   // cout<<"No"<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
 
using namespace std;
#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>
#include <assert.h>
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<29;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
int rint() {int x;scanf("%d",&x);return x;}
ll rlong() {ll x;scanf("%lld",&x);return x;}

int main()
{
  int n=rint();
  vector<int> a(n);
  for (int i=0;i<n;i++) a[i]=rint();
  vector<pii> v;
  for (int d=0;d<2;d++) {
    map<int,int> h;
    for (int i=d;i<n;i+=2) {
      ++h[a[i]];
    }
    for (auto &w:h) v.PB(MP(w.snd,w.fst));
  }
  sort(v.begin(),v.end(),greater<pii>());
  int ans=v[0].fst;
  for (int i=1;i<v.size();i++) if (v[i].snd!=v[0].snd) {ans+=v[i].fst; break;}
  ans=n-ans;
  printf("%d\n",ans);
}



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

using namespace std;
using ll = long long;

int main() {
    int n = 0;
    cin >> n;

    if(n % 2 == 0){
        cout << n / 2 << endl;
    }else{
        cout << n / 2 + 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

A = []
for _ in range(H):
    A.append(list(input()))

cnt = 0
for aa in A:
    for aaa in aa:
        if aaa == '#':
            cnt += 1

if cnt == H + W - 1:
    print("Possible")
else:
    print("Impossible")


Measured memory_bytes: 9124
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll H, W;
  cin>>H>>W;
  ll s1, s2, s3;
  ll ans = big;
  vector<ll> S(3);
  for(ll i=1;i<H;++i) {
    s1 = i*W;
    if((H-i)*W%2==0) {
      s2 = (H-i)*W/2;
      s3 = (H-i)*W/2;
    }
    else {
      if(H-i<W) {
        s2 = (H-i)*(W/2);
        s3 = (H-i)*(W/2+1);
      }
      else {
        s2 = ((H-i)/2)*W;
        s3 = ((H-i)/2+1)*W;
      }
    }
    S[0] = s1;
    S[1] = s2;
    S[2] = s3;
    sort(S.begin(), S.end());
    ans = min(ans, S[2]-S[0]);
  }
  for(ll i=1;i<W;++i) {
    s1 = i*H;
    if((W-i)*H%2==0) {
      s2 = (W-i)*H/2;
      s3 = (W-i)*H/2;
    }
    else {
      if(W-i<H) {
        s2 = (W-i)*(H/2);
        s3 = (W-i)*(H/2+1);
      }
      else {
        s2 = ((W-i)/2)*H;
        s3 = ((W-i)/2+1)*H;
      }
    }
    S[0] = s1;
    S[1] = s2;
    S[2] = s3;
    sort(S.begin(), S.end());
    ans = min(ans, S[2]-S[0]);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

ll dp[3][100002];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,ans=0;
	cin>>n;
	vvl a(3,vl(n));
	rep(i,n)rep(j,3)cin>>a[j][i];
	rep(i,n){
		rep(j,3){
			rep(k,3){
				if(j!=k){
					dp[k][i+1]=max(dp[k][i+1],dp[j][i]+a[k][i]);
				}
			}
		}
	}
	rep(i,3)ans=max(ans,dp[i][n]);
	cout<<ans<<endl;
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

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


int main() {
	int n;
	cin >> n;
	vector<int> a(n+1);
	vector<int> L(n);
	vector<int> R(n + 1);
	FOR(i, 1, n) {
		cin >> a[i];
	}
	L[1] = a[1];
	FOR(i, 2, n - 1) {
		L[i] = GCD(L[i - 1], a[i]);
	}
	R[n] = a[n];
	RFOR(i, n-1, 2) {
		R[i] = GCD(R[i + 1], a[i]);
	}
	int res = max(L[n - 1], R[2]);
	FOR(i, 2, n - 1) {
		int tmp = GCD(L[i - 1], R[i + 1]);
		res = max(res, tmp);
	}
	pv(res)
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define mod 1000000007;
#define my_mod 2019;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int h,a;
    cin >> h >> a;
    cout << (h + a - 1) / a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

typedef long long ll;
//#define int long long
constexpr int INF = 1e9;

decltype(1) main() {
    int r;
    cin >> r;
    cout << r * r << endl;
    return 0;
}


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


int main() {
  
  int N;
  scanf("%d", &N );

  vector<int> boss( N+1 , 0 );

  for(int i=2; i<=N; i++){

    int a;
    scanf("%d",&a);
    boss[ a ] ++;

  }
  for(int i=1; i<=N; i++) printf("%d\n", boss[i] );

  return 0;

}

Measured memory_bytes: 4108
import sys
from collections import defaultdict
from copy import deepcopy
input = sys.stdin.readline

N = int(input())
edge = []
color_dict = {}
repn = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge.append((a, b))
    color_dict[(a, b)] = None
    repn[a].append(b)
    repn[b].append(a)

K = 1
q = [(0, None)]
while q:
    u, color = q.pop()
    if color == 1:
        c = 2
    else:
        c = 1
    for v in repn[u]:
        if color_dict[(u, v)] == None:
            color_dict[(u, v)] = c
            color_dict[(v, u)] = c
            q.append((v, c))
            K = max(K, c)
            c += 1
            if c == color:
                c += 1
                

print(K)
for pair in edge:
    print(color_dict[pair])


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

using namespace std;


int main() {
    int n, m, c;
    scanf("%d%d%d", &n, &m, &c);
    vector<int> b(m);
    vector<vector<int>> a(n, vector<int>(m));
    for(int i = 0; i < m; i++) {
        scanf("%d", &b[i]);
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int counter = c;
        for(int j = 0; j < m; j++) {
            counter += a[i][j] * b[j];
        }
        if(counter > 0) {
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3792
N = int(input())
f = True
t1,x1,y1 = 0,0,0
for i in range(N):
  t0,x0,y0 = t1,x1,y1
  t1,x1,y1 = map(int,input().split())
  d=(t1-t0)-abs(x0-x1)-abs(y0-y1)
  if 0<=d and (d&1)==0:
    pass
  else:
    f = False
print('Yes' if f else 'No')


Measured memory_bytes: 3188
from subprocess import*
with open('Main.java','w')as f:f.write(r"""
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(sc.next());
		Arrays.sort(a);
		boolean able = true;
		if (n % 2 > 0) {
			for (int i = 0; i < n; i++) {
				if (i % 2 == 0 && a[i] == i) continue;
				if (i % 2 > 0 && a[i] == i + 1) continue;
				able = false;
			}
		}
		else {
			for (int i = 0; i < n; i++) {
				if (i % 2 == 0 && a[i] == i + 1) continue;
				if (i % 2 > 0 && a[i] == i) continue;
				able = false;
			}
		}
		if (able) {
			long ans = 1;
			for (int i = 1; i <= n / 2; i++)
				ans = ans * 2 % 1000000007;
			System.out.println(ans);
		}
		else
			System.out.println("0");
	}
}
""")
call(('javac','Main.java'))
call(('java','Main'))

Measured memory_bytes: 103204
data = [input() for i in range(5)]
num_data = list(map(int, sorted([i for i in data if i[-1] != '0'],key=lambda x:x[-1],reverse=True)))

zero_data = list(map(int, [i for i in data if i[-1] == '0']))
res = 0
for i in range(len(num_data)):
    if i == len(num_data)-1:
        res += num_data[i]
    elif num_data[i] < 10:
        res += 10
    elif num_data[i] - 100 < 0:
        info = str(num_data[i])[0]
        res +=(int(info)+1) * 10
    else:
        info = str(num_data[i])[1]
        res += num_data[i] + ((int(info) + 1) * 10) - int(str(num_data[i])[-1]) -(int(info) * 10)
print(res + sum(zero_data))
        

Measured memory_bytes: 3064
#include<stdio.h>

void maxHeapipy(int*,int,int);

void maxHeapipy(int *tree,int i,int H)
{
  int left,right,max,a; /* aは交換用 */

  left = i*2;
  right = i*2+1;

  if(left <= H && tree[left] > tree[i]) {
    max =left;
  }else{
    max = i;
  }

  if(right <=H && tree[right] > tree[max])
    max = right;

  if(max != i) {
    a = tree[i];
    tree[i] = tree[max];
    tree[max] = a;
    maxHeapipy(tree,max,H);
  }
}

int main()
{
  int H,i;
  int tree[500000];

  scanf("%d",&H);
  
  for(i=1;i<=H;i++)
    scanf("%d",&tree[i]);

  for(i=H/2;i>=1;i--) 
    maxHeapipy(tree,i,H);

  for(i=1;i<=H;i++)
    printf(" %d",tree[i]);

  printf("\n");

  return 0;
}



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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (auto &it : A)
    cin >> it;
  ll G = A[0];
  for (int i = 1; i < N; i++)
  {
    G = gcd(G, A[i]);
  }
  sort(A.begin(), A.end());
  if (A[N - 1] >= K && K % G == 0)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}

// A1,..., AN全ての最大公約数をGとする．また，A1, ..., ANの最大値をMとする．Kの書かれたボールを箱の中に入れるための必要十分条件はKがGで割り切れるM以下の数であること．
// どんな操作をしても箱の中のボールに書かれた最大公約数はGのままであり，最大値はMのままである．ユークリッドの互除法のような操作を行うと，Gと書かれたボールを手に入れることが出来る．そのあとは，MとGとの差をとり，それとGとの差をとり，．．．というのを繰り返すことでM, M - G, M-2G, M-3G, ..., 2G, Gを得ることが出来る．したがって，Kを得ることが出来た．(Mは当然Gで割ることが出来る．)


Measured memory_bytes: 1024
a,b=map(int,input().split())
s=input()
num_list=["0","1","2","3","4","5","6","7","8","9"]
for i in range(a+b+1):
  if i==a:
    if s[i] != "-":
      print("No")
      exit()
  else:
    if s[i] not in num_list:
      print("No")
      exit()
print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>

using namespace std;

int main(){
	
	int n,k;
	cin >> n >> k;
	
	if(n<k){
		cout << "1" << endl;
		return 0;
	}else if(n==k){
		cout << "0" << endl;
		return 0;
	}else if(n>k){
		if(k==1){
			cout << "0" << endl;
			return 0;
		}else{
			int max=(n-(k-1))-1;
			cout << max << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace attocoda
{
    class Program
    {
        static void Main(string[] args)
        {
            String n;
            n = Console.ReadLine();
            char[] cs = n.ToCharArray();
            if (cs[0] == cs[2])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
const int N=200006;

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

	ll n,k;
	cin>>k>>n;
	if(k*500>=n)
		cout<<"Yes\n";
	else
	cout<<"No\n";
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var s int64 = 0
	var i int64 = 0
	for {
		i++
		if i > n {
			break
		} else {
			if i%3 != 0 && i%5 != 0 {
				s += i
			}
		}
	}
	fmt.Printf("%d", s)
}

Measured memory_bytes: 1760
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
 
void solve(){
  int n, m; cin >> n >> m;
  vector<int> a(n); int sum=0;
  FOR(i,0,n) {cin >> a[i]; sum += a[i];}
  sort(ALL(a));
  reverse(ALL(a));
  FOR(i,0,m) {if(a[i]< (double)sum/(4*(m))  ){cout << "No"; return;}}
  cout << "Yes";
}
 
int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;
typedef long long ll;


int main(){
        ll N, a;
        cin >> N;
        map<ll, ll> A;
        for(ll i=0; i<N; i++){
                cin >> a;
                A[a]++;
        }
        ll Count =0;
        for(auto v : A){
                if(v.second%2==1) Count++;
        }
        cout << Count;

}


Measured memory_bytes: 6528
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>


using namespace std;
#define MAX 100000

int main(){
    int D;
    int N;

    scanf("%d%d", &D, &N);

    if (0 == D){
        if (100 == N){
            printf("%d", N + 1);
        }
        else{
            printf("%d", N);
        }
    }
    else if (1 == D){
        if (100 == N){
            printf("%d", (N + 1) * 100);
        }
        else{
            printf("%d", N * 100);
        }
    }
    else{
        if (100 == N){
            printf("%d", (N + 1) * 10000);
        }
        else{
            printf("%d", N * 10000);
        }
    }
    return 0;
}

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

int main() {
  int h,w;
  int num;
  string line;
  
  cin >> h >> w >> num;
  vector<int> vec(h*w);
  
  int tmpi;
  int cnta = 0;
  for(int i = 1; i <= num; i++){
    cin >> tmpi;
    for(int j = 1; j <= tmpi; j++){
      vec.at(cnta) = i;
      cnta++;
    }
  }

  bool right = true;
  string tmp = "";
  int cnt = w;
  for(int i = 0; i < vec.size();i++){
    if(right == true){
      tmp += to_string(vec.at(i)) + " ";
      cnt--;
      if(cnt == 0){
        cout << tmp.substr(0,tmp.size()-1) << endl;
        tmp = "";
        right = false;
        cnt = w;
      }
    }else{
      tmp = to_string(vec.at(i)) + " " + tmp;
      cnt--;
      if(cnt == 0){
        cout << tmp.substr(0,tmp.size()-1) << endl;
        tmp = "";
        right = true;
        cnt = w;
      }
    }
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
const ll mod = 1e9 + 7;
 
#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))
 
ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }
 
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << " | ";
	err(++it, args...);
}
 
const ll inf = 1e18;
const int nax = 2e3 + 5;
 
vector<pll>g[nax];
ll dist[nax];

//considers 1-based indexing
void Dijkstra(ll src, ll n)	//src is the source vertex and n is the no. of vertices
{
	//set the distances of vertices to be inf initially
	forn(i, 1, n + 1)
	{
		dist[i] = inf;
	}
	dist[src] = 0;

	set<pll>NotBurnt;
	NotBurnt.insert({0,src});

	while(!NotBurnt.empty())
	{
		auto x = (NotBurnt.begin());
		ll v = (*x).second;

		NotBurnt.erase(x);	//in a way means added to burnt set of vertices

		for(auto p : g[v])
		{
			ll u = p.first;
			ll weight_vu = p.second;

			if(dist[u] > dist[v] + weight_vu)
			{
				NotBurnt.erase({dist[u],u});
				dist[u] = dist[v] + weight_vu;
				NotBurnt.insert({dist[u],u});
			}
		}
	}

}
 
int main()
{
	speedup_IO;
 
	int t = 1;
	//cin >> t;
	while (t--)
	{
		ll n,x,y;
		cin>>n>>x>>y;
		
		//cout<<n<<endl;
		
		forn(i,2,n+1)
		{
			g[i].pb({i-1,1});
			g[i-1].pb({i,1});
		}
		g[x].pb({y,1});
		g[y].pb({x,1});
		
		
		ll ans[n+1];
		reset(ans,0);
		
		forn(i,1,n+1)
		{
			Dijkstra(i,n);
			forn(j,1,n+1)
			{
				ans[dist[j]]++;
			}
		}
		forn(i,1,n)
		{
			cout<<ans[i]/2<<endl;
		}
	}
 
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
static const int N = 100;

int main() {
	int M[N][N];
	int n, u, k, v, i, j;

	cin >> n;

	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) {
			M[i][j] = 0;
		}
	}

	for ( i = 0; i < n; i++ ) {
		cin >> u >> k;
		u--;
		for ( j = 0; j < k; j++ ) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) {
			if( j ) cout << " ";
			cout << M[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define INF 1145141919810
#define ll long long
using namespace std;

ll n;
 
int main(){
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll sum=0;
    ll ans_1=0;
    ll ans_2=0;
    bool flag=true;
    rep(i,n){
        sum+=a[i];
        if(flag){
            if(sum>=0){
                ans_1+=abs(sum)+1;
                sum=-1;
            }
        }else{
            if(sum<=0){
                ans_1+=abs(sum)+1;
                sum=1;
            }
        }flag=!flag;
    }flag=false;
    sum=0;
    rep(i,n){
        sum+=a[i];
        if(flag){
            if(sum>=0){
                ans_2+=abs(sum)+1;
                sum=-1;
            }
        }else{
            if(sum<=0){
                ans_2+=abs(sum)+1;
                sum=1;
            }
        }flag=!flag;
    }cout<<min(ans_1,ans_2)<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

const int dy[] = {-1, -1, 0, 0, 1, 1}, dx[] = {-1, 0, -1, 1, 0, 1};
int n, k, in[100][100];
bool v[100][100];

bool rec(int y, int x, int &sz){
	v[y][x] = 1;
	sz++;
	bool res = 0;
	rep(d, 6){
		int ny = y + dy[d], nx = x + dx[d];
		if(ny < 0 || nx < 0 || ny >= n || nx > ny) continue;
		if(in[ny][nx] == 0){
			res = 1;
			continue;
		}
		if(in[ny][nx] != in[y][x] || v[ny][nx]) continue;
		res |= rec(ny, nx, sz);
	}
	return res;
}
int sc(){
	memset(v, 0, sizeof(v));
	int res = 0;
	rep(i, n) rep(j, i + 1) if(in[i][j] && !v[i][j]){
		int sz = 0;
		bool ok = rec(i, j, sz);
		if(!ok) res += in[i][j] == k ? -sz : sz;
	}
	return res;
}

int main(){
	while(cin >> n >> k, n){
		rep(i, n) rep(j, i + 1) cin >> in[i][j];
		
		int ans = -inf;
		rep(i, n) rep(j, i + 1) if(!in[i][j]){
			in[i][j] = k;
			ans = max(ans, sc());
			in[i][j] = 0;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
n,m = map(int,input().split())
p,x = 0,0
l = [tuple(map(int,input().split())) for i in range(n)]
l.sort()
for a in l:
    if m-a[1]>=1:
        p+=a[0]*a[1]
        m-=a[1]
    else:
        p+=a[0]*m
        m=0
        break
print(p)

Measured memory_bytes: 17004
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
x,y=gsmi
cnt=0
[x,y].each do |i|
  case i
  when 3
    cnt+=100_000
  when 2
    cnt+=200_000
  when 1
    cnt+=300_000
  end
end
cnt+=400_000 if x==1&&y==1

puts cnt

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

int main() {
  int X;
  cin >> X;
  int a=0;
  while(a!=1){
    int n=0;
    for(int i=1; i<=X; i++){
      if(X%i==0){
       n++;
     }
    }
    if(n==2){
      cout << X << endl;
      a=1;
    }
    X++;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <cstdint>
#include <numeric>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  char a;
  cin >> a;
  if('a' <= a && a <= 'z'){
    cout << "a" << endl;
  }else{
    cout << "A" << endl;
  }
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {
	public static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	public static void main(String args[]) {
		long c;
		Scanner scanner = new Scanner(System.in);
		long a = scanner.nextInt();
		long b = scanner.nextInt();
		c = gcd(a, b);
		System.out.println(c);

	}
}



Measured memory_bytes: 26204
# coding: utf-8

# 入力
s = input()
t = input()

# sort
s = "".join(sorted(s))
t = "".join(sorted(t, reverse=True))
st_list = [s, t]

# 出力
if s == t:
    print("No")
elif st_list == sorted(st_list):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = get!(String).chars().collect::<Vec<_>>();
    let mut i = 0;
    while s[i] != 'A' { i += 1; }
    let mut j = s.len()-1;
    while s[j] != 'Z' { j -= 1; }
    println!("{}", j-i+1);
}

Measured memory_bytes: 4352
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-9
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 300031;

int n;
vector<pair<int,int> > order;
int ttl,shit;
int a[N],b[N];

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
 //   cin.tie(0);

    cin>>n;
    for (int i=1;i<=n;i++){
    	cin>>a[i]>>b[i];
    	order.push_back(make_pair(b[i],i));
    }

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

    for (int i=0;i<order.size();i++){
    	int id=order[i].second;
    	ttl+=a[id];
    	if (ttl>b[id])
    		shit=1;
    }

    if (shit)
    	cout<<"No"<<endl;
    else
    	cout<<"Yes"<<endl;

//    cin.get(); cin.get();
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int n,m,x; cin>>n>>m>>x;
   vector<int> c(n); vector<int> a[15];
   rep(i,0,n){
      cin>>c[i]; a[i].resize(m);
      rep(j,0,m)cin>>a[i][j];
   }
   ll res=INF;
   rep(mask,0,1<<n){
      vector<int> sum(m,0); ll sub=0;
      rep(i,0,n)if(mask>>i&1){
         sub+=c[i];
         rep(j,0,m)sum[j]+=a[i][j];
      }
      bool f=1;
      rep(j,0,m)if(sum[j]<x){
         f=0; break;
      }
      if(f)chmin(res,sub);
   }
   if(res==INF)puts("-1");
   else cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 3636