akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	static long solve(long x, long k, long d) {
		x = Math.abs(x);
		long q = x / d;
		long r = x % d;
		if (q >= k)
			return x - d * k;
		long remaining = k - q;
		if (remaining % 2 == 0)
			return r;
		else
			return d - x % d;
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long x, k, d;

		x = stdIn.nextLong();
		k = stdIn.nextLong();
		d = stdIn.nextLong();
		System.out.println(solve(x, k, d));

		stdIn.close();
	}
}


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

int main()
{

    long long n,m,i,j,k,a,b,e=-999999999999999,f=99999999999999,g=-9999999999999999,h=99999999999999;

    scanf("%lld",&n);

    for(i=1;i<=n;i++)
    {

        scanf("%lld %lld",&a,&b);

        if(a+b>e)e=a+b;
        if(a+b<f)f=a+b;

        if(a-b>g)g=a-b;
        if(a-b<h)h=a-b;

    }

    printf("%lld\n",max(e-f,g-h));



    return 0;
}


Measured memory_bytes: 3800
#include <stdio.h>

int main (void){
	int a, b;

	scanf("%d %d", &a, &b);

	if((a + b) % 2  == 0){
		printf("%d\n", (a + b) / 2);
	}else{
		printf("IMPOSSIBLE\n");
	}

	return 0;
}

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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n;

PII A[maxn];

int id[maxn],l[maxn],r[maxn];

struct Node{
	int l,r,sm;
}T[maxn<<2];

void build(int i,int l,int r){
	T[i].l=l;T[i].r=r;T[i].sm=(l==0);
	if(l==r)return;
	int M=l+r>>1;
	build(i<<1,l,M);build(i<<1|1,M+1,r);
}

int query(int i,int l,int r){
	if(l<=T[i].l&&T[i].r<=r)return T[i].sm;
	int M=T[i].l+T[i].r>>1,ans=0;
	if(l<=M)ans=(ans+query(i<<1,l,r))%mod;
	if(r>M)ans=(ans+query(i<<1|1,l,r))%mod;
	return ans;
}

void update(int i,int x,int y){
	T[i].sm=(T[i].sm+y)%mod;
	if(T[i].l==T[i].r)return;
	int M=T[i].l+T[i].r>>1;
	if(x<=M)update(i<<1,x,y);else update(i<<1|1,x,y);
}

bool cmp(int x,int y){
	return A[x].se<A[y].se;
}

void Work(){
	sort(A+1,A+n+1);
	build(1,0,n);
	REP(i,1,n)update(1,A[i].se,query(1,A[i].fi-1,A[i].se));
	iout(query(1,n,n));
}

void Init(){
	read(n);
	REP(i,1,n)read(A[i].se,A[i].fi);
	sort(A+1,A+n+1);
	REP(i,1,n)id[i]=i;
	sort(id+1,id+n+1,cmp);
	int mn=n+1;
	RREP(i,n,1){
		mn=min(mn,id[i]);
		l[i]=mn;
	}
	int mx=0;
	REP(i,1,n){
		mx=max(mx,id[i]);
		r[i]=mx;
	}
	REP(i,1,n)A[i]=MP(l[i],r[i]);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 13568
li = list(input())
k=int(input())

if li.count('1')==len(li):
    print(1)
else:
    for i in range(len(li)):
        if li[i]!='1' and i+1<=k:
            print(li[i])
            break
        elif li[i]!='1' and i+1>k:
            print(1)
            break


Measured memory_bytes: 3060
ns=input()

nsl=ns.split(' ')

nsc=[]
for i in range(3):
  nsc.append(nsl.count(nsl[i]))

if nsc[0]==nsc[1]==nsc[2]==1:
  print('3')
elif nsc[0]==2 or nsc[1]==2:
  print('2')
else:
  print('1')

Measured memory_bytes: 3060
H, W, D = map(int, input().split())
position = {}

for h in range(H):
    L = list(map(int, input().split()))
    for w in range(W):
        position[L[w] - 1] = (h, w)

cost = [0] * (H * W)
for r in range(D):
    for j in range(r + D, H *W, D):
        A = position[j]
        B = position[j - D]
        cost[j] = cost[j - D] + abs(A[0] - B[0]) + abs(A[1] - B[1])

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    print(cost[R - 1] - cost[L - 1])


Measured memory_bytes: 22608
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N), B(N);
	rep(i, N) cin >> A[i] >> B[i];
	int m, M;
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	if (N & 1) {
		m = A[(N - 1) / 2];
		M = B[(N - 1) / 2];
	} else {
		m = (A[N / 2] + A[N / 2 - 1]);
		M = (B[N / 2] + B[N / 2 - 1]);
	}
	cout << M - m + 1 << endl;
	return 0;
}

Measured memory_bytes: 6364
#include<stdio.h>
int main(){
  int x,y,c,h;

  while(scanf("%d%d",&x,&y)!=EOF)
    {
      while(y!=0)
	{
	  x=x%y;
	  h=x;
	  x=y;
	  y=h;
	}

      printf("%d\n",x);
    }    
  return 0;
}

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

int main(void) {
  // N 箱、M移動回数
  int N, M;
  std::cin >> N >> M;

  //x → yに移動
  std::vector<int> x, y;
  int X, Y;
  while(std::cin >> X >> Y) {
    x.push_back(X);
    y.push_back(Y);
  }

  //箱　全てにはじめ 1 個
  std::vector<int> box;
  for(int i = 0; i < N; i++){
    box.push_back(1);
  }

  //赤が入った箱
  std::vector<int> red;
  for(int i = 0; i < N; i++){
    if(i == 0) {
      red.push_back(1);    
    } else {
      red.push_back(0);    
    }
  }

  int x_num, y_num;
  for(int i = 0; i < M; i++){
    x_num = x[i] - 1;//配列0始まり
    y_num = y[i] - 1;
    
    //移動
    box[x_num] = box[x_num] - 1;
    box[y_num] = box[y_num] + 1;

    // x_numに赤があったことあるなら,移動後のy_numに可能性がある。
    if(red[x_num] > 0) {
      red[y_num] = 1;
    }
    // x_numが空になったら、x_numには可能性がなくなる。
    if(box[x_num] == 0) {
      red[x_num] = 0;
    }
    
  }
  
  int result = 0;
  for(auto ite = red.begin(); ite != red.end(); ite++){
    if(*ite > 0){
      result++;
    }
  }
  std::cout << result << std::endl;
  
  return 0;
}

Measured memory_bytes: 2164
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n,q;
    string s;
    cin>>n>>q>>s;
    vector<int> l(q,0),r(q,0);
    rep(i,q){
        cin>>l[i]>>r[i];
    }
    vector<int> v(s.size(),0);
    int now=0;
    rep(i,s.size()-1){
        //cout<<s[i]<<s[i+1]<<endl;
        if(s[i]=='A'){
            if(s[i+1]=='C'){
                now++;
                v[i+1]=now;
            }
            else v[i+1] = v[i];
        }
        else v[i+1]=v[i];
    }
    //rep(i,n) cout<<v[i]<<endl;
    rep(i,q){
        l[i]--;
        r[i]--;
    }
    rep(i,q){
        cout<<v[r[i]]-v[l[i]]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int a, b, c; cin >> a >> b >> c;
  cout << (a+b+c >= 22 ? "bust" : "win") << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 998244353, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

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

  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n) {
    ll add = a[i];
    (add *= mypow(1 + a[i], i, MOD)) %= MOD;
    (add *= mypow(2, n - i - 1, MOD)) %= MOD;
    (ans += add) %= MOD;
  }
  Cout(ans);
  return 0;
}


Measured memory_bytes: 10912
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	K, _ := strconv.Atoi(read())
	Q, _ := strconv.Atoi(read())

	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = K - Q
	}
	for i := 0; i < Q; i++ {
		t, _ := strconv.Atoi(read())
		a[t-1]++
	}

	for i := 0; i < N; i++ {
		if 0 < a[i] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 3968
import heapq
n,k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for left in range(n+1):
    for right in range(left, n+1):
        have = []
        heapq.heapify(have)
        i = 0
        while i < left:
            heapq.heappush(have, v[i])
            i += 1
        cost = left + (n - right)
        if cost > k:
            continue
        i = n-1
        while i >= right:
            heapq.heappush(have, v[i])
            i -= 1
        while k - cost > 0 and len(have) > 0:
            value = heapq.heappop(have)
            if  value >= 0:
                heapq.heappush(have,value)
                break
            cost += 1
        #print("left:{} right:{} ans:{}".format(left, right, sum(have)))
        ans = max(ans, sum(have))
print(ans)




Measured memory_bytes: 52700
#include<stdio.h>
#define MAX 2000001
#define LEN  8
#define INFTY -1


int h = 0;
int a[MAX];



void heapIncreaseKey(int key, int i){
  int parent = i / 2;
  int v;

  if(key < a[h]) return;
  a[h] = key;

  while(i > 1 && a[parent] < a[i]){
    v = a[i];
    a[i] = a[parent];
    a[parent] = v;
    i = parent;
    parent = i / 2;
  }
}

void insert(int key){
  h++;
  a[h] = INFTY;
  heapIncreaseKey(key, h);
}



void maxHeapify(int i){
  int l, r;
  int largest;
  int v;

  l = 2 * i;
  r = 2 * i + 1;


  if(l <= h && a[l] > a[i]) largest = l;
  else largest = i;
  if(r <= h && a[r] > a[largest]) largest = r;


  if(largest != i){
    v = a[i];
    a[i] = a[largest];
    a[largest] = v;
    maxHeapify(largest);
  }
}



int extractmax(){
  int max;
  if(h < 1) return 0;
  max = a[1];
  a[1] = a[h];
  h--;
  maxHeapify(1);
  return max;
}


int main(){
  char c[LEN];
  int key;

  while(1){
    scanf("%s", c);
    if(c[0] == 'e' && c[1] == 'n') break;
    else if(c[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else{
      printf("%d\n", extractmax());
    }
  }

  return 0;
}



Measured memory_bytes: 5600
import java.util.*;

/**
 * A Main
 *
 * @date 2020.09.19
 * @author 焼き鮭 <yaki-shake@up-tri.me>
 */

public class Main {
  Scanner sc;

  public static void main(String[] args) {
    new Main().execute();
  }

  public void execute() {
    this.sc = new Scanner(System.in);
    String _s = sc.next();
    String[] s = _s.split("");
    System.out.println(_s + (s[s.length - 1].equals("s") ? "es" : "s"));
  }
}


Measured memory_bytes: 27144
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define int long long int
#define pb push_back
// #define M 1000000007
#define inf 10000000000
#define ff first
#define ss second
#define deb(x) cout< #x< " "< x< endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<=n;i++)
#define FORR(a,b,c) for(int a= b;a>=c;a--)
#define fa(arrr) for(auto x:arrr)
#define iPair pair<int, pair<int,int>>
#define sz size()
// #define mp make_pair
#define mxm3(a,b,c) max(a, max(b,c))
#define mi3(a,b,c) min(a, min(b,c))
#define mxn 500005
#define PII pair<int,int>
#define all(v) v.begin(), v.end()
#define endl "\n"
// #define N 1000
#define C 4
#define nfs ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
// Ordered Set Tree
// typedef tree<PII, null_type, less<PII>,
//         rb_tree_tag,
//         tree_order_statistics_node_update>
//         oset;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void computeLPSArray(string pat, int M, int* lps);




void solve() {
    int n, k;
    cin >> n >> k;
    vector<int>arr(n), dp(k + 1, 0);
    for (int i = 0; i < n; i++) cin >> arr[i];
    // dp[0] = 0;
    for (int i = 1; i <= k; i++) {
        for (auto x : arr) {
            if (x > i) continue;
            if (dp[i - x] == 0)
                dp[i] = 1;
        }
    }
    dp[k] ? cout << "First" << endl : cout << "Second" << endl;
}


int32_t main()
{


    nfs;
    int t;
    // facto();
    // cin >> t;
    t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2];
    return 0;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 998244353;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	long inf = LMAX / 2 - MAX;

	void doIt() {
		int N = sc.nextInt();
		int K = sc.nextInt();
		int p[] = new int[N];
		for(int i = 0; i < N; i++)
			p[i] = sc.nextInt();
		Arrays.sort(p);
		int sum = 0;
		for(int i = 0; i < K; i++) {
			sum += p[i];
		}
		System.out.println(sum);
	}

	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 38608
#include<stdio.h>
int main()
{
	int a,p,c,d,e;
	scanf("%d",&a);
	scanf("%d",&p);
	a=a*3;
	c=a+p;
	if(c%2==0)
	{
		d=c/2;
		printf("%d",d);
	}
	else
	{
		c=c-1;
		d=c/2;
		printf("%d",d);
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
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;}

//????????????????????°????´?
//front??¨side????????????????????°????????????????????´?????????????????°????????????,?????¢?????????????????£?????°??????????????\????¶????
//????°??????????????????????front??¨side??§?????§????????±??????????????¨?????????.
//??±?????§???????????£?????¨????????¢????????????????????????????????????????????????????????????????????¨?????§???????????¨????¨??????????????????????(?)
//????????¨???????????????????????????

//??¢?´¢????????????????????????
int main(){
	int x[25];
	int y[25];
	int w,d;
	while(1){
		REP(i,25){
			x[i] = 0; y[i] = 0;
		}
		cin >> w >> d;
		if(w==0&&d==0) break;
		int t;
		REP(i,w){
			cin >> t;
			x[t]++;
		}
		REP(i,d){
			cin >> t;
			y[t]++;
		}
		ll int ans = 0;
		REP(i,25){
			int k = min(x[i],y[i]);
			int k2 = abs(x[i]-y[i]);
			ans+=(k*i+k2*i);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

vector<vector<ll>> abc, dp;

ll rec(int i, int j) {
  if (dp[i][j] > -1) return dp[i][j];

  ll res = -1;
  rep(k, 3)
    if (j != k) chmax(res, rec(i-1, k) + abc[i][j]);

  return dp[i][j] = res;
}

int main() {
  ll n;
  cin >> n;
  abc.assign(n, vector<ll>(3));
  rep(i, n) cin >> abc[i][0] >> abc[i][1] >> abc[i][2];

  dp.assign(n, vector<ll>(3, -1));
  rep(i, 3) dp[0][i] = abc[0][i];

  ll ans = -1;
  rep(i, 3) chmax(ans, rec(n-1, i));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 18944
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin, a, b, c;
    int k;
    cin, k;
    while (k-- && !(a < b && b < c)) {
        if (a >= b) {
            b *= 2;
            continue;
        }
        if (b >= c) {
            c *= 2;
            continue;
        }
    }
    print((a < b && b < c) ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3600
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
tr = [0] * n
for i in range(k):
    d =int(stdin.readline().rstrip())
    As = list(map(int, stdin.readline().rstrip().split()))
    for a in As:
        tr[a-1] = 1

print(tr.count(0))


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

signed main(){
	string a,b; cin>>a>>b;
	a+=b;
	int p=stoi(a);
	bool pro=false;
	for(int i=1;i<=1000;i++){
		if(p==i*i)pro=true;
	}
	cout<<(pro ? "Yes" : "No")<<endl;
	return 0;
}

Measured memory_bytes: 256
func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainB() {
    let N = readInt()
    let lines = readInts()

    var answers = Set<Set<Int>>()
    for (aIndex, a) in lines.enumerated() {
        for (bIndex, b) in lines.enumerated() {
            for (cIndex, c) in lines.enumerated() {
                if aIndex == bIndex || bIndex == cIndex || cIndex == aIndex { continue }
                if a == b || b == c || c == a { continue }

                if a + b > c, b + c > a, a + c > b {
                    answers.insert(Set(arrayLiteral: aIndex, bIndex, cIndex))
                }
            }
        }
    }

    print(answers.count)
}
mainB()

Measured memory_bytes: 27528
#include<iostream>
using namespace std;
string S,T;
int main(){
  	cin>>S>>T;
  	int min=T.size();
  	for(size_t i=0;i+T.length()<=S.length();i++){
    	int count=0;	
      for(size_t j=0;j<T.length();j++){
        	if(S[i+j]!=T[j])count++;
        }
      if(min>count){
      	min=count;
      }
    }
  	cout<<min<<endl;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    vector<int> as(10);
    for (int i = 0; i < 3; ++i) {
        int a;
        cin >> a;
        --a;
        ++as[a];
    }
    bool found = false;
    for (int i = 0; i < 10; ++i) {
        if (as[i] == 2) found = true;
    }
    cout << (found ? "Yes" : "No") << endl;
    return 0;
}


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

int hanafuda[51], tmp[51];

int main()
{
    int n,c,p,r;
    while(cin >> n >> r && n && r) {
        for(int i = 0; i < n; i++)
            hanafuda[i] = i + 1;
        
        for(int i = 0; i < r; i++) {
            cin >> p >> c;
            
            for(int j = 0; j < c; j++) 
                tmp[c - 1 - j] = hanafuda[n - p - j];
            
            for(int j = n - p + 1; j < n; j++)
                hanafuda[j - c] = hanafuda[j];

            for(int j = 0; j < c; j++)
                hanafuda[n - c + j] = tmp[j];

        }
        cout << hanafuda[n - 1] << endl;
    }
}

Measured memory_bytes: 0
N = int(input())
A = [int(i) for i in input().split()]

A.reverse()
ans = []

for i in range(0,N,2):
    ans.append(A[i])

A.reverse()

for i in range(N%2,N,2):
    ans.append(A[i])

[print(i,end=' ') for i in ans]


Measured memory_bytes: 30884
temp=list(map(lambda x:int(x),input().split()))
H,W=temp[0],temp[1]
grid=[]
for _ in range(H):
    row=list(input())
    row.append("?")
    row.insert(0,"?")
    grid.append(row)

pad=["?" for _ in range(W+2)]
grid.append(pad)
grid.insert(0,pad)

dx=[1,0,-1,0,1,1,-1,-1]
dy=[0,1,0,-1,1,-1,1,-1]
for now_y in range(1,H+1):
    line=""
    for now_x in range(1,W+1):
        bom_cnt=0
        if grid[now_y][now_x]=="#":
            line+="#"
            continue
        for i in range(8):
            # print(now_x+dx[i],now_y+dy[i])
            if grid[now_y+dy[i]][now_x+dx[i]]=="#":bom_cnt+=1
        line+=str(bom_cnt)
    print(line)
        # answer_grid[now_y][now_x]=bom_cnt


Measured memory_bytes: 3064
N, M = map(int, input().split())
Edge = [tuple(map(int, input().split())) for _ in range(M)]

Graph = [[] for _ in range(N)]
for a,b in Edge:
    Graph[a-1].append(b-1)
    Graph[b-1].append(a-1)


def dfs(v, seen):
    global Graph
    seen.add(v)
    if len(seen) == N:
        seen.remove(v)
        return 1
    Res = [dfs(nv, seen) for nv in Graph[v] if not nv in seen]
    seen.remove(v)
    return sum(Res)

print(dfs(0, set()))

Measured memory_bytes: 9108
def partition(A, p, r):
   x = A[r]
   i = p-1
   for j in range(p, r):
     if A[j] <= x:
       i = i+1
       A[i], A[j] =  A[j], A[i]
   A[r] = "[" + str(A[r]) + "]"
   A[i+1] , A[r] = A[r], A[i+1]
   return i+1

n = int(input())
A = [int(x) for x in input().split()]

partition(A,0,n-1)
print(*A)


Measured memory_bytes: 16364
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, C = getNM()
D = [getList() for i in range(C)]
maze = [getList() for i in range(N)]

lis = [[0] * C for i in range(3)]

for i in range(N):
    for j in range(N):
        lis[(i + j) % 3][maze[i][j] - 1] += 1

ans = float('inf')
for vi in permutations([i for i in range(C)], 3):
    opt_0, opt_1, opt_2 = vi
    cnt = 0
    for i in range(C):
        cnt += lis[0][i] * D[i][opt_0]
        cnt += lis[1][i] * D[i][opt_1]
        cnt += lis[2][i] * D[i][opt_2]
    ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 86624
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    int N;
    cin >> N;
    
    long long X[N];
    for(int i=0; i<N; i++){
        cin >> X[i];
    }
    
    
    long long B[N];
    
    pair<long long , int> p[N];
    for(int i=0; i<N; i++){
        p[i].first=X[i];
        p[i].second=i;
    }
    
    sort(p,p+N);
    
    for(int i=0; i<N/2; i++){
        B[p[i].second]=p[N/2].first;
    }
    
    
    for(int i=N/2; i<N; i++){
        B[p[i].second]=p[N/2-1].first;
    }
    

    for(int i=0; i<N; i++){
        cout<<B[i]<<endl;
    }
    
    return 0;
}


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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
	int a, b;
	int m, M;
	int i;
	scanf("%d%d",&a ,&b);
	m = MIN(a, b);
	M = MAX(a, b);
	for(i=0;i<M;i++){
		printf("%d",m);
	}
	printf("\n");
    return 0; 
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	std::string s,t;
	std::cin>>s;
	t=s;
	std::reverse(t.begin(),t.end());
	if(s!=t){
		puts("No");
		return 0;
	}
	std::reverse(t.begin(),t.end());
	std::reverse(t.begin(),t.begin()+t.size()/2);
	if(s.substr(0,s.size()/2)!=t.substr(0,s.size()/2)){
		puts("No");
		return 0;
	}
	std::reverse(t.begin(),t.begin()+t.size()/2);
	std::reverse(t.begin()+t.size()/2+1,t.end());
	if(s.substr(s.size()/2+1,s.size()/2)!=t.substr(s.size()/2+1,s.size()/2)){
		puts("No");
	}
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 3624
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    ans=0
    for x in range(k,n+2):
        ans+=(1+((n*(n+1)//2-(n-x)*(n-x+1)//2)/x-(x*(x-1)//2)/x)*x)%(10**9+7)
    print(int(ans)%(10**9+7))

if __name__=='__main__':
    main()

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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n;
  cin >> n;

  vector<i64> h(n+5);
  rep(i, n) {
    cin >> h[i];
  }

  if (n == 1) {
    cout << "Yes" << "\n";
    return 0;
  }

  h[0]--;
  for (int i = 1; i < n-1; ++i) {
    if (h[i] - 1 < h[i-1]) continue;
    h[i]--;
  }

  bool isYes = true;
  for (int i = 1; i < n; ++i) {
    if (h[i-1] > h[i]) isYes = false;
  }

  cout << (isYes ? "Yes" : "No") << "\n";

  return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
typedef long long ll;
char s[1000];
int main()
{
	ll n;
	cin>>n;
	if(n==0){
		cout<<"0"<<endl;
		return  0;
	}
	int cnt=0;
	while(n){
		if(n%-2==0){
				s[cnt++]='0';
			n/=-2;
		}
		
		else{
			s[cnt++]='1';
			n=(n-1)/-2;
		}
	}
	for(int i=cnt-1;i>=0;i--)
		cout<<s[i];
	cout<<endl;
	return 0;
}

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

using namespace std;

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

  for(int i = 0; i < 3; i++){
    if(n % 10 == 7){
      cout << "Yes" << endl;
      return 0;
    }
    else{
      n /= 10;
    }
  }

  cout << "No" << endl;

  return 0;
}

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

using namespace std;

long long a[100005][5], dp[100005][5], n;

int main () {
    cin >> n;

    for(int i = 1; i <= n; ++i){
        cin >> a[i][1] >> a[i][2] >> a[i][3];
    }
    dp[1][1] = a[1][1];
    dp[1][2] = a[1][2];
    dp[1][3] = a[1][3];

    for(long long i = 2; i <= n; ++i){
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a[i][1];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + a[i][2];
        dp[i][3] = max(dp[i - 1][2], dp[i - 1][1]) + a[i][3];
    }

    cout << max(max(dp[n][1], dp[n][2]), dp[n][3]);

    return 0;
}


Measured memory_bytes: 8064
// abc149_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));
    REP(i, H) REP(j, W) {
        char x; cin >> x;
        A[i][j] = x == '#' ? 1 : 0;
    }

    vector<bool> row(H);
    vector<bool> col(W);

    REP(i, H){
        int num = 0;
        REP(j, W) num += A[i][j];
        row[i] = num > 0;
    }

    REP(j, W){
        int num = 0;
        REP(i, H) num += A[i][j];
        col[j] = num > 0;
    }

    vector<string> ans;
    REP(i, H) {
        if (row[i] == false) continue;

        string s;
        REP(j, W){
            if (col[j] == false) continue;
            s += A[i][j] ? '#' : '.';
        }
        ans.emplace_back(s);
    }

    REP(i, ans.size()) print(ans[i]);


    return 0;
}


Measured memory_bytes: 384
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val inputs = listOfInt()

    if (inputs[0] < inputs[1]) println(0)
    else println(10)
}

// 入力取得
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }

Measured memory_bytes: 37996
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

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; }

//ll modpow(ll a, ll n, ll mod)
//{
//
//}

ll fn(ll n, ll x)
{
	if (n == -1)
	{
		return 0;
	}
	else
	{
		return n / x + 1;
	}
}

int main()
{
	ll a, b, x;
	cin >> a >> b >> x;

	cout << fn(b, x) - fn(a - 1, x) << endl;
}

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

int n;
double ans;

int main(){
	ans=0;
	cin >> n;
	for (int i=0;i<n;i++){
		double a;
		cin >> a;
		ans+=(1/a);
	} 
	cout << fixed << setprecision(15) << 1/ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int N;
    cin >> N;
    int w[N];
    for(int i = 0; i < N; i++){
        cin >> w[i];
    }
    int ans = INFINITY;
    int s1 = 0;
    int s2 = 0;
    for(int i = 0; i < N; i++){
        s2 += w[i];
    }

    for(int i = 0; i < N; i++){
        s1 += w[i];
        s2 -= w[i];
        ans = min(ans, abs(s1-s2));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

int min(int a, int b){
	if(a<b)return a;
	else return b;
}

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


int main(void){
	ll w,h,x,y;
	cin>>w>>h>>x>>y;
	ll a[2];
	if(h-y>y)a[0]=w*y;
	else a[0]=w*(h-y);
	if(w-x>x)a[1]=h*x;
	else a[1]=h*(w-x);


	/*if(x==0 || y==0 || x==w || y==h )printf("%lf 0\n",(double)(w*h)/2);
	else if(x==w/2 && y==h/2)printf("%lf 1\n",(double)(w*h)/2);
	else if(w==h)printf("%lf 0\n",(double)(w*h)/2);
	else if(x*h==y*w || x*h==w*(1-y))printf("%lf 0\n",(double)(w*h)/2);
	else if(a[0]>a[1])printf("%lf 0\n",(double)a[0]);
	else if(a[0]<a[1])printf("%lf 0\n",(double)a[1]);
	else printf("%lf 1\n",(double)a[0]);*/
	if(2*x==w && 2*y==h)printf("%lf 1\n",(double)(w*h)/2);
	else printf("%lf 0\n",(double)(w*h)/2);
	return 0;

}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = INT()
B = INT()
for i in range(1,4):
  if i != A and i != B:
    print(i)

Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 100010;
#define all(x) x.begin(),x.end()

int n;
string s;

int main() {
	cin >> n >> s;
	if (n >= 3200) cout << s;
	else cout << "red";
	
}



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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

ll N,Q;
ll A[101010];
ll mk[101010];
ll i, j, k;
ll ans = 0;


void query(){
    ll B, C;
    scanf("%lld%lld", &B, &C);
    ans += mk[B] * (C - B);
    mk[C] += mk[B];
    mk[B] = 0;
    printf("%lld\n", ans);
}

int main(){
    scanf("%lld", &N);
    rep(i,0,N){
        scanf("%lld", &A[i]);
        ++mk[A[i]];
        ans += A[i];
    }
    scanf("%lld", &Q);
    while(Q--){
        query();
    }
    return 0;
}

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

int main (){
    string s;
    cin >> s;
    ll n=s.size();
    vector<ll> sum(n+1);
    int ten=1;
    for(int i=n-1;i>=0;--i){
        int a=(s[i]-'0')*ten;
        sum[i]=(int)(sum[i+1]+a)%2019;
        ten*=10; ten%=2019;
    }
    ll ans=0;
    vector<ll>  freq(2019,0);
    for(int i=n;i>=0;--i){
        ans+=freq[sum[i]];
        freq[sum[i]]++;
    }
    cout << ans <<endl;
    return 0;
}



Measured memory_bytes: 5244
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define srep(i,j,n) for (int i = j; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll inf = 1001001001;
vector<ll> dp(100001,inf);
int main(){
    int n;
    cin >> n;
    vector<ll> h(n);
    rep(i,n)
    cin >> h[i];
    dp[0] = 0;
    rep(i,n){
        srep(j,1,3){
            if(i+j<n)
            dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 1792
h, w, m = map(int, input().split())
h_cnt = [0] * h
w_cnt = [0] * w

bomb_set = set()

for i in range(m):
    h_, w_ = map(int, input().split())
    h_ -= 1
    w_ -= 1
    h_cnt[h_] += 1
    w_cnt[w_] += 1
    bomb_set.add((h_, w_))

max_h = max(h_cnt)
max_h_idx = []
for i in range(h):
    if h_cnt[i] == max_h:
        max_h_idx.append(i)

max_w = max(w_cnt)
max_w_idx = []
for i in range(w):
    if w_cnt[i] == max_w:
        max_w_idx.append(i)

minus = -1
for i in max_h_idx:
    for j in max_w_idx:
        if (i, j) not in bomb_set:
            print(max_h + max_w)
            exit()
print(max_h + max_w - 1)


Measured memory_bytes: 83616