akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node { int p, l, r;};

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i,c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if( T[u].p == NIL ) cout << "root, ";
  else if( T[u].l == NIL ) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for(i=0, c=T[u].l; c!=NIL; i++,c=T[c].r) {
    if(i) cout <<", ";
    cout << c;
  }
  cout << "]" << endl;
}

void rec(int u, int p) {
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(void) {
  int i,j,d,v,c,l,r;
  cin >> n;
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++) {
    cin >> v >> d;
    for(j=0;j<d;j++) {
      cin >> c;
      if(j==0) T[v].l=c;
      else T[l].r =c;
      l = c;
      T[c].p = v;
    }
  }
  for(i=0;i<n;i++) {
    if(T[i].p == NIL) r = i;
  }
  
  rec(r,0);
  
  for(i=0;i<n;i++) print(i);
  
  return 0;
}



Measured memory_bytes: 7696
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;

constexpr ll mod = 1000000007;
 
int main() {
    int n = 0;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }
    
    int cnt0 = 0;
    for (int x : a) {
        if (x == 0) {
            cnt0++;
        }
    }
 
    if (cnt0 > 3) {
        cout << 0 << endl;
        return 0;
    }
 
    ll color = (cnt0 == 1) ? 3 : 6;
 
    ll ans = 1;
    vector<int> cur(1e5, 0);
    for (int i=0; i<n; i++) {
        if (a.at(i) == 0) {
            cur.at(0)++;
        } else {
            ans *= cur.at(a.at(i)-1);
            ans %= mod;
            cur.at(a.at(i))++;
            cur.at(a.at(i)-1)--;
        }
    }
    
    cout << ans * color % mod << endl;
 
    return 0;
}


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

int main() {
    ll A; cin >> A;
    ll B; cin >> B;
    if(A + B == 3) cout << 3 << endl;
    if(A + B == 4) cout << 2 << endl;
    if(A + B == 5) cout << 1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


lli anss[50]={};
int main(void){
	lli k;
	scanf("%lld",&k);
	lli n=50;
	rep(i,n)anss[i]=n-1+(k/n);
	k = k % n;
	rep(i,k){
		rep(j,n){
			if(i==j)anss[j] += n;
			else anss[j]--;
		}
	}
	printf("%lld\n",n);
	rep(i,n){
		printf("%lld%c",anss[i],i+1==n?'\n':' ');
	}
	return 0;
}






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

public class Main {

	
	public static void main(String[] args) {
		FastScanner scanner=new FastScanner();
		int h=scanner.nextInt(),w=scanner.nextInt();
	   char a[][]=new char[h][w];
	   int dp[][]=new int[h][w];
	   int m=1000000007;
	   for(int i=0;i<h;i++) {
		   String string=scanner.next();
		   for(int j=0;j<w;j++) {
			  a[i][j]=string.charAt(j); 
		   }
	   }
	   
	   for(int i=0;i<w;i++)
	   {
		   if(a[0][i]=='#') break;
		   else dp[0][i]=1;
	   }
	   for(int i=0;i<h;i++)
	   {
		   if(a[i][0]=='#') break;
		   else dp[i][0]=1;
	   }
	   
	   for(int i=1;i<h;i++) {
		   for(int j=1;j<w;j++) {
			   if(a[i][j]=='#') dp[i][j]=0;
			   else {
				dp[i][j]=(dp[i-1][j]%m+dp[i][j-1]%m)%m;
			}
		   }
	   }
	   System.out.println(dp[h-1][w-1]);
	   
	   
	   
		

	}
	static class FastScanner{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0;i<n;i++) a[i]=nextInt();
			return a;
		}
		
		
	}

}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c, 0));
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            cin >> d[i][j];
        }
    }
    vector<vector<int>> s(n, vector<int>(n, 0));
    int m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> m;
            s[i][j] = m - 1;
        }
    }
    
    vector<int> c0(c, 0);
    vector<int> c1(c, 0);
    vector<int> c2(c, 0);
    for (int color = 0; color < c; color++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if ((i + j) % 3 == 0) {
                    c0[color] += d[s[i][j]][color];
                } else if ((i + j) % 3 == 1) {
                    c1[color] += d[s[i][j]][color];
                } else {
                    c2[color] += d[s[i][j]][color];
                }
            }
        }
    }

    int mn = 1000000000;    
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            if (i == j) {
                continue;
            }
            for (int k = 0; k < c; k++) {
                if (i == k || j == k) {
                    continue;
                }
                mn = min(mn, c0[i] + c1[j] + c2[k]);
            }
        }
    }

    cout << mn << endl;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

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


Measured memory_bytes: 256
from copy import copy
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
while True:
    n = int(input())
    if n == 0:
        break
    c = list(input().split())
    #### solve ####
    N = n
    V = [0 for i in range(26)]
    ans = 0
    for d in range(n):
        V[alp.find(c[d])] += 1
        N-=1
        T = copy(V)
        T.sort(reverse=True)
        if T[0]>T[1]+N:
            ans = d+1
            break
    if ans==0:
        print("TIE")
    else:
        print(alp[V.index(max(V))],ans)


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

typedef long long ll;

int main(){
	ll a,b,q;
	cin >> a >> b >> q;
	vector<ll> s(a+1,-1e18);
	vector<ll> t(b+1,-1e18);

	for(int i=1; i<=a; i++) cin >> s[i];
	s.push_back(1e18);
	for(int i=1; i<=b; i++) cin >> t[i];
	t.push_back(1e18);

	while(q--){
		ll x;
		cin >> x;
		
		int i = lower_bound(begin(s), end(s), x) - begin(s);
		int j = lower_bound(begin(t), end(t), x) - begin(t);
		ll res = 1e18;

		for(int ii: {i-1,i}){
			for(int jj: {j-1,j}){
				res = min(res,abs(s[ii]-x)+abs(t[jj]-s[ii]));
				res = min(res,abs(t[jj]-x)+abs(s[ii]-t[jj]));
			}
		}

		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 5644
n=int(input())
txy=[]
txy.append([0,0,0])
for _ in range(n):
    txy.append(list(map(int,input().split())))
ans = 'Yes'
for i in range(1,len(txy)):
    t_=txy[i][0]-txy[i-1][0]
    d_=abs(txy[i][1]-txy[i-1][1])+abs(txy[i][2]-txy[i-1][2])
    if t_ >= d_ and (t_ - d_) % 2 == 0:
        pass
    else:
        ans='No'
        break
print(ans)



Measured memory_bytes: 27300
N = int(input())
rob = []
for i in range(N):
    X, L = map(int, input().split())
    rob.append([X-L, X+L])
rob.sort(key=lambda x: x[1])
ans = N
for i in range(N-1):
    if rob[i+1][0] < rob[i][1]:
        rob[i+1][1] = rob[i][1]
        ans -= 1
print(ans)

Measured memory_bytes: 25516
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ


		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int res = 0;
		int[] B =new int[M] ;
		int[] A = new int[M];
		for(int i=0;i<M;i++) {
			B[i] = sc.nextInt();
		}
		for(int i = 0;i<N;i++) {
			int sum = C;
			for(int n = 0;n<M;n++) {
				A[n]=sc.nextInt();
			}
			for(int n = 0;n<M;n++) {
				sum += A[n]*B[n];
			}
			if(sum>0) {
				res++;
			}
		}
		System.out.println(res);
	}
}	

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

int H = 0, A[2000002];

int parent(int i){
	return i/2;
}

void heapIncreaseKey(int key){
	int i = H;
	if(key < A[i])
		printf("err\n");
	A[i] = key;
	while(i > 1 && A[parent(i)] < A[i]){
		swap(A[i], A[parent(i)]);
		i = parent(i);
	}
}

void insert(int key){
	H++;
	A[H] = INT_MIN;
	heapIncreaseKey(key);
}

void maxHeapify(int i){
    int l = 2*i;
    int r = l+1;

    int largest = (l <= H && A[l] > A[i]) ? l : i;
    if(r <= H && A[r] > A[largest]) largest = r;
    if(largest != i){
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int heapExtractMax(){
	if(H < 1)
		printf("err\n");
	int max = A[1];
	A[1] = A[H];
	H--;
	maxHeapify(1);
	return max;
}

int main(){
	char cmd[10];
	int arg = 0;
	for(;;){
		cin >> cmd;
		switch(cmd[2]){
		case 'd':
			return 0;
		case 't':
			printf("%d\n", heapExtractMax());
			break;
		default:
			cin >> arg;
			insert(arg);
			break;
		}
	}
}



Measured memory_bytes: 7032
ans :: [Double] -> [Double]
ans (a:b:ac:_) =
  let c = sqrt (a*a + b*b - 2*a*b*cos(2*pi*ac/360.0))
      s = 0.5 * a * b * sin(2*pi*ac/360.0)
      l = a + b + c
      h = 2 * s / a
  in
    (s:l:h:[])

main = do
  l <- getLine
  let i = map read $ words l :: [Double]
      o = ans i
  mapM_ print o

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

int main()
{
  int a,s,d;
  cin >> a >> s>>d;

  if(s>=d)
    cout << "delicious" << endl;
    else if(d-s<=a)
      cout << "safe" << endl;
      else
        cout << "dangerous" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define pl pair<ll,ll>
#define TC int t;cin>>t;while(t--)
#define in(n) ll n;cin>>n;
#define inarr(n) ll n;cin>>n;vector<ll>arr;
int main(void){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    in(n);in(k);
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    ll ans=0;
    for(int i=0;i<min(n,k);i++){
        ans+=arr[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int len = s.length();
        
        boolean first = true;
        boolean second = true;
        boolean third  = true;

        for(int i = 0; i < len; ++i){
            if(s.charAt(i) == s.charAt(len - 1 - i)) {
                first = true;
            }
            else {
                first = false;
                break;
            }
        }

        if(first) {
            for(int i = 0; i < (len - 1) / 2; ++i) {
                if(s.charAt(0) == s.charAt((len - 1) / 2 -1)) second = true;
                else {
                    second = false;
                    break;
                }
            }
            if(second){
                for(int i = (len + 3) / 2 - 1; i < len; ++i) {
                    if(s.charAt(i) == s.charAt(len - 1 - i)) third = true;
                    else {
                        third = false;
                        break;
                    }
                }
                if(third) System.out.println("Yes");  // 強い回文である
                else System.out.println("No");  // 回文だが3つめの条件を満たさない

            }
            else System.out.println("No");  //回文だが, 2つめの条件を満たさない

        }
        else System.out.println("No");  // そもそも回文でない


    }
}

Measured memory_bytes: 22740
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int t, n, u, d, i, a, b;

    t = sc.nextInt();
    for(;t-- > 0;){
      n = sc.nextInt();
      u = 0; d = 0;
      a = sc.nextInt();
      for(i = 1;i < n;i++){
        b = sc.nextInt();
        if(b - a > 0 && b - a > u)u = b - a;
        if(a - b > 0 && a - b > d)d = a - b;
        a = b;
      }
      out.println(u + " " + d);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 27668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const int MOD = (int)1e9+7;
//const long double PI = (acos(-1));
//const long double EPS = 0.0000000001;

const int MAX_N = 2500;
const int MAX_M = 5000;
int n, m, p;
vector<pii> adj[MAX_N];
bool visited[2500];
bool canVisit[2500];

bool dfs(int here) {
	if(visited[here]) {
		return canVisit[here];
	}
	visited[here] = true;
	for(int i=0; i<adj[here].size(); ++i) {
		int there = adj[here][i].first;
		if(dfs(there)) {
			canVisit[here] = true;
		}
	}
	return canVisit[here];
}

void dfsAll() {
	memset(visited, false, sizeof(visited));
	memset(canVisit, false, sizeof(visited));
	canVisit[n-1] = true;
	bool ret = dfs(0);
	if(!ret) {
		cout << "error" << endl;
	}
}

vector<int> ballmanFord(int src) {
	vector<int> upper(n, INF);
	upper[src] = 0;
	bool updated;

	for(int iter = 0; iter < n; ++iter) {
		updated = false;
		for(int here = 0; here < n; ++here) 
			for(int i = 0; i < adj[here].size(); i++) {
				int there = adj[here][i].first;
				int cost = adj[here][i].second;
				if(upper[there] > upper[here] + cost) {
					upper[there] = upper[here] + cost;
					updated = true;
				}
			}

		if(!updated) break;
	}

	if(updated) {
		vi before = upper;
		for(int here = 0; here < n; ++here) {
			for(int i=0; i<adj[here].size(); i++) {
				int there = adj[here][i].first;
				int cost = adj[here][i].second;
				if(upper[there] > upper[here] + cost) {
					upper[there] = upper[here] + cost;
				}
			}
		}
		vi after = upper;
		rep(i,0,n) {
			if(before[i] != after[i] && canVisit[i]) {
				upper.clear();
				break;
			}
		}
	}
	return upper;
}

int main(void) {
	ios_base::sync_with_stdio(false); 
	cin.tie(0); 
	cout.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> n >> m >> p;
	rep(i,0,m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		c = -(c - p);
		adj[a].pb(mp(b, c));
	}
	rep(i,0,n) {
		sort(all(adj[i]));
	}
	dfsAll();

	vi ret = ballmanFord(0);
	if(ret.empty()) {
		cout << -1 << endl;
	} else {
		cout << max(0, -ret[n-1]) << endl;
	}
	return 0;
}


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

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

    vector<long long> A(n);
    vector<long long> B(n);
    for(long long i=1; i<n; i++){
        cin >> A.at(i);
        B.at(A.at(i)-1)++;
    }

    for(long long i=0; i<n; i++){
        cout << B.at(i) << endl;
    }
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define se set<ll>
#define vec vector<ll>
#define inf 10000000000000000
bool mark[100005];
vec adj[100005];
ll counter;

	




int main()
{    
 

	#ifdef APNA_IO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 

ll n;
ll c=0;
cin>>n;
vec v;
ll a[n];
ll b[n];

for(ll i=0;i<n;i++)
{
	cin>>a[i];
	b[i]=a[i];

}

sort(b,b+n);

for(ll i=0;i<n;i++)
{
	if(a[i]!=b[i])
		c++;
}

if(c>2)
cout<<"NO \n";
else
cout<<"YES \n";


}		





Measured memory_bytes: 2560
#include <iostream>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
using namespace std;
struct node{
    int x;
    int y;
    int step;
};
int xx[4] = {0,1,0,-1};
int yy[4] = {1,0,-1,0};
int n,m;
char maze[1005][1005];
bool visited[1005][1005];
queue<node> Q;
int bfs(){
    node top;
    while(!Q.empty()){
        top = Q.front();
        Q.pop();
        //cout << top.x << " " << top.y << " " << top.step << endl;
        for(int i = 0;i < 4;i++){
            int newx = top.x + xx[i];
            int newy = top.y + yy[i];
            if(newx < 0 || newy < 0 || newx >= n || newy >= m) continue;
            if(visited[newx][newy] || maze[newx][newy] == '#') continue;
            node temp;
            visited[newx][newy] = 1;
            temp.x = newx;
            temp.y = newy;
            temp.step = top.step + 1;
            Q.push(temp);
        }
    }
    return top.step;
}
int main(){
    cin >> n >> m;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            cin >> maze[i][j];
            if(maze[i][j] == '#'){
                node t;
                t.x = i;
                t.y = j;
                t.step = 0;
                Q.push(t);
            }
        }
    }
    int ans = bfs();
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13328
import java.util.*;

class Main{       
   public static void main(String[] args){

      Scanner sc = new Scanner(System.in);                                            
  
      long N = sc.nextLong();
      long M = sc.nextLong();

      if(M >= 2*N){
          System.out.println(N + (M-2*N)/4);                    
      }else{
          System.out.println(M/2);          
      }
      
     
   }
}
        

Measured memory_bytes: 22996
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
        
    int x;
    void solve()
    {
        cin>>x;
        cout<<1-x<<endl;
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }

Measured memory_bytes: 3620
#include <cassert>

template <class Monoid, template <class> class Container> class segment_tree {
public:
	using value_structure = Monoid;
	using value_type = typename value_structure::value_type;
	using container_type = Container<value_type>;
	using const_reference = typename container_type::const_reference;
	using size_type = typename container_type::size_type;

private:
	size_type base_size;
	container_type c;
	static size_type getsize(const size_type size) {
		size_type ret = 1;
		while (ret < size)
			ret <<= 1;
		return ret;
	}
	void recalc(const size_type index) {
		c[index] = value_structure::operation(c[index << 1], c[index << 1 | 1]);
	}

public:
	segment_tree() : base_size(0), c() {}
	explicit segment_tree(const size_type size)
		: base_size(getsize(size)),
		c(base_size + size, value_structure::identity()) {}

	bool empty() const { return size() == 0; }
	size_type size() const { return c.size() - base_size; }

	const_reference operator[](const size_type index) const {
		assert(index < size());
		return c[index + base_size];
	}
	value_type fold(size_type first, size_type last) const {
		assert(first <= last);
		assert(first <= size());
		assert(last <= size());
		value_type ret_l = value_structure::identity(),
			ret_r = value_structure::identity();
		for (first += base_size, last += base_size; first < last;
			first >>= 1, last >>= 1) {
			if (first & 1)
				ret_l = value_structure::operation(ret_l, c[first++]);
			if (last & 1)
				ret_r = value_structure::operation(c[last - 1], ret_r);
		}
		return value_structure::operation(ret_l, ret_r);
	}
	template <class F> size_type search(const F &f) const {
		if (f(value_structure::identity()))
			return 0;
		if (!f(c[1]))
			return size() + 1;
		value_type acc = value_structure::identity();
		size_type i = 1;
		while (i < base_size)
			if (!f(value_structure::operation(acc, c[i <<= 1])))
				acc = value_structure::operation(acc, c[i++]);
		return i - base_size + 1;
	}

	void update(size_type index, const value_type &value) {
		assert(index < size());
		index += base_size;
		c[index] = value;
		while (index >>= 1)
			recalc(index);
	}
};

#include <algorithm>
#include <limits>
template <class T> class min_monoid {
public:
	using value_type = T;
	static value_type operation(const value_type &x, const value_type &y) {
		return ::std::min(x, y);
	}
	static value_type identity() {
		return 2147483647;
	}
	static value_type reverse(const value_type &x) { return x; }
};

#include <iostream>
#include <vector>

template<class T> using vec_alias = ::std::vector<T>;

int main() {
	int n, q;
	::std::cin >> n >> q;

	segment_tree<min_monoid<int>, vec_alias> seg(n);

	while (q--) {
		int c, x, y;
		::std::cin >> c >> x >> y;

		if (c)
			::std::cout << seg.fold(x, y + 1) << ::std::endl;
		else
			seg.update(x, y);
	}

	return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
		vector<vector< int> > dp;
 string s,t;
	cin>>s>>t;

int n = s.size(), m= t.size();
 
	dp.assign(m+1, vector< int> (n+1,0));
	dp[0][0]=1;
	
	
	for(int i=1; i<=m; ++i){
		for(int j=1; j<=n; ++j){
			if(i==0 || j==0) dp[i][j]=0;
			
			else if(t[i-1]==s[j-1]) dp[i][j] = 1+ dp[i-1][j-1];
			else {
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	// cout<<dp[m][n]<<'\n';
	string ans="";
  long i=m;
  long j=n;
  while(i>0 && j>0){
    if(t[i-1]==s[j-1]){
      ans+= t[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>dp[i][j-1]){
      i--;
    }
    else{
      j--;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;

//hare
	return 0;
}


Measured memory_bytes: 38576
#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <bits/stdc++.h>
#include <cassert>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP

using namespace std;
using namespace atcoder;

int main(){
  int n,m;
  cin >> n >> m;
  dsu d(n);
  for(int i=0;i<m;i++){
    int u,v;
    cin >> u >> v;
    u--;
    v--;
    d.merge(u,v);
  }
  
  auto tmp = d.groups();
  cout << (int)tmp.size()-1 << endl;
  return(0);
}


Measured memory_bytes: 8876
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

ll n,k,ans,count = 0;

cin >> n >> k;
ans = n;

while(1){
    ans = ans / k;
    count++;
    if(ans == 0) break;
}
cout << count << endl;

//////////////////////////////////////////////////////
return 0;}

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

int main(void){
  int num, v, i, j;
  cin >> num;
  int* a = new int[num];
  while(cin >> v){
        a[i++] = v;
  }
  v = 1;
  for (i = 1; i < num; ++i) {
    for (j = 0; j < i; ++j) {
      if (a[j] > a[i]) {
        break;
      }
    }
    
    if (i == j) {
      ++v;
    }
  }
  cout << v << endl;
}


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

using ll = long long;
using K = long double;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SIZE(a) ((int)(a).size())

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

	int n;
	cin >> n;
	int t, x, y;
	t = x = y = 0;
	REP(i, n) {
		int nt, nx, ny;
		cin >> nt >> nx >> ny;
		int dst = abs(x - nx) + abs(y - ny);
		if (dst > nt - t || dst % 2 != (nt - t) % 2) {
			cout << "No\n";
			return 0;
		}
		x = nx; y = ny; t = nt;
	}

	cout << "Yes\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i,n) for (int i=1; i<=n; i++)
#define FF(i,n) for (int i=0; i<n; i++)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define re(x) (int)x.size()
#define pi pair < int , int >
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
const int N = 3e5+228;
const int big = 2e9;
int n,a[N],f[N];
void up(int &x,int y){x=max(x,y);}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
    cin>>n;
    F(i,n) cin>>a[i];
    F(i,n){
        up(f[a[i]],1);
        up(f[a[i]],f[a[i]-1]+1);
    }
    int mx=0;
    F(i,n) mx=max(mx,f[a[i]]);
    cout<<n-mx<<endl;
    return 0;
}


Measured memory_bytes: 1792
from itertools import combinations

S=input()
N=len(S)
ans=int(S)
for i in range(1,N):
	for v in combinations(range(1,N),i):
		p=0
		for j in v:
			ans+=int(S[p:j])
			p=j
		ans+=int(S[p:])

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    string S;
    cin >> S;
    vector<int> ans(S.size());
    
    int cnt = 0;
    for(int i = 0; i < S.size(); ++i){
        if(S[i] == 'R'){
            cnt++;
        }else{
            ans[i-1] += (cnt+1)/2;
            ans[i] += cnt/2;
            cnt = 0;
        }
    }
    reverse(S.begin(), S.end());
    reverse(ans.begin(), ans.end());
    cnt = 0;
    for(int i = 0; i < S.size(); ++i){
        if(S[i] == 'L'){
            cnt++;
        }else{
            ans[i-1] += (cnt+1)/2;
            ans[i] += cnt/2;
            cnt = 0;
        }
    }
    reverse(ans.begin(), ans.end());

    for(int i = 0; i < S.size(); ++i){
        if(i == S.size()-1){
            cout << ans[i] << endl;
        }else{
            cout << ans[i] << " ";
        }
    }


    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long

const int mxn = 1e3, mod = 1e9+7;

using namespace std;

int dp[mxn+1][mxn+1], grid[mxn+1][mxn+1];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(dp, 0, sizeof(dp)/sizeof(int));
    int n, m; 
    cin>>n>>m;
    
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            char x;
            cin>>x;
            if(x == '#')
                grid[i][j] = 0;
            else
                grid[i][j] = 1;
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if(!grid[i][j])
                continue;
            if(i == 1 && j == 1)
                dp[i][j] = 1;
            else
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
        }
    }
    cout<<dp[n][m]<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	int N,M;cin>>N>>M;
  vector<pair<ll,ll>> AB;
  rep(i,N){
    int a,b;cin>>a>>b;
    AB.push_back({a,b});
  }

  sort(all(AB));

  //DEBUG(AB);

  ll ans = 0;
  rep(i,N){
    if(M==0)break;
    auto p = AB[i];
    if(M > p.second){
      ans += p.first * p.second;
      M -= p.second;
      //DEBUG(p, M);
    }else{
      ans += p.first * M;
      M = 0;
    }
  }
  cout<<ans<<endl;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

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

    string s;
    cin >> s;
    int ans = 1e9;
    REP(i, s.size() - 2) {
        string t = s.substr(i, 3);
        int n = stoi(t);
        ans = min(ans, abs(n-753));
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int x;
  cin >> x;
  if (x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int P = sc.nextInt();
        char[] s = sc.next().toCharArray();
        int[] keta = new int[N];
        for(int i=0;i<N;i++){
            keta[i] = s[i]-'0';
        }

        long sum=0;
        if(P == 2 || P == 5){
            for(int i=0;i<N;i++){
                if(keta[i] % P == 0){
                    sum += (i+1);
                }
            }
            System.out.println(sum);
            return;
        }
        int[] S = new int[N];
        for(int i=0;i<N;i++){
            S[i] = keta[N-1-i];
        }
        int[] A = new int[N+1];
        int m10 = 1;
        A[0]=0;
        Map<Integer, Integer> cnts = new HashMap<>();
        cnts.put(0, 1);
        for(int k=0;k<N;k++) {
            A[k + 1] = (S[k] % P) * m10 + A[k];
            A[k + 1] %= P;
            m10 *= 10;
            m10 %= P;
            cnts.computeIfAbsent(A[k+1], (i)->0);
            cnts.put(A[k+1], cnts.get(A[k+1])+1);
        }
        for(Integer p:cnts.values()){
            long cn = (long)p;
            sum += cn*(cn-1)/2;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 43784
n,m = map(int,input().split())
l = [list(input()) for i in range(n)]
for i in range(n):
    for j in range(m):
        if l[i][j] == "#":
            count = 0
            if 0 < i and l[i-1][j] == "#":
                count += 1
            if 0 < j and l[i][j-1] == "#":
                count += 1
            if i != n-1 and l[i+1][j] == "#":
                count += 1
            if j != m-1 and l[i][j+1] == "#":
                count += 1
            if count == 0:
                print("No")
                exit()
print("Yes")

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

char s[2000005];

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    scanf("%s", s + 1);
    bool check = 1;
    for (int i = b; i < d; ++i)
        if (s[i] == '#' && s[i + 1] == '#')
            check = 0;
    for (int i = a; i < c; ++i)
        if (s[i] == '#' && s[i + 1] == '#')
            check = 0;
    if (c > d) {
        bool ok = 0;
        for (int i = b; i <= d; ++i)
            if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')
                ok = 1;
        if (!ok) check = 0;
    }
    puts(check ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(i*j==n){
				cout<<"Yes";
				return 0;
			}
			
		}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
const int SENTINEL=2000000000;

long long  merge(int A[],int n,int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	int *L=new int[n1+1];
	int *R=new int[n2+1];
	for(int i=0;i<n1;++i) L[i]=A[left+i];
	for(int i=0;i<n2;++i) R[i]=A[mid+i];
	L[n1]=R[n2]=SENTINEL;
    int i=0,j=0;
    long long cnt=0;
    for(int k=left;k<right;k++){
    	
    	if(L[i]<=R[j])A[k]=L[i++];
    	else {
    		cnt+=n1-i;
    		A[k]=R[j++];
    	}
    }
    delete L;
    delete R;
    return cnt;

}
long long  mergeSort(int A[],int n,int left,int right){
   long long v1,v2,v3;
   if(left+1<right){
   		int mid=(left+right)/2;
   		v1=mergeSort(A,n,left,mid);
   		v2=mergeSort(A,n,mid,right);
   		v3=merge(A,n,left,mid,right);
   		return v1+v2+v3;
   }
   else return 0;
}
int main(){
	int n;
	cin>>n;
	int *A=new int[n];
	for(int i=0;i<n;++i)cin>>A[i];

	long long cnt=mergeSort(A,n,0,n);
		
	cout<<cnt<<endl;
	delete A;
	return 0;
}


Measured memory_bytes: 4324
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		List<Integer> list = new ArrayList<Integer>();

		while (true) {
			String line = reader.readLine();
			if (line.equals("0,0")) {
				break;
			}
			int a = Integer.parseInt(line.split(",")[1]);
			list.add(a);
		}
		List<Integer> sortList = new ArrayList<Integer>();
		sortList.addAll(list);
		Collections.sort(sortList);
		Map<Integer, Integer> memo = new HashMap<Integer, Integer>();
		int count = 1;
		int now = Integer.MAX_VALUE;
		for (int i = sortList.size() - 1; i >= 0; i--) {
			if (now > sortList.get(i)) {
				memo.put(sortList.get(i), count);
				now = sortList.get(i);
				count++;
			}
		}

		String line2;
		while ((line2 = reader.readLine()) != null) {
			if (line2.isEmpty())
				break;
			int num = Integer.parseInt(line2);
			System.out.println(memo.get(list.get(num-1)));
		}
	}
}

Measured memory_bytes: 16916
///"    "\\\

# include <bits/stdc++.h>

# define pb push_back

using namespace std;

int k , z = 0 , o , p = 0 ;

	
int main() {


	int m = 3 ;
	int a[m][m];
	for(int i = 0 ; i < m ; i ++ ){
		for(int j = 0 ; j < m ; j ++ ){
			cin >> a[i][j] ;
		}
	}

	int n ;
	cin >> n ;
	for(int u = 0 ; u < n ; u ++ ){
		int h ;
		cin >> h ;
		for(int i = 0 ; i < m ; i ++ ){
			for(int j = 0 ; j < m ; j ++ ){
				if( a[i][j] == h ){
					a[i][j] = 0 ;
				}
			}
		}
	}

	int ans = 0 ;

	if( a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0 ){
		ans = 1 ;
	}
	else if( a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0 ){
		ans = 1 ;
	} 
	else if( a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0 ){
		ans = 1 ;
	}
	else if( a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0 ){
		ans = 1 ;
	}
	else if( a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0 ){
		ans = 1 ;
	}
	else if( a[1][0] == 0 && a[0][0] == 0 && a[2][0] == 0 ){
		ans = 1 ;
	}
	else if( a[1][1] == 0 && a[0][1] == 0 && a[2][1] == 0 ){
		ans = 1 ;
	}
	else if( a[1][2] == 0 && a[0][2] == 0 && a[2][2] == 0 ){
		ans = 1 ;
	}

	if( ans == 1 ){
		cout << "Yes" << endl ;
	}
	else{
		cout << "No" << endl ;
	}

}

///"    "\\\

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
struct node{
int t,s;
}a[100005];
int mmp(node x,node y)
{
    return x.t<y.t;
}
int main()
{
    long long sum=0;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&a[i].t,&a[i].s);
    }
    sort(a+1,a+n+1,mmp);
    sum=a[n].s+a[n].t;
    printf("%lld\n",sum);
    return 0;
}

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

Mh = [[-10000000 for _ in range(W)] for _ in range(H)]
Mw = [[-10000000 for _ in range(W)] for _ in range(H)]

for h in range(H):
    w = 0
    while w < W:
        if S[h][w] == "#":
            w += 1
            continue
        start = w
        count = 0
        while w + count < W and S[h][w + count] == ".":
            count += 1
        for x in range(start, w + count):
            Mh[h][x] = count
        w = w + count


for w in range(W):
    h = 0
    while h < H:
        if S[h][w] == "#":
            h += 1
            continue
        start = h
        count = 0
        while h + count < H and S[h+count][w] == ".":
            count += 1
        for x in range(start, h + count):
            Mw[x][w] = count
        h = h + count

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, Mh[h][w]+Mw[h][w] -1)

print(ans)

Measured memory_bytes: 126680
N,K = map(int,input().split())
A = list(map(int,input().split()))

ans1 = 0
ans2 = 0
MOD = 10 ** 9 +7
for i in range(N):
  for j in range(i+1,N):
    if A[i] > A[j]:
      ans1 += 1
  if K > 1:
    for j in range(N):
      if A[i] > A[j]:
        ans2 += 1
print((ans1 * K + ans2 * K*(K-1)//2) % MOD)


Measured memory_bytes: 42220
'use strict'

function Main(input) {
    const split_input = input.split("\n");
    const n = parseInt(split_input[0].split(' ')[0]);
    const x = split_input[0].split(' ')[1];
    const prices = [];
    let sum = 0;
    for (let index = 1; n > prices.length; index++) {
        let price = parseInt(split_input[index]);
        prices.push(price);
        sum += price;
    }
    const min_price = prices.reduce((a, b) => a < b ? a : b);

    console.log(n + Math.floor((x - sum) / min_price));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
int main() {
    int n;
    long hp,r=0;
    cin >> n >> hp;
    vector<long> a(n),b(n);
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());

    int lastI = 0;
    for(int i=n-1; i>=0; i--){
        if(b[i] < a[n-1]){
            lastI = i + 1;
            break;
        }
    }

    int j = n-1;
    while(hp > 0){
        hp -= b[j];
        r++;
        if(j == lastI){
            if (hp <= 0) break;
            r += hp / a[n-1];
            if (hp % a[n-1] != 0) r++;
            break;
        }
        j--;
    }

    cout << r << endl;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES    
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define quickIO()   {cin.tie(0);    cout.sync_with_stdio(false);}
#define rep(i,n)    for(ll i=0; i<(ll)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define fcout cout << fixed << setprecision(10) 
const ll inf = 1e18;
const ll mod = 1e9 +7;
     
ld sqrtld(ld x){
    ld left = 0, right = x;
    rep(i, 100){
        ld mid = (left + right)/2;
        if (mid*mid <= x)   left =mid;
        else    right = mid;
    }
    return left;
}



int main (){
    int x=0;
    int y=110;
    rep(i,3){
        int a;
        cin >> a;
        y = min(y,a);
        x = max(x,a);
    }
    cout << x-y << endl;


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    int p[k+1];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<k+1;i++)p[i]=-1;
    for(int i=0;i<k+1;i++){
        for(int j=0;j<n;j++){
            if(i+a[j]<=k)if(p[i+a[j]]!=1)p[i+a[j]]=-1*p[i];
        }
    }
    if(p[k]==1)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 768
import itertools as it
n=int(input())
ans=0
for nn in range(3,10):
    l=[ i for i in it.product(['3','5','7'], repeat=nn)]
    for ll in l:
        if int(''.join(ll)) <= n:
            if len(set(ll)) ==3:
                ans+=1

print(ans)

Measured memory_bytes: 46320
import Control.Applicative

main :: IO()
main = do
    _ <- getLine
    a1 <- map read . words <$> getLine
    a2 <- map read . words <$> getLine
    print $ maxsum (zipWith (-) (tail a1) (init a2)) + head a1 + sum a2
        where
            maxsum a = maxsum' a 0 0
            maxsum' [] _ m = m
            maxsum' (a:as) s m = maxsum' as s' $ if s' > m then s' else m
                where s' = a + s

Measured memory_bytes: 1020
#include <iostream>

using namespace std;

int bubbleSort(int A[], int N) {
    bool flag = 1;
    int i = 0;

    while ( flag ) {
        flag = 0;
        for ( int j = N - 1; j > 0; j-- ) {
            if ( A[j] < A[j - 1]) {
                swap(A[j], A[j - 1]);
                flag = 1;
                i++;
            }
        }
    }

    return i;
}
int main()
{
    int A[100], N;
    int sw;

    cin >> N;

    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }

    sw = bubbleSort(A, N);

    for ( int i = 0; i < N; i++ ) {
        if ( i > 0 )
            cout << " ";
        cout << A[i];
    }

    cout << endl;
    cout << sw << endl;

    return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <iomanip>


using namespace std;

int main() {

    int a, b, d, r;
    double f;
    cin >> a >> b;
    
    d = a / b;
    r = a % b;
    f = (double) a / (double)b;
    cout << d << " "<< r << " "<< fixed << setprecision(5) << f << endl;
    
    return 0;
}

Measured memory_bytes: 1244