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

public static partial class Program
{
    public static void Main()
    {
        var ab = CRL().ArrayInts();
        var a = ab[0];
        var b = ab[1];

        var dif = b - a;
        var height = Sigma(dif);
        Console.WriteLine(height - b);
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);  
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = new[] {0, -1, 0, 1};
    public static readonly int[] Dy = new[] {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

// auto mod int
// source : https://github.com/atcoder-live/library
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int MOD = 1000000007;
const int mod = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	
	// for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
// source : https://github.com/atcoder-live/library
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n):fact(n+1),ifact(n+1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
}c(500000); //c(a,b)と呼ぶとaCbを求める
// 500000は場合に応じて変更

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int n,m,k;
	cin >> n >> m >> k;

	mint ans = 0;
	mint color = m;
	for(int i = n-1; i >= 0; i--){
		mint col_ptn = color;
		col_ptn *= c(n-1,i);
		if(i <= k){
			ans += col_ptn;
		}
		color *= m-1;
	}
	cout << ans << endl;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 10988
class Prime():
    def __init__(self, n):
        self.p = [] # self.p[i] = i番目の素数 < n
        self.d = [0] * n # self.d[i] = iを割り切る最小の素数

        # エラトステネスの篩
        for i in range(2, n):
            if self.d[i] == 0:
                self.p.append(i)
                for j in range(i, n, i):
                    if self.d[j] == 0:
                        self.d[j] = i

        self.ind = [-1] * n # self.ind[i] = self.p.index[i]
        for i in range(len(self.p)):
            self.ind[self.p[i]] = i

    def prime_factorization_index(self, x): # xの素因数のlistをreturn(重複なし)
        l = [self.ind[self.d[x]]]
        x //= self.d[x]
        while x != 1:
            if l[-1] != self.ind[self.d[x]]:
                l.append(self.ind[self.d[x]])
            x //= self.d[x]
        return l

    def num_prime(self): # n未満の素数の個数をreturn
        return len(self.p)

def main():

    from math import gcd
 
    n = int(input())
    a = list(map(int, input().split()))

    # 'not coprime'かどうか判定
    g = a[0]
    for i in range(1, n):
        g = gcd(g, a[i])
        if g == 1:
            break
    else:
        print('not coprime')
        exit()

    # 'setwise coprime'かどうか判定
    p = Prime(10**6 + 1)

    tf = [False] * p.num_prime()

    for i in a:
        if i == 1:
            continue

        l = p.prime_factorization_index(i)
        for j in l:
            if tf[j]:
                print('setwise coprime')
                exit()
            else:
                tf[j] = True

    print('pairwise coprime')

main()


Measured memory_bytes: 189412
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>

using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

int32_t main() 
{
    fast;
	double R; cin >> R;
    double res = 2*pi*R;
    cout << res;
}




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

string chair;


int goA(char c){
	for(int i = 0 ; i < chair.size() ; i++)
		if( chair[i] == '#'){
			chair[i] = c;
			return 1;
		}
	return 0;
}
int goB(char c){
	for(int i = chair.size() -1  ; i >= 0 ; i--)
		if( chair[i] == '#' && (!i||chair[i-1]!='A') && (i+1==chair.size()||chair[i+1]!='A') ){
			chair[i] = c;
			return 1;
		}
	return goA(c);
}
int goC(char c){
	if( count(chair.begin(),chair.end(),'#') == chair.size() ){
		if( chair.size() % 2 ) chair[(1+chair.size())/2-1] = c;
		else chair[chair.size()/2] = c;
		return 1;
	}
	for(int i = 0 ; i < chair.size() ; i++)
		if( chair[i] != '#'){
			for(int j = 1 ; j >= -1 ; j--){
				if( i+j >= 0 && i+j < chair.size() && chair[i+j] == '#' ){
					chair[i+j] = c;
					return 1;
				}
			}
		}

	return 0;
}
int goD(char c){
	int pos;
	int dst = -2e9;
	for(int i = 0 ; i < chair.size() ; i++){
		if( chair[i] == '#' ){
			int dist = 1e9;
			for(int j = 0 ; j < chair.size() ; j++)
				if( chair[j] != '#') dist = min(dist,abs(i-j));

			if( dst < dist){
				dst = dist;
				pos = i;
			}
		}
	}
	chair[pos] = c;
	return 1;
}


int main(){
	int n,m;
	while( cin >> n >> m && n ){
		chair = string(n,'#');
		for(int i = 0 ; i < m ; i++){
			char c; cin >> c;
			if( c == 'A' ) goA(c);
			if( c == 'B' ) goB(c);
			if( c == 'C' ) goC(c);
			if( c == 'D' ) goD(c);
		}
		cout << chair << endl;
	}
}

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

int main() {
  int n,m,x,i,j,k;
  cin>>n>>m>>x;
  int a[m];
  for(i=0,j=0,k=0;i<m;i++)
  {
    cin>>a[i];
    if(0<a[i]&&a[i]<x)
    j++;
    else if(x<a[i]&&a[i]<n)
    k++;
  }
  if(j<k)
  cout<<j;
  else
  cout<<k;
  return 0;
}

Measured memory_bytes: 256
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  int K;
  cin>>K;
  if (K%2==0) cout << (K/2)*(K/2) << endl;
  else cout << ((K+1)/2)*(K/2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////
map<int,int> mp;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    int n,m;
    cin>>n>>m;
    vector<int> v;
    REP(i,m)
    {
        int x,y;
        cin>>x>>y;
        if(x==1)
        v.push_back(y);
        else mp[x]=y;
    }
    for(auto i:v){
        if(mp[i]==n)
        return cout<<"POSSIBLE",0;
    }
    cout<<"IMPOSSIBLE";
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

Measured memory_bytes: 13004
require 'pp'

N,Q = readline.chomp.split.map(&:to_i)
S = readline.chomp

OPS = []
Q.times do
  c,dir = readline.split
  d = (dir == 'L') ? -1 : 1
  OPS << [c,d]
end

MEMO = {}

def dest(pos)
  return MEMO[pos] if MEMO[pos]
  x = pos
  OPS.each do |c,d|
    if S[x] == c
      x += d
      break if x < 0 or x >= N
    end
  end
  MEMO[pos] = x
  x
end

lidx = (0..(N-1)).bsearch {|i| dest(i) >= 0 } || N
ridx = (lidx..(N-1)).bsearch {|i| dest(i) >= N } || N
puts ridx - lidx


Measured memory_bytes: 47008
#include <iostream>
#include <algorithm>

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

using namespace std;

int x[5];

int main(){
	rep(i, 5){
		cin >> x[i];
	}
	cout << *min_element(x, x + 3) + min(x[3], x[4]) - 50 << endl;
	return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    vint v(n);
    rep(i,n) cin >> v[i];
    vint v_sort = v;
    sort(all(v_sort));
    vint x_accu(n+1,0), y_accu(n+1,0);
    REP(i,n+1) {
        x_accu[i] = x_accu[i-1]+v[i-1];
        y_accu[i] = y_accu[i-1]+v[n-i];
    }
    int ans = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            if (x+y > k) continue;
            int rev = k-(x+y);
            int sum = 0;
            vint tmp;
            if (x+y >= n) {
                sum += x_accu[n];    
                rep(i,min(rev,n)) {
                    if (v_sort[i] < 0) sum -= v_sort[i];
                }
            }
            else {
                sum += x_accu[x]+y_accu[y];
                rep(i,x) tmp.push_back(v[i]);
                rep(i,y) tmp.push_back(v[n-i-1]);
                sort(all(tmp));
                int tmp_n = tmp.size();
                rep(i,min(rev,tmp_n)) {
                    if (tmp[i] < 0) sum -= tmp[i];
                }
            }
            ans = max(ans,sum);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
        char op;
        int a,b;

        while(1){
                scanf("%d %c %d",&a,&op,&b);
                if(op=='+'){
                        printf("%d\n",a+b);
                } else if(op=='-'){
                        printf("%d\n",a-b);
                } else if(op=='*'){
                        printf("%d\n",a*b);
                } else if(op=='/'){
                        printf("%d\n",a/b);
                } else {
                        break;
                }
        }

        return 0;
}


Measured memory_bytes: 2068
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            Console.WriteLine(s); Console.WriteLine(s);
        }
    }
}

Measured memory_bytes: 11092
/*input
1 30
3 5 10 30
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
using namespace std;
#define N  100005
void solve()
{
	lld cnt=0;
	lld n,m;
	cin >> n >> m;
	lld val[m+2];
	rep(j,0,m+2)
	{
		val[j]=0;
	}
	rep(j,0,n)
	{
		lld c;
		cin >> c;
		rep(j,0,c)
		{
			lld x;
			cin >> x;
			val[x]++;
		}
	} 
	rep(i,1,m+1)
	{
		if(val[i]==n)
		{
			cnt++;
		}
	}
	pre(cnt);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 256
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for(int i =0;i<n;i++){
            s[i] = sc.next();
        }
        int m = sc.nextInt();
        String[] t = new String[m];
        int cnt=0;
        int max=0;


        for(int i =0;i<m;i++){
            t[i] = sc.next();
        }

        for(int i =0;i<n;i++){
            for(int j =0;j<n;j++){
                if(s[i].equals(s[j])){
                    cnt++;
                }
            }
            for(int j =0;j<m;j++){
                if(s[i].equals(t[j])){
                    cnt--;
                }
            }
            if(max<cnt){
                max=cnt;
            }
            cnt=0;
        }
        System.out.println(max);
    }
}






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

int main(){

        char s[100];
        scanf("%s",s);
        int n=0;
        for(int i=0;i<strlen(s);++i){
                if(s[i]=='+'){
                        n++;
                }else{
                        n--;
                }
        }printf("%d\n" ,n);
        return 0;
}



Measured memory_bytes: 3780
N, K = list(map(int, input().split(" ")))
D = list(map(str, input().split(" ")))

ans = N
while(1):
    j = True
    for d in D:
        if d in str(ans):
            j = False
            break
            
    if j == True:
        break
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

int main(){
  int i,j,N,num,A[10000];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  num=0;
  for(i=0;i<N;i++){
    if(A[i]==2){
      num++;
      continue;
    }
    else if(A[i]<2 || A[i]%2==0) continue;

    j=3;
    while(j<=(int)sqrt(A[i])){
      if(A[i]%j==0) break;
      j=j+2;
    }
    
    if(j>(int)sqrt(A[i])) num++;
  }
  
  printf("%d\n",num);
  
  return 0;
}
  

Measured memory_bytes: 628
import std.stdio;
import std.algorithm;
import std.string;
import std.container;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}

void main() {
    while (true) {
        int H, W, R, C;
        readf("%d %d %d %d\n", &H, &W, &R, &C);
        if (H == 0 && W == 0 && R == 0 && C == 0) break;
        R--; C--;
        auto F = new string[H * 2 + 1];
        foreach (ref L; F) {
            L = readln.chomp;
            if (L.length == W * 2) L ~= " ";
        }

        auto state = new int[][][](H, W, 2);
        foreach (ref a; state) foreach (ref b; a) b[] = -1;
        
        alias P = Tuple!(int, "y", int, "x");

        const dy = [0, 1, 0, -1];
        const dx = [1, 0, -1, 0];
        DList!P Q;
        auto inQ = new bool[][](H, W);
        foreach (y; 0 .. H) foreach (x; 0 .. W) {
            if (y == 0 || y == H - 1 || x == 0 || x == W - 1) {
                if (inQ[y][x]) continue;
                Q.insert(P(y, x));
                inQ[y][x] = true;
            }
        }
        while (!Q.empty) {
            P c = Q.front; Q.removeFront;
            inQ[c.y][c.x] = false;
            foreach (k; 0 .. 4) {
                int ny = c.y + dy[k];
                int nx = c.x + dx[k];
                int by = c.y * 2 + 1 + dy[k];
                int bx = c.x * 2 + 1 + dx[k];
                foreach (i; 0 .. 2) {
                    if (state[c.y][c.x][i] == 1) continue;
                    if ( (F[by][bx] == '0' && i == 0) || (F[by][bx] == '1' && i == 1) ) {
                        if ( (ny < 0 || ny >= H || nx < 0 || nx >= W) || (state[ny][nx][0] == 1 && state[ny][nx][1] == 1) ) {
                            state[c.y][c.x][i] = 1;
                            foreach (l; 0 .. 4) {
                                int nny = c.y + dy[l];
                                int nnx = c.x + dx[l];
                                if (nny < 0 || nny >= H || nnx < 0 || nnx >= W) continue;
                                if (inQ[nny][nnx]) continue;
                                Q.insert(P(nny, nnx));
                                inQ[nny][nnx] = true;
                            }
                        }
                    }
                }
            }
        }
        writeln(state[R][C][0] == 1 ? "Yes" : "No");

    }
}

Measured memory_bytes: 36728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    
         //変数x, yを宣言する
         int x, y;
    
        //変数x, yの値を入力する
        x = sc.nextInt();
        y = sc.nextInt();
        
        while(x != 0 || y != 0){
            //大小を関係の比較
            if(x < y) System.out.println(x + " " + y);
            else System.out.println(y + " " + x);
            
            //変数x = 0, y = 0になるまで値を入力を繰り返す
            x = sc.nextInt();
            y = sc.nextInt();
        }
        
    }
}



/*覚えよう！！
 
〇もう1つの繰り返し

・while(条件式)：条件を満たす間はずっと繰り返す

　※今回は x = 0  || y = 0　が入力されない間は繰り返す(両方0が入力されてない意味)
　
*/
  
  
/*前回の内容！！

〇import java.util.Arrays;は重要↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

・Arrays：ソート（並べ変え）や検索など、配列を操作するための機能

・並べ変えするとき
　import java.util.Arrays;を上に書く
　class Main内に Arrays.sort(a); と書く　←　このとき()内は配列の変数名
　
〇配列とは、同じ変数名に複数の値を入力できる箱

　※イメージ
    前回まで、a = 1, b = 2, c = 3など各変数名は1箱に値を代入できない
    今回の配列はa[0] = 1, a[1] = 2, a[2] = 3 のように変数名aは3つの箱に値を代入できる。
    注意：配列の箱は｢ 0 ｣から開始する


・複数のif(条件)：かつ｢ && ｣とまたは｢ || ｣の２つを使用する
　※かつ｢ && ｣：「真 && 真 = 真」, 「真 && 偽 = 偽」, 「偽 && 真 = 偽」 ,「偽 && 偽 = 偽」の4つの条件
　　または｢ || ｣：「真 && 真 = 真」, 「真 && 偽 = 真」, 「偽 && 真 = 真」 ,「偽 && 偽 = 偽」の4つの条件


・関係を比較する：if(条件式)
　例：if(2 < 3) この条件は｢真（成立）｣　→　何か命令があれば実行する
　　　if(5 < 3) この条件は｢偽（不成立）｣　→　何か命令があれば実行しない
　　　
・比較の条件式：等しいか比較｢==｣、等しくないか比較｢!=｣ 
　　　　　　　　大きいか比較｢<｣、小さいか比較｢>｣
　　　　　　　　以上の比較｢<=｣、以下の比較｢>=｣
 
 
・else；ifの条件以外の場合に使用する。
　例：if(雨 == 降っている) System.out.println("傘を持って行く");
　　　else System.out.println("傘を持って行かない");
　
 
・else if：詳細な場合分けしたいときに使用
　例：if(雨 == 降っている) System.out.println("傘を持って行く");
　　　else if(雨 == 午後から降るかも) System.out.println("念のため傘を持って行く");
　　　else System.out.println("傘を持って行かない");
 

 
・変数に計算結果を代入する：面積　＝　縦　×　横
　※計算は変数名でも数値でもいける
  
・四則演算：足し算｢＋｣、引き算｢－｣、掛け算｢＊｣、割り算｢／｣
　1 + 2 = 3;
　4 - 3 = 1;
　2 * 5 = 10;
　8 / 2 = 4;
  
・余りの計算：割り算の余り｢％｣
  5 % 3 = 2;
    
    
・printlnの複数表示：｢＋｣を使用
　例：println("Kobe" + "Kagikou"); = KobeKajikou
　　　println("明治 + 20 + "年"); = 明治20年　数値が入ってもOK！
  
  
  
・変数の宣言は｢型｣と｢変数名｣の２つ必要
　例：型＿変数名　→　int x;
　
・キーボードから入力するときは・・・｢ import java.util.Scanner; ｣ と ｢  Scanner sc = new Scanner(System.in) ; ｣が必要
  
・入力するとき・・・変数名 = sc.nextInt(); nextの後は型を書く、頭文字は大文字　
　※  scは変更しても大丈夫しかし全て変更後の文字に統一　例：nyuryoku
  
・println・・・画面に出力するときに使用
  
・文字列の表示・・・"〇〇〇の間に入力"ことが約束
  
*/



Measured memory_bytes: 35876
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        String ans = "No";

        for (int i = 1; i < 10; i++) {
            int another = n / i;
            if (n % i == 0 && another < 10 && another > 0) {
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 24276
#include<bits/stdc++.h>
    #define N 300005
    #define M 1000000007
    #define ll long long
    using namespace std;
    ll n,m,t,x,y,fac[N]= {1};
    ll arr[N];
    map<ll,ll> mp;
    vector<int> v[N];
    ll qpow(ll a,ll b)
    {
        ll ans=1;
        ll k=a;
        while(b)
        {
            if(b&1)ans=ans*k%M;
            k=k*k%M;
            b>>=1;
        }
        return ans;
    }
    ll C(ll n,ll m)
    {
        if(m>n)return 0;
        return fac[n]*qpow(fac[m],M-2)%M*qpow(fac[n-m],M-2)%M;
    }
    int main()
    {
        for(int i=1; i<N; i++)fac[i]=fac[i-1]*i%M;
        ll n;
        scanf("%lld",&n);
        int num;
        for(int i=1;i<=n+1;i++){
        	scanf("%lld",&arr[i]);
        	if(mp[arr[i]]) num=arr[i];
        	mp[arr[i]]=1;
        	v[arr[i]].push_back(i);
		} 
		cout<<n<<'\n';
        int id1=v[num][0];
        int id2=v[num][1];
        //cout<<num;
        int cha=id2-id1+1;
        for(ll i=2;i<=n+1;i++){
        	printf("%lld\n",(((C(n+1,i)-C(n-id2+id1,i-1)+M)%M)%M));
		}
        return 0;
    }

Measured memory_bytes: 20864
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

// long long pow_mod(long long a, long long b){
// 	if(a == 0)
// 		return 0ll;
// 	if(b == 0)
// 		return 1ll;
// 	if(b == 1)
// 		return a%MOD;
// 	long long x = pow_mod(a,b/2);
// 	return ((b%2 == 1) ? (((x*x)%MOD)*a)%MOD : (x*x)%MOD);
// }

// long long pow_int(long long a, long long b){
// 	if(a==0)
// 		return a;
// 	if(b==0)
// 		return 1;
// 	if(b==1)
// 		return a;
// 	long long x = pow_int(a,b/2);
// 	return ((b%2 == 1) ? x*x*a : x*x);
// }

// int pow_int(int a, int b){
// 	if(a==0)
// 		return a;
// 	if(b==0)
// 		return 1;
// 	if(b==1)
// 		return a;
// 	int x = pow_int(a,b/2);
// 	return ((b%2 == 1) ? x*x*a : x*x);
// }


// void print_vec(vector<int>& a){
// 	for(int i=0;i<a.size();i++)
// 		cout << a[i] << (i<n-1 ? " ":"\n");
// }

// void print_vec(vector<long long>& a){
// 	for(int i=0;i<a.size();i++)
// 		cout << a[i] << (i<n-1 ? " ":"\n");
// }

// void solve_kick_start(int test_case){

// }

void solve(){
	int h,w,k;
	cin >> h >> w >> k;
	vector<string> dp(h);
	vector<vector<int>> ans(h,vector<int>(w,0));
	for(int i=0;i<h;i++){
		cin >> dp[i];
	}

	int curr_k = 1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(dp[i][j]=='#'){
				ans[i][j]=curr_k;
				curr_k++;
			}
		}
	}

	for(int i=0;i<h;i++){
		for(int j=1;j<w;j++){
			if(ans[i][j]==0 && ans[i][j-1]!=0){
				ans[i][j]=ans[i][j-1];
			}
		}
		for(int j=w-1;j>0;j--){
			if(ans[i][j-1]==0 && ans[i][j]!=0){
				ans[i][j-1]=ans[i][j];
			}
		}
	}

	for(int j=0;j<w;j++){
		for(int i=1;i<h;i++){
			if(ans[i][j]==0 && ans[i-1][j]!=0){
				ans[i][j]=ans[i-1][j];
			}
		}

		for(int i=h-1;i>0;i--){
			if(ans[i][j]!=0 && ans[i-1][j] == 0){
				ans[i-1][j] = ans[i][j];
			}
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout << ans[i][j] << (j < w-1 ? " ":"\n");
		}
	}
}

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

	// // CodeChef Template
	// int t;       
	// cin >> t;
	// while(t--){
	// 	solve();
	// }

	// Single test case input
	solve();

	// // Kick Start Template	
	// int test_cases;
	// cin >> test_cases;
	// for(int i=1;i<=test_cases;i++){
	// 	solve_kick_start(i);
	// }

	return 0;
}

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


int main()
{
 int n; 
  
  cin>>n; 
  
  int a[4]; 
  memset(a, 0 , sizeof(a));
  
  for( ; n--; )
  {
    string s ; 
    cin>>s; 
    
    
    if(s == "AC")
      a[0]++; 
    else if(s =="WA")
      a[1]++; 
    else if(s == "TLE")
      a[2]++;
    else 
      a[3]++; 
  }
  cout<<"AC x "<<a[0]<<endl; 
  cout<<"WA x "<<a[1]<<endl; 
  cout<<"TLE x "<<a[2]<<endl;
  cout<<"RE x "<<a[3]<<endl;
  
  
  
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef unsigned int ui;
typedef vector <int> vi;
const ll mod = 1e9+7;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const ll INF = 1e18;

#define maxn 1000100
int n, m, k, a, b, c;
int tab[maxn];
ll dp[1010][2];

int main()
{
	boost;
	dp[0][0] = 1; dp[0][1] = 0;
	cin >> n >> m;
	FOR(i, 1, n)
	{
		cin >> a;
		a %= 2;
		FOR(j, 0, 1) dp[i][j] = dp[i-1][j];
		if (a == 0) dp[i][0] += dp[i-1][0], dp[i][1] += dp[i-1][1];
		else dp[i][0] += dp[i-1][1], dp[i][1] += dp[i-1][0];
	}
	
	cout << dp[n][m];
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
	char s[15];

	scanf("%s", s);
	bool bad = false;

	for(int i = 0; i < 3; i++) {
		if(s[i] == s[i + 1]) {
			bad = true;
		}
	}

	printf("%s\n", bad ? "Bad" : "Good");

	return 0;
}


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

const int nMax = 1e6;
const int mod = 1e9 + 7;

class Sieve
{
private:
	int n;
	vector<int> f, primes;

public:
	Sieve(int v = 1) : n(v), f(n + 1)
	{
		f[0] = f[1] = -1;
		for (ll i = 2; i <= n; i++) {
			if (f[i]) continue;
			primes.push_back(i);
			f[i] = i;
			for (ll j = i * i; j <= n; j += i) {
				if (!f[j]) f[j] = f[i];
			}
		}
	}

	bool isPrime(int x) { return f[x] == x; }
	vector<int> factorList(int x)
	{
		vector<int> res;
		while (x != 1) {
			res.push_back(f[x]);
			x /= f[x];
		}
		return res;
	}
	vector<pair<int, int>> factor(int x)
	{
		vector<int> fl = factorList(x);
		if (fl.size() == 0) return {};
		vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
		for (int p : fl) {
			if (res.back().first == p) {
				res.back().second++;
			}
			else {
				res.emplace_back(p, 1);
			}
		}
		return res;
	}

	/*vector<pair<int, int>> factor(int x)
	{
		vector<pair<int, int>> res;
		for (const auto& p : primes) {
			int y = 0;
			while (x%p == 0) {
				x /= p;
				y++;
			}
			if (y != 0) res.emplace_back(p, y);
		}
		if (x != 1) res.emplace_back(x, 1);
		return res;
	}*/
};

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

int main()
{

	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	Sieve sieve(nMax);
	map<int, int> mp;
	for (int i = 0; i < n; i++) {
		vector<pair<int, int>> f = sieve.factor(a[i]);
		for (const auto& item : f) mp[item.first] = max(mp[item.first], item.second);
	}

	ll lcm = 1;
	for (const auto& item : mp) {
		for (int i = 0; i < item.second; i++) {
			lcm *= item.first % mod;
			lcm %= mod;
		}
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ll b = lcm * modPow(a[i], mod - 2, mod) % mod;
		ans = (ans + b) % mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4988
n,m,l=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
b=[list(map(int,input().split())) for _ in range(m)]
[print(*x)for x in[[sum(s*t for s,t in zip(c,l))for l in zip(*b)]for c in a]]

Measured memory_bytes: 7008
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int money=0;
  if(a+b>c*2) {
    int cnt=min(x,y);
    money=c*cnt*2;
    if(cnt==x){
      if(b>c*2) money+=(y-x)*c*2;
      else money+=(y-x)*b;
    }
    else{
      if(a>c*2) money+=(x-y)*c*2;
      else money+=(x-y)*a;
    }
    cout<<money;
  }
  else cout<<a*x+b*y;

}


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

int main(int argc, char const *argv[]){
	std::string law_data;
	std::cin >> law_data;
	int area = 0;
	int cnt = 0;
	std::vector< std::pair<int,int> > areas;
	std::vector<int> stack;

	for (int i = 0; i < law_data.length(); ++i){
		switch(law_data[i]){
			case '\\':
					stack.push_back(i);
					break;
			case '/':
					if(!stack.empty()){
						int j = stack.back();
						stack.pop_back();
						int buff = i - j;
						area += buff;
						while( !areas.empty() &&areas.back().first > j){
							buff += areas.back().second;
							areas.pop_back();
						}
						areas.push_back(std::make_pair(j,buff));
					}
					break;
			case '_':
					break;
			default:
					return 0;
					break;
		}
	}

	std::cout << area <<std::endl;
	std::cout << areas.size();
	for (int i = 0; i < areas.size(); ++i){
	 	std::cout << " " << areas[i].second;
	} 
	std::cout << std::endl;

	return 0;
}


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

Measured memory_bytes: 256
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    long n, m;
    cin >> n >> m;
    vector <int> v(m);
    ll sum = 0;
    for (int i = 0; i < m; i++){
        cin>> v[i];
        sum += v[i];
    }
    if (sum > n) cout << -1;
    else cout << n-sum;
    return 0;
}




Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint N,K;
    cin >> N >> K;
    lint A[N];
    rep(i,N) cin >> A[i];
    lint dp[N+1][K+1]={};
    dp[0][0]=1;
    for(int i=0;i<N;i++){
        lint sum[K+2]={};
        for(int j=0;j<=K;j++) sum[j+1]=(sum[j]+dp[i][j])%MOD;
        for(int j=0;j<=K;j++) dp[i+1][j]=(dp[i+1][j]+(sum[j+1]-sum[max(0LL,j-A[i])])+MOD)%MOD;
    }
    cout << dp[N][K] << endl;
}

Measured memory_bytes: 80000
#include<iostream>
#include<algorithm>
#include<stack>
#include<vector>
#include<string>
using namespace std;

int main() {
    stack<int> S1;
    stack<pair<int, int> > S2;
    string str;
    int sum = 0;
    cin >> str;
    for (int i=0; i<str.length(); i++) {
        if (str[i]=='\\') S1.push(i);
        else if (str[i] == '/' && S1.size() > 0) {
            int j = S1.top();
            S1.pop();
            sum += i-j;
            int a = i-j;
            while (S2.size() > 0 && S2.top().first > j) {
                a+= S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }
    
    vector<int> ans;
    while (S2.size() > 0){
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i=0; i<ans.size(); i++) {
        cout << " " << ans[i];
    }
    cout << endl;
}



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

using namespace std;

#define lint long long

const lint mod = 1E9 + 7;


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

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

    multiset<int> Nums;
    for(int i = 0; i < N; ++i){
        auto ItrL = Nums.lower_bound(A[i] - 1);
        auto ItrU = Nums.upper_bound(A[i] - 1);

        if(ItrU == Nums.begin()){
            Nums.insert(A[i]);
        } else{
            Nums.erase(--ItrU);
            Nums.insert(A[i]);
        }

    }
    cout << Nums.size() << endl;
}

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

int main() {
    int n,i;
    cin >> n;
    int x[n];
    for (i = 0; i < n; i++){
        cin >> x[i];
    }
    for (i = n; i > 0; i--)
    {
        cout << x[i-1];
        if(i >1) cout << " ";
    }
    cout << endl;
    
    return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve(ll X, ll N, vector<ll> p) {
  REP(i, 100) {
    if (find(p.cbegin(), p.cend(), X - i) == p.cend()) {
      cout << X - i << endl;
      return;
    }
    if (find(p.cbegin(), p.cend(), X + i) == p.cend()) {
      cout << X + i << endl;
      return;
    }
  }    
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll X;
  cin >> X;
  ll N;
  cin >> N;
  vector<ll> p(N);
  REP(i, N) {
    cin >> p[i];
  }

  solve(X, N, move(p));

  return 0;
}


Measured memory_bytes: 3656
a,b = map(int, input().split())
if a == 0 or b == 0 or (a <= 0 and b >= 0):
    print("Zero")
elif a>0 and b>0:
    print("Positive")
elif (a - b)%2 == 0:
    print("Negative")
else:
    print("Positive")

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int n,k;
  int i;
  int a=1;
  scanf("%d %d",&n,&k);
  for(i=n;i>0;i--){
    if(a*2<a+k){
      a=a*2;
    }else{
      a=a+k;
    }
  }
  printf("%d\n",a);
  return(0);
}

		   


Measured memory_bytes: 128
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' ).map( Number );
  var n = data[0];
  var Ri = Number.POSITIVE_INFINITY;
  var profit = Number.NEGATIVE_INFINITY;
  var d = Number.NEGATIVE_INFINITY;
  for( var i=1; i<=n; i++ ) {
    d = data[i]-Ri;
    if( profit < d ) {
      profit = d;
    }
    if( data[i] < Ri ) {
      Ri = data[i];
    }
  }
  
  console.log( profit );
});

Measured memory_bytes: 41024
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}




int main(void) {
  ll N;
  cin >> N;
  string s;
  cin >> s;
  ll i;
  
  ll loc=0, roc=0;
  for(i=0; i<N; i++) {
    if(s[i]=='.') roc++;
  }
  
  ll ans=roc;
  for(i=0; i<N; i++) {
    if(s[i]=='.') {
      loc++;
      roc--;
    }
    
    chmin(ans, (i+1-loc)+roc);
  }
  
  pt(ans);
  
}
  
  
  
  
  
  
  
  
  
  


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define tc int t; cin>>t; while(t--)
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define mod 1000000007
#define pb push_back
#define vi vector<int>
#define vc vector<char>
#define eb emplace_back
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fo(i,x,n) for(int i=x;i<n;i++)
#define csb(x) __builtin_popcount(x)
#define tz(x) __builtin_ctz(x)
#define lsbp(x) __builtin_ffs(x)
#define msbp(x) __lg(x)
#define btoi(str,i) stoi(str,0,i)
#define ff first
#define ss second
const int inf=0x3f3f3f3f3f3f3f3f;



int32_t main(){

int n,k;cin>>n>>k;
int x=500*n;
if(x>=k)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}

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

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

int main() {
    int N;
    cin >> N;
    int crtmin;
    int crtmax = -2e9;
    cin >> crtmin;
    REP(i,N-1) {
        int n;
        cin >> n;
        crtmax = max(crtmax, n - crtmin);
        crtmin = min(crtmin, n);
    }
    cout << crtmax << endl;
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define N 116
#define mod 1000000007

int n,a[N],f[N][N][N];

void pls(int &x,int y){x=(x+y)%mod;}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();
	for (int i=1;i<=2*n-1;i++) a[i]=read();
	sort(a+1,a+2*n);a[0]=a[1];a[2*n]=a[2*n-1];
	f[n][a[n]!=a[n-1]][a[n]!=a[n+1]]=1;
	for (int i=n;i>1;i--){
		int l=a[i-2]!=a[i-1],r=a[2*n-i+2]!=a[2*n-i+1];
		for (int j=0;j<=2*n-1;j++)
			for (int k=0;k<=2*n-1;k++)
				if (f[i][j][k]){
					for (int t=0;t<j;t++) pls(f[i-1][t+l][k+r+1],f[i][j][k]);
					pls(f[i-1][j+l][k+r],f[i][j][k]);
					for (int t=0;t<k;t++) pls(f[i-1][j+l+1][t+r],f[i][j][k]);
				}
	}
	int ans=0;
	for (int i=0;i<=2*n-1;i++)
		for (int j=0;j<=2*n-1;j++)
			pls(ans,f[1][i][j]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  int a[N], b[N];
  rep(i, N)
    cin >> a[i] >> b[i];
  int c[M], d[M];
  rep(i, M)
    cin >> c[i] >> d[i];
  //入力終了

  rep(i, N){
    //距離の最小値と，その地点
    int min = 1000000000, point;
    rep(j, M){
      //最小値更新
      if( (abs(a[i]-c[j]) + abs(b[i]-d[j])) < min){
	min = abs(a[i]-c[j]) + abs(b[i]-d[j]);
	point = j+1;
      }
    }
    //学生iの解答
    cout << point << endl;
  }
    
  return 0;
}


Measured memory_bytes: 3592
def A():
    n = int(input())
    hon = [2, 4, 5,7,9]
    pon = [0, 1, 6, 8]
    bon = [3]
    if n%10 in hon:
        print("hon")
    elif n%10 in pon:
        print("pon")
    elif n%10 in bon:
        print("bon")
A()

Measured memory_bytes: 9172
fun main(args: Array<String>) {
    val (A, B, N) = readLine()!!.split(" ").map(String::toLong)

    val n = N / B
    listOf(n * B - Math.ceil(B.toDouble()/ A.toDouble()).toLong(), n * B - Math.floor(B.toDouble()/ A.toDouble()).toLong() , N).map {
           ((A * it) / B - A * (it / B))
    }.max()!!.run(::println)
}

Measured memory_bytes: 39028
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int time;
  int ans = 0;
  for(int i = 0;i < 4;i++){
    cin >> time;
    ans += time;
  }
  cout << ans/60 << endl;
  cout << ans%60 << endl;
}

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

void call(int n) {
    
    for(int i=1; i<=n; i++){
        
        int x = i;
        if(x%3==0){
            cout<<" "<<i;
            continue;
        }
        
        while(x){
            if(x%10==3){
                cout<<" "<<i;
                break;
            }
            x /= 10;
        }
        
    }
    
    cout << endl;
    
}

int main(int argc, const char * argv[]) {
    
    int n;
    cin >> n;
    
    call(n);
    
    return 0;
}



Measured memory_bytes: 3080
#include <vector>
#include <string>
#include <iostream>
#include <stdlib.h> // @atoi
#include <map>
#include <algorithm>
using namespace std;


int main(void)
{
	int stringLength, questNum;
	string checkStr;
	struct quiz
	{
	public:
		int start;
		int end;
		quiz()
		{
			start = 0;
			end = 0;
		}
	};
	std::vector<quiz> vQuest;
	cin >> stringLength >> questNum;
	cin >> checkStr;
	for (int i = 0; i < questNum; ++i)
	{
		quiz tmp;
		cin >> tmp.start >> tmp.end;
		vQuest.push_back(tmp);
	}

	std::vector<char> vACGT = {
		{ 'A'},
		{ 'T'},
		{ 'C'},
		{ 'G'},
	};

	// 累積和を使用
	vector<int> vRuiseki(checkStr.size()+1, 0);

	// 任意の番号の文字までに出た”AC”の数を保存していく
	for (int i = 1; i < vRuiseki.size(); ++i)
	{
		if (checkStr[i - 1] == 'A' && checkStr[i] == 'C')
		{
			vRuiseki[i + 1] = vRuiseki[i] + 1;
		}
		else
		{
			vRuiseki[i + 1] = vRuiseki[i];
		}
	}

	for (int i = 0; i < vQuest.size(); ++i)
	{
		cout << vRuiseki[vQuest.at(i).end] - vRuiseki[vQuest.at(i).start] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2292
a11, a12 , a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())

A =[a11,a12,a13,a21,a22,a23,a31,a32,a33]
n = int(input())
B =[]
for i in range(n):
    s = int(input())
    B.append(s)

bingo = [[0, 0, 0] for i in range(3)]

for i in B:
    for s, k in enumerate(A):
        if i == k:
            bingo[int(s/3)][s % 3] = 1

if (bingo[0][0] == 1 and bingo[0][1] == 1 and bingo[0][2] ==1 ) or \
(bingo[1][0] == 1 and bingo[1][1] == 1 and bingo[1][2] ==1) or \
    (bingo[2][0] == 1 and bingo[2][1] == 1 and bingo[2][2] ==1) or \
        (bingo[0][0] == 1 and bingo[1][0] == 1 and bingo[2][0] ==1) or \
            (bingo[0][1] == 1 and bingo[1][1] == 1 and bingo[2][1] ==1) or \
                (bingo[0][2] == 1 and bingo[1][2] == 1 and bingo[2][2] ==1) or \
                    (bingo[0][0] == 1 and bingo[1][1] == 1 and bingo[2][2] ==1) or \
                        (bingo[0][2] == 1 and bingo[1][1] == 1 and bingo[2][0] ==1):
    print("Yes")
else:
    print("No")

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

mat=[[True]*H for _ in range(W)]
#print(mat)

for _ in range(N):
  x,y,a=map(int,input().split())
  if a==1:
    for i in range(x):
      for j in range(H):
        mat[i][j]=False
  elif a==2:
    for i in range(x,W):
      for j in range(H):
        mat[i][j]=False
  elif a==3:
    for i in range(W):
      for j in range(y):
        mat[i][j]=False
  elif a==4:
    for i in range(W):
      for j in range(y,H):
        mat[i][j]=False
#print(mat)

answer=0
for i in range(W):
  for j in range(H):
    if mat[i][j]:
      answer+=1
      
print(answer)

Measured memory_bytes: 41712