akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const LL mod = 1e9 + 7;
const LL N = 1e6 + 5;
const LL M = 1e3 + 5;
#define FOR(i, n, m) for (int i = n; i <= m; i++)
#define mid ((l + r) >> 1)
#define lson (l, mid)
#define rson (mid + 1, r)
#define r(a) read(a)
#define rr(a, b) r(a), r(b)
#define rrr(a, b, c) rr(a, b), r(c)
#define rrrr(a, b, c, d) rrr(a, b, c), r(d)
int n, m, k, T;
template <class T>
T read(T &x) {
    T f = 1;
    x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 1) + (x << 3) + (ch - '0');
        ch = getchar();
    }
    x *= f;
}
LL qpow(LL a, LL b, LL p) {
    LL res = 1;
    while (b) {
        if (b & 1) res = (res * a) % p;
        a = (a * a) % p;
        b >>= 1;
    }
    return res;
}
LL ex_gcd(LL a, LL b, LL &x, LL &y) {
    if (!b) {
        x = 1, y = 0;
        return a;
    }
    LL res = ex_gcd(b, a % b, x, y);
    LL t = x;
    x = y;
    y = t - a / b * y;
    return res;
}
LL prime[N + 10], phi[N + 10], mou[N + 10], cnt_prime;
bool judgeprime[N + 10];
void ouler() {
    phi[1] = mou[1] = 1;
    FOR(i, 2, N) {
        if (!judgeprime[i]) prime[cnt_prime++] = i, phi[i] = i - 1, mou[i] = -1;
        for (int j = 0; j < cnt_prime && i * prime[j] <= N; j++) {
            judgeprime[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
                phi[i * prime[j]] = phi[i] * prime[j];
                mou[i * prime[j]] = 0;
                break;
            } else {
                mou[i * prime[j]] = -mou[i];
                phi[i * prime[j]] = phi[i] * (prime[j] - 1);
            }
        }
    }
}
LL a[N], sum[N];
int main() {
    rr(n, m);
    FOR(i, 1, n)
    r(a[i]);
    LL mmax = 0, ed = m;
    sum[1] = a[1];
    for (int i = 2; i <= n; i++) {
        sum[i] = a[i] + sum[i - 1];
    }
    for (int i = m; i <= n; i++) {
        if (sum[i] - sum[i - m] > mmax) {
            mmax = sum[i] - sum[i - m], ed = i;
        }
    }
    double ans = 0;
    for (int i = 1; i <= m; i++) {
        ans += (double)(a[ed - i + 1] + 1) / 2;
    }
    printf("%.9f\n", ans);
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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 namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

int extgcd(int a, int b, int &x, int &y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}

// m is a large prime integer. Usually 1000000007 is used.
int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x%m)%m;
}

signed main() {

  int n, x; cin >> n >> x;
  vector<int> s(n);
  rep(i, n) cin >> s[i];
  sort(s.begin(), s.end());
  //s.erase(unique(s.begin(), s.end()), s.end());

  vector<ll> fact(n+1);
  fact[0] = 1;
  for(int i=1; i<=n; i++) {
    fact[i] = fact[i-1]*i;
    fact[i] %= mod;
  }
  vector<ll> modinv(n+1);
  for(int i=1; i<=n; i++) {
    modinv[i] = mod_inverse(i, mod);
  }

  unordered_map<int, ll> mp;
  unordered_map<int, ll> mp2;

  rep(i, n) {
    int r = x%s[i];
    mp[-r] += fact[n-1];
    mp[-r] %= mod;
    //debugln(r);
  }

  bool flag = true;
  while(flag) {
    flag = false;
    for(auto e: mp) {
      int r = -e.first;
      auto it = upper_bound(s.begin(), s.end(), r);
      auto k = distance(s.begin(), it);
      if (k==0) {
        mp2[e.first] += mp[e.first];
        mp2[e.first] %= mod;
        continue;
      }
      for(int i=0; i<k; i++) {
        flag = true;
        int pos = -(r%s[i]);
        mp2[pos] += e.second * modinv[k];
        mp2[pos] %= mod;
        //debug(pos);debugln(mp2[pos]);
      }
    }
    mp = mp2;
    mp2.clear();
  }

  ll ans = 0;
  for(auto e: mp) {
    ans += (-e.second*e.first);
    ans %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#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 np next_permutation
typedef long long ll;


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, m;
  cin >> n >> m;
  vector<int> broken(n);
  rep(i, m){
    int a;
    cin >> a;
    broken[a] = 1;
  }

  vector<ll> dp(n+2);
  dp[n] = 1;
  for(ll i = n-1; i >= 0; i--){
    if(broken[i]){
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % 1000000007;
  }
  ll ans = dp[0] % 1000000007;
  cout << ans << endl;
}


/*





















*/


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

class Dice{
public:
	Dice(){
		number = new int[6];
		work = new int[6];
	};
	~Dice(){
		delete[] number;
		delete[] work;
	};

	void setLabel(int index,int num){
		number[index] = num;
	};

	void roll(char dst){
		for(int i = 0; i < 6; i++) work[i] = number[i];
		switch(dst){
		case 'E':
			setNumber(work[3],work[1],work[0],work[5],work[4],work[2]);
			break;
		case 'N':
			setNumber(work[1],work[5],work[2],work[3],work[0],work[4]);
			break;
		case 'S':
			setNumber(work[4],work[0],work[2],work[3],work[5],work[1]);
			break;
		case 'W':
			setNumber(work[2],work[1],work[5],work[0],work[4],work[3]);
			break;
		}
	};

	int returnPeek(){
		return number[0];
	}
	int returnfront(){
		return number[1];
	}
	int returnright(){
		return number[2];
	}
    int returnback(){
        return number[4];
    }
    int returnleft(){
        return number[3];
    }
    int returnunder(){
        return number[5];
    }

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

private:
	int* number;
	int* work;
};

int main(){
	Dice dice1,dice2;
	int a[6],b[6],c[3],d[3];
    for(int i=0;i<6;i++)cin >> a[i];
    for(int i=0;i<6;i++)cin >> b[i];
    c[0]=a[0]+a[5];c[1]=a[1]+a[4];c[2]=a[2]+a[3];
    d[0]=b[0]+b[5];d[1]=b[1]+b[4];d[2]=b[2]+b[3];
    sort(c,c+3);
    sort(d,d+3);
    int t=10;
    for(int i=0;i<3;i++){
        if(c[i]!=d[i])t=12;
    }
    if(t==12){
        cout << "No" << endl;
        return 0;
    }
	for(int i = 0; i < 6; i++){
		dice1.setLabel(i,a[i]);
        dice2.setLabel(i,b[i]);
	}

    int j=0;
    while(dice1.returnfront()!=dice2.returnfront()){dice1.roll('N');j++;if(j==4){
        dice1.roll('E');
    }
    if(j==10){
        cout << "No" << endl;
        return 0;
    }
    }
    int k=0;
    while(dice1.returnPeek()!=dice2.returnPeek()){dice1.roll('E');k++;if(k==10){
        cout << "No" << endl;
        return 0;
    }
    }
    if(dice1.returnright()==dice2.returnright()&&dice1.returnback()==dice2.returnback()&&dice1.returnleft()==dice2.returnleft())cout << "Yes" << endl;
    else{
        cout << "No" << endl;
    }
}


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

using namespace std;
int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<string>S(H);
	for (int n = 0;n<H; ++n) {
		cin >> S[n];
	}
	int X = 1 << H;
	int Y = 1 << W;
	int ans = 0;
	int test = 0;
	for (int n = 0;n<X;++n) {
		for (int m = 0;m<Y;++m) {
			vector<string>Scopy = S;
			for (int i = 0;i<H;++i) {
				if (0 != (n & (1 << i))) {
					for (int j = 0; j < W; ++j) {
						Scopy[i][j] = 'R';
					}
				}
			}
			for (int j = 0; j < W; ++j) {
				if (0 != (m & (1 << j))) {
					for (int i = 0; i < H; ++i) {
						Scopy[i][j] = 'R';
					}
				}
			}
			int count = 0;
			for (int i = 0; i < H; ++i) {
				for (int j = 0; j < W; ++j) {
					if ('#'== Scopy[i][j]) {
						count++;
					}
				}
			}
			if (K == count) {
				ans++;
			}
		}
	}
	cout << ans<<  endl;
}


Measured memory_bytes: 3628
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;

int h, w, n, a[100000], b[100000];
ll cnt[10];
map<pair<int, int>, pair<int,bool>>mp;

int main() {
	cin >> h >> w >> n;
	lp(n) {
		cin >> a[i] >> b[i];
		for (int j = a[i] - 2; j <= a[i]; j++)
			for (int k = b[i] - 2; k <= b[i]; k++)
				if (mp.find(make_pair(j, k)) == mp.end()) {
					mp[make_pair(j, k)] = make_pair(1, false);
				}
				else mp[make_pair(j, k)].first++;
	}
	lp(9) {
		cnt[i + 1] = 0;
	}
	cnt[0] = ll(h - 2)*ll(w - 2);
	lp(n) {
		for (int j = a[i] - 2; j <= a[i]; j++)
			for (int k = b[i] - 2; k <= b[i]; k++)
				if (!mp[make_pair(j, k)].second && 0 < j&&j <= h-2 && 0 < k&&k <= w-2) {
					cnt[0]--;
					cnt[mp[make_pair(j, k)].first]++;
					mp[make_pair(j, k)].second = true;
				}
	}
	lp(10)
		cout << cnt[i] << endl;
	return 0;
}

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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>
#define int ll

void solve(){
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 3; ++i) 
        if (a != i && b != i)
            cout << i << endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
x=gets.to_i
a=[1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000]
ans=1
a.each{|e|ans=e if e<=x}
p ans

Measured memory_bytes: 3836
X = int(input())

def is_exponential(n,j):
    tmp = 1

    while (tmp < j):
        tmp *= n
        if tmp == j:
            return 1
        elif tmp > j:
            return 0

j = X
while (j > 0):
    res = []
    for i in range(2, j):
        res.append(is_exponential(i,j))
    if sum(res) > 0:
        print(j)
        break
    j -= 1
    if j == 0:
        print(X)



Measured memory_bytes: 3060
A,B,C,D = map(int, input().split())
f = True#高橋くんが勝つ
while True:
    C = C -B
    if C <= 0:
        f = True
        break
    A = A - D
    if A <= 0:
        f = False
        break
if f:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9196
import sys
n, k = map(int, input().split())
H = list(map(int, input().split()))
C = [10**11] * n
C[0] = 0

if n == 2:
  print(abs(H[0] - H[1]))
  sys.exit()

for i in range(n):
  for j in range(i+1, i+k+1):
    if j >= n:
      break
    else:
      C[j] = min(C[i] + abs(H[j] - H[i]), C[j])  
print(C[-1])

Measured memory_bytes: 52448
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

ll GCD_multi(vector<ll> a)
{
  ll g = a[0];
  FOR(i,1,a.size()){
    g = GCD(a[i], g);
  }
  return g;
}

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i,n) cin >> a[i];
  cout << GCD_multi(a) << '\n';
  
}

Measured memory_bytes: 1792
#include <math.h>
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int M1,D1; cin>>M1>>D1;
  int M2,D2; cin>>M2>>D2;

  int ans = D2==1 ? 1 : 0;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <stack>
#include <ctime>
#include <string>
#include <vector>
#include <sstream>
#include <functional>
#include <algorithm>
using namespace std;

#define mem(a,n) memset(a,n,sizeof(a))
#define memc(a,b) memcpy(a,b,sizeof(b))
#define rep(i,a,n) for(int i=a;i<n;i++) ///[a,n)
#define dec(i,n,a) for(int i=n;i>=a;i--)///[n,a]
#define pb push_back
#define fi first
#define se second
#define IO ios::sync_with_stdio(false)
#define fre freopen("in.txt","r",stdin)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const double PI=acos(-1.0);
const double E=2.718281828459045;
const double eps=1e-3;
const int INF=0x3f3f3f3f;
const int MOD=258280327;
const int N=1e6+5;
const ll maxn=1e6+5;
const int dir[4][2]= {-1,0,1,0,0,-1,0,1};
int main()
{
    int n,a;
    while(cin>>n>>a)
    {
        n%=500;
        printf("%s\n",a>=n?"Yes":"No");
    }
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define pb push_back
#define si second
#define int unsigned long long
#define mod 1000000007
#define debug(x) cout << #x << " " << x <<endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define double long double
#define all(o) o.begin(),o.end()
using namespace std;
int power(int x, int y)
{
    int res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1; // y = y/2
        x = (x*x) % mod;
    }
    return res%mod;
}
int inv(int  n)
{
    return power(n,mod-2)%mod;
}


pii a[2000];
int32_t main(){

    fast
    int n,i;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i].fi>>a[i].si;
    for(i=2;i<n;i++){
        if(a[i].fi==a[i].si && a[i-1].fi==a[i-1].si && a[i-2].fi==a[i-2].si)
        {   cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
}




 

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    bool a_exist = false, b_exist = false;
    for (int i = 0; i < 3; i++)
    {
        if (S[i] == 'A')
            a_exist = true;
        if (S[i] == 'B')
            b_exist = true;
    }
    if (a_exist && b_exist)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i=0,j=0,k=0;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] a = new int[n];
		for(i=0;i<n;i++) {
			a[i] = parseInt(sc.next());
		}
		sc.close();
		ArrayDeque<Integer> b = new ArrayDeque<>();
		int mod = n % 2;
		for(i=0;i<n;i++) {
			if((i+mod)%2==1) {
				b.addFirst(a[i]);
			} else {
				b.addLast(a[i]);
			}
		}
		PrintWriter pw = new PrintWriter(out);
		for (i = 0; i < n; i++) {
			pw.print(b.removeFirst());
			pw.print(" ");
		}
		pw.flush();
	}
}


Measured memory_bytes: 63692
#include <stdio.h>
#include <math.h>
int main(void)
{
  double x1,y1,x2,y2;
  double ans;
  
  scanf("%lf",&x1);
  scanf("%lf",&y1);
  scanf("%lf",&x2);
  scanf("%lf",&y2);

  ans=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
  ans=sqrt(ans);
  printf("%f\n",ans);

  return 0;
}

Measured memory_bytes: 652
#define _CRT_SECURE_NO_WARNINGS
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
using namespace std;
typedef long long ll;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

const int N=1000000+1;
bool isp[N];
vector<int> ps;
void init(){
    memset(isp,1,sizeof(isp));
    isp[0] = isp[1] = false;
    for(int i=2;i<N;i++){
        if(!isp[i])continue;
        ps.push_back(i);
        for(int j=i+i;j<N;j+=i){
            isp[j] = false;
        }
    }
}

int cnt(int p, int m) {
    auto u = lower_bound(all(ps), p+m+1);
    auto l = lower_bound(all(ps), p-m);
    return u - l;
}

int n,p,m;

int main() {
    init();
    while(cin>>n && n) {
        int ans = 0;
        rep(x,n){
            cin>>p>>m;
            ans += cnt(p, m)-1;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

const int INF = 1e9 + 239;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	
	
	int n, m, X;
	cin >> n >> m >> X;
	vector<int> c(n);
	vector<vector<int>> up(n, vector<int> (m));
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (auto &x : up[i]) {
			cin >> x;
		}
	} 	
	int ans = INF;
	for (int mask = 0; mask < (1 << n); mask++) {
		vector<int> cc(m);
		int curc = 0;
		for (int i = 0; i < n; i++) {
			if (!((mask >> i) & 1)) continue;
			curc += c[i];
			for (int j = 0; j < m; j++) {
				cc[j] += up[i][j];
			}
		}
		if (*min_element(cc.begin(), cc.end()) >= X) ans = min(ans, curc);
	}
	if (ans == INF) {
		cout << -1 << endl;
	} else {
		cout << ans << endl;
	}
}


Measured memory_bytes: 3196
import java.util.*;

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

        int n = sc.nextInt();
        Integer[] a = new Integer[n];

        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }

        Arrays.sort(a, Comparator.reverseOrder());

        long x = 0;
        long y = 0;
        int c = 0;

        for(;c < n - 1; c++){
            if(a[c].equals(a[c + 1])){
                x = a[c];
                c += 2;
                break;
            }
        }
        for(;c < n - 1; c++){
            if(a[c].equals(a[c + 1])){
                y = a[c];
                break;
            }
        }

        System.out.println(x * y);

    }
}


Measured memory_bytes: 62656
n = int(input())
P_list = list(map(int,input().split()))
cnt = 0

for i in range(n-2):
    if (P_list[i]>P_list[i+1] and P_list[i+1]>P_list[i+2]) or (P_list[i]<P_list[i+1] and P_list[i+1]<P_list[i+2]):
        cnt+=1

print(cnt)

Measured memory_bytes: 3060
n = int(input())
height_lists=list(map(int, input().split()))
for i in range(1,n):
    #print(i)
    #print(height_lists)
    #print()
    if height_lists[i-1] < height_lists[i]:
        height_lists[i] -=1
    else:
        pass
cp_list = height_lists.copy()
cp_list.sort()
#print(height_lists)
#print(cp_list)

if cp_list == height_lists:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20660
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int a,b;cin>>a>>b;
    cout<<a-b+1<<endl;
}


Measured memory_bytes: 3572
/*
g++ -std=c++14 -o2 -Wall ABC126C.cpp -o .\out\ABC126C.out
.\out\ABC126C.out
*/

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

typedef long long ll;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  long double ans = 0.0;
  ans += (1.0 * max(0, n - k + 1)) / n;
  for (int i = 1; i <= min(n, k - 1); ++i) {
    int now = i;
    long long temp = 1ll;
    while (now < k) {
      now *= 2;
      temp *= 2;
    }
    ans += (long double)1.0 / temp / n;
  }
  //0.145833333333
  //0.14583333333
  cout << std::setprecision(13);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	int ans = a;
	if (a > b) ans--;

	cout << ans << endl;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
 
using namespace std;
 
 
int main(void)
{
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a==1 &&b==1) puts("Open");
	else if(c==1) puts("Open");
	else puts("Close");

    return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,ali= 0,bob=0;
  cin >> n;
  int a[n];

  for(int i=0;i<n;i++)
    {
      cin >> a[i];
    }
  
  sort(a,a + n,greater<int>());

  for(int i=0;i<n;i++)
    {
      if(i % 2 == 0)ali +=a[i];
      if(i % 2 == 1)bob +=a[i];
    }
  cout << ali - bob << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;

int main(){
    
    int N;
    cin>>N;
    
    REP(i,N){
        int a,b,c;
        cin>>a>>b>>c;
        if(a*a==b*b+c*c)cout<<"YES"<<endl;
        else if(b*b==a*a+c*c)cout<<"YES"<<endl;
        else if(c*c==a*a+b*b)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    string S;
    cin >> S;
    int s=S.size();
    int ans=1000;
    rep (i,26){
        vector<bool> same(s,false);
        int count=0;
        bool ex=true;
        int c=0;
        rep(j,s){
            if (S[j]==alp[i]){
                same[j]=true;
                ex=false;
                c++;
            }
        }
        if (ex){
            continue;
        }
        if (c==s){
            ans=0;
            break;
        }
        while(true){
            for (int j=1;j<s-count;j++){
                if (same[j]){
                    same[j-1]=true;
                }
            }
            count++;
            bool finish=true;
            rep (j,s-count){
                if (!same[j]){
                    finish=false;
                }
            }
            if (finish){
                ans=min(ans,count);
                break;
            }
        }
    }
    cout << ans << endl;
}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    std::cin >> N;
    std::vector<std::vector<int>> A(N, std::vector<int>(N - 1));

    rep(i, N) {
      rep(j, N - 1) {
        std::cin >> A[i][j];
        --A[i][j];
      }
    }
    rep(i, N) {
      std::reverse(A[i].begin(), A[i].end());
    }

    std::queue<std::pair<int, int>> q;
    std::vector<std::vector<bool>> used(N, std::vector<bool>(N, false));

    auto check = [&](int i) {
      if(A[i].size() == 0) return;
      int j = A[i].back();
      if(A[j].size() == 0) return;
      if(A[j].back() != i) return;
      if(used[i][j]) return;

      used[i][j] = true;
      used[j][i] = true;
      q.push(std::make_pair(i, j));
    };

    rep(i, N) {
      check(i);
    }

    int cnt = 0;
    while(! q.empty()) {
      std::queue<std::pair<int, int>> q_;
      std::swap(q, q_);
      while(! q_.empty()) {
        auto p = q_.front(); q_.pop();
        int i, j;
        i = p.first;
        j = p.second;
        A[i].pop_back();
        A[j].pop_back();
        check(i);
        check(j);
      }
      ++cnt;
    }

    rep(i, N) {
      if(A[i].size() != 0) {
        std::cout << "-1" << '\n';
        return 0;
      }
    }

    std::cout << cnt << '\n';
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int a,b,c;
   cin >> a >> b >> c;
   if(c>=a && c<=b)cout << "Yes" << endl;
   else cout << "No" << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
int MOD = 1000000007;

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	double dx = x2 - x1, dy = y2 - y1;
	printf("%f\n", sqrt(dx * dx + dy * dy));
}

Measured memory_bytes: 1228
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	n := getInt()
	if n%2 == 0 {
		fmt.Println(n)
	} else {
		fmt.Println(n * 2)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void solve() {
    int n, k;
    std::cin >> n >> k;

    std::vector<int> ps;
    for (int p = 1; p * p <= n; ++p) {
        if (n % p != 0) continue;
        ps.push_back(p);

        if (n / p == p) continue;
        ps.push_back(n / p);
    }

    int m = ps.size();
    std::sort(ps.begin(), ps.end());
    std::map<int, int> revp;
    for (int i = 0; i < m; ++i) revp[ps[i]] = i;

    std::vector<std::vector<int>> divs(m);
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < i; ++j) {
            if (ps[i] % ps[j] == 0) divs[i].push_back(j);
        }
    }

    std::vector<mint> pats(m);
    mint ans = 0;
    for (int i = 0; i < m; ++i) {
        pats[i] = mint(k).pow((ps[i] + 1) / 2);
        for (int j : divs[i]) pats[i] -= pats[j];

        ans += pats[i] * ps[i] / (ps[i] % 2 == 0 ? 2 : 1);
    }
    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1152
#include<iostream>
using namespace std;
 
int main(){
  int a,s,b,t,q;
  cin>>a>>s>>b>>t>>q;
  
  if(s>t){
    int y= s-t;
    int d= a>b?a-b:b-a;
    if(d==0){
      cout<<"YES"<<endl;
    }else{
       int x= d%y==0?d/y:(d/y)+1;
      if(q>=x){
        cout<<"YES"<<endl;
      }else{
        cout<<"NO"<<endl;
      }
    }
  }else{
    if(a==b){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


vector<P> count_runlength(char* a, char* b) {
	vector<P> v;
	for (char* p = a; p < b;) {
		char* q = p;
		while (q < b && *p == *q) q++;
		v.push_back(P(*p, q - p));
		p = q;
	}
	return v;
}

signed main() {

	int N;
	cin >> N;
	string s;
	cin >> s;
	vector<P> p = count_runlength((char*)s.c_str(), (char*)s.c_str() + s.length());
	cout << p.size() << endl;
	
	return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll N;
vector<string> S;

void dfs(string s, char c) {
    if (s.length() == N) {
        S.push_back(s);
        return;
    }

    for (char t = 'a'; t < c; ++t) {
        s.push_back(t);
        dfs(s, c);
        s.pop_back();
    }
    s.push_back(c);
    dfs(s, c + 1);
}

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

    dfs("", 'a');

    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    REP(i, S.size()) {
        cout << S[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 9332
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)


int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--;
    y--;
    vector<int> cnt(n);//index 0nashi!!!!!!!!!!!!!!
    rep(i, n) cnt[i] = 0;
    rep(i, n - 1)repi(j, i + 1, n) {
        cnt[min(j - i, abs(i - x) + 1 + abs(y - j))]++;
    }
    repi(i, 1, n)cout << cnt[i] << endl;
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<long long> a(3*n);
  
  for(int i = 0;i < 3*n;++i) cin >> a[i];
  sort(a.begin(),a.end(),greater<long long>());
  long long sum = 0;
  for(int i = 0;i < n;++i){
    sum += a[2*i+1];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 2560
N = int(input())
ans ='No'
for a in range(N//4+1):
    for b in range(N//7+1):
        total = a*4+b*7
        if total==N:
            ans='Yes'
            break
        else:
            continue
        break
if ans=='Yes':
    print(ans)
else:
    print('No')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int n,x,minx=10000005,ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x<minx)
		{
			ans++;
			minx=x;
		}
	}
	cout<<ans;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
/*最上位桁を見て　1ならその数字か一つ下げて999　
2以上ならひとつ下げて　その数字か999
*/

lint sum_digit(lint x)
{
    lint sumx = 0;
    FOR(j, 1, 20)
    {
        sumx += (x % (lint)pow(10, j)) / (lint)pow(10, j - 1);
    }
    return sumx;
}

int main()
{
    lint n;cin >> n;
    string s = to_string(n);
    lint ans=0;

    ans = sum_digit(n);

    lint tmp = (s[0] - '0') + 9 * (SZ(s) - 1)-1;
    ans = max(ans, tmp);



    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn, dt;
inline void putint(ll X) {
	int keta = 0;
	char C[20];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int N;
ll D[100001];
int E[200001], Ed[200001], E2[200001], H[100001];
void dfs(int A, ll B) {
	*(D + A) = B;
	for (int i = H[A]; i; i = E2[i]) if (!(*(D + E[i]))) dfs(E[i], B + Ed[i]);
}

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


	int N = getint();
	int k = 1;
	rep(i, N - 1) {
		int a = getint();
		int b = getint();
		int c = getint();
		E[k] = b;
		Ed[k] = c;
		E2[k] = H[a];
		H[a] = k++;
		E[k] = a;
		Ed[k] = c;
		E2[k] = H[b];
		H[b] = k++;
	}
	int Q = getint();
	int K = getint();
	dfs(K, 1);
	rep(i, Q) {
		int x = getint();
		int y = getint();
		putint(*(D + x) + *(D + y) - 2);
	}

	fwrite(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 9984
N = int(input())

L = []
for i in range(1000002):
    if i % 3 != 0 and i % 5 != 0:
        L.append(i)
    else:
        L.append(0)

LL = [0]
for i in range(1, 1000001):
    LL.append(LL[i-1] + L[i])

print(LL[N])


Measured memory_bytes: 88080
#include<stdio.h>

int main(){
  int h,w,i,j,flag=1;
  char s[50][50];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)
    scanf("%s",s[i]);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(s[i][j]=='#'){
        flag=0;
        if(i!=0){
          if(s[i-1][j]=='#') flag=1;
        }
        if(i!=h-1){
          if(s[i+1][j]=='#') flag=1;
        }
        if(j!=0){
          if(s[i][j-1]=='#') flag=1;
        }
        if(j!=w-1){
          if(s[i][j+1]=='#') flag=1;
        }
        if(!flag){
          printf("No\n");
          return 0;
        }
      }
    }
  }
  if(flag) printf("Yes\n");
  else printf("No\n");
}

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

int n, m;
long long tot;

int main()
{
    scanf("%d%d", &n, &m);
    tot = 1900 * m + 100 * (n - m);
    while (m--) tot = tot * 2;
    printf("%lld\n", tot);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<set>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
const int INF=1100000000;
int G1[250][250],G2[250][250];
int d1[250],d2[250];
bool u1[250],u2[250];
int main(){
	int n,m,r,s,e,f;
	while(cin>>n>>m,n!=0||m!=0){
	
	for(int i=0;i<250;i++)fill(G1[i],G1[i]+250,INF),fill(G2[i],G2[i]+250,INF);
	for(int i=0;i<n;i++){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	G1[a][b]=G1[b][a]=c;
	G2[a][b]=G2[b][a]=d;
	}
	cin>>r;
for(int ccnt=0;ccnt<r;ccnt++){
	cin>>s>>e>>f;
	for(int i=0;i<250;i++)d1[i]=d2[i]=INF,u1[i]=u2[i]=0;
	d1[s]=0;
	int mini,to;
	for(int i=0;i<m;i++){
	mini=INF,to=0;
		for(int j=1;j<=m;j++){if(mini>d1[j]&&u1[j]==0)mini=d1[j],to=j;}
	for(int j=1;j<=m;j++)d1[j]=min(d1[j],G1[to][j]+d1[to]);
	u1[to]=1;
	}
	d2[s]=0;
	for(int i=0;i<m;i++){
		mini=INF,to=0;
		for(int j=1;j<=m;j++)if(mini>d2[j]&&u2[j]==0)mini=d2[j],to=j;
		for(int j=1;j<=m;j++)d2[j]=min(d2[j],G2[to][j]+d2[to]);
		u2[to]=1;
	}
	if(f==0)cout<<d1[e]<<endl;
	else cout<<d2[e]<<endl;
}
}
	return 0;
}

Measured memory_bytes: 1660
#include <stdio.h>
int main(){
  int h,w,i,j;

  while(1){
    scanf("%d %d",&h,&w);
    if((h==0)&&(w==0)) break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if((i==0)||(i==h-1)||(j==0)||(j==w-1)) printf("#");
	else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    if(n == 2){
        cout << 1 << endl;
        return 0; 
    }
    vec<ll> div;
    for(ll i=2;i*i<=n;i++){
        if(!(n%i)){
            div.emplace_back(i);
            if(i*i != n)div.emplace_back(n/i);
        }
    }
    div.emplace_back(n);
    ll ans = 1;
    for(auto k : div){
        ll m = n;
        while(m%k==0)m/=k;
        if(m%k==1)ans++;
    }
    for(ll i=2;i*i<n;i++){
        if(!((n-1)%i))ans += 2;
        if(i*i == n-1)ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3668
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1)
    ans %= MOD
print(int(ans))


Measured memory_bytes: 9208
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int k = sc.nextInt();
   int a = sc.nextInt();
   int b = sc.nextInt();
   
   boolean flag=false;
   for(int i=a;i<=b;i++){
     if(i%k==0){
     flag=true;
       break;
     }
   }
   if(flag){
     System.out.println("OK");
   }
   else{
     System.out.println("NG");
   }
   
 
 }
}


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

int main(){
  int N, H;
  cin >> N >> H;
  vector<vector<int>> A(N,vector<int>(2));
  vector<vector<int>> B(N,vector<int>(2));
  for(int i=0; i<N; i++){
    cin >> A.at(i).at(0);
    A.at(i).at(1) = i;
    cin >> B.at(i).at(0);
    B.at(i).at(1) = i;
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  
  int cnt = 0;
  int x = N-1;
  int y = N-1;
  while(H > 0){
    if(A.at(x).at(0) < B.at(y).at(0)){
      if(y == 0 && H > B.at(y).at(0)){
        cnt++;
        H -= B.at(y).at(0);
        cnt += (H + A.at(x).at(0) -1) / A.at(x).at(0);
        H = 0;
        break;
      }
      H -= B.at(y).at(0);
      y--;
      cnt++;
    }
    else{
      cnt += (H + A.at(x).at(0) -1) / A.at(x).at(0);
      H = 0;
    }
  }
  cout << cnt << endl;  
}

Measured memory_bytes: 13184
#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#define fcout(n) cout<<fixed<<setprecision((n))
using namespace std;
int main(){
	int a,b,c,t=0;
	cin>>a>>b>>c;
	while(1){
		if(t>10000007){
			t=-1;
			break;
		}
		if((c+60*t)%(a+b)<=a){
			break;
		}
		else t++;
	}
	if(t==-1) cout<<-1<<endl;
	else cout<<60*t+c<<endl;
}

Measured memory_bytes: 3104
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 123456;
int a[MAXN], pre[MAXN], suf[MAXN];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        scanf("%d", &a[i]);
        pre[i] = __gcd(pre[i - 1], a[i]);
    }
    for (int i = N; i >= 1; i--) {
        suf[i] = __gcd(suf[i + 1], a[i]);
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        ans = max(ans, __gcd(pre[i - 1], suf[i + 1]));
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

bool debug = 0;

void solve() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> cake(h);
    for (int i = 0; i < h; i++) cin >> cake[i];
    vector<bool> berry(h, false);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (cake[i][j] == '#') berry[i] = true;
        }
    }
    vector<vector<int>> cut(h, vector<int>(w, 0));
    int cnt = 1;
    for (int i = 0; i < h; i++) {
        if (berry[i]) {
            bool already = false;
            for (int j = 0; j < w; j++) {
                if (cake[i][j] == '#') {
                    if (already)
                        cnt++;
                    else
                        already = true;
                }
                cut[i][j] = cnt;
            }
            cnt++;
        }
    }

    bool first = berry[0];
    for (int i = 0; i < h; i++) {
        if (!first) {
            if (!berry[i]) {
            } else {
                for (int j = 0; j < w; j++) {
                    for (int ii = 0; ii < i; ii++) {
                        cut[ii][j] = cut[i][j];
                    }
                }
                first = true;
            }
        } else {
            if (!berry[i]) {
                for (int j = 0; j < w; j++) {
                    cut[i][j] = cut[i - 1][j];
                }
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << cut[i][j] << " ";
        }
        cout << endl;
    }
}

int main() {
    if (debug) {
        while (true) {
            cout << "********" << endl;
            solve();
        }
    } else {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4156