akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
struct UnionFind {
  vector< int > par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
  vector< int > siz;
  int parsize;

  UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++)
      par[i] = i;
    siz.assign(N, 1);
    parsize = N;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (x < 0 || parsize <= x)
      return -1;
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }

  bool unite(int x, int y) { // xとyの木を併合
    if (x < 0 || parsize <= x || y < 0 || parsize <= y)
      return false;
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry)
      return false; // xとyの根が同じ(=同じ木にある)時はそのまま
    if (siz[x] < siz[y])
      swap(x, y);
    siz[x] += siz[y];
    par[ry] =
        rx; // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    return true;
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    if (x < 0 || parsize <= x || y < 0 || parsize <= y)
      return false;
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { return (x < 0 || parsize <= x) ? -1 : siz[root(x)]; }
};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, K, L;
  cin >> N >> K >> L;
  UnionFind road(N), railway(N);
  REP(i, K) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    road.unite(p, q);
  }
  REP(i, L) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    railway.unite(p, q);
  }
  map< int, int > g;
  vec< int > save(N);
  REP(i, N) {
    int val = road.root(i) * N + railway.root(i);
    save[i] = val;
    g[val]++;
  }
  REP(i, N) { cout << g[save[i]] << " "; }
  cout << "\n";
}

Measured memory_bytes: 19584
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int n,m,r;(n=s.nextInt())>0;System.out.println(r)){m=s.nextInt();Map<String,Long>a=new HashMap<String,Long>();for(;n-->0;)a.put(s.next().replaceAll("\\*",""),s.nextLong());for(r=0;m-->0;){String x=s.next();for(String y:a.keySet())if(x.matches(".*"+y+"$"))r+=a.get(y);}}}}

Measured memory_bytes: 13000
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

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

	multiset<int> s;
	multiset<int>::iterator it;

	for (i = n - 1; i >= 0; i--) {
		it = s.upper_bound(a[i]);
		if (it == s.end()) s.insert(a[i]);
		else {
			s.erase(it);
			s.insert(a[i]);
		}
	}

	ans = s.size();
	cout << ans << "\n";

	return 0;
}



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

using namespace std;
typedef long long ll;

vector<ll> tgt(3, 0);
vector<ll> ls;
vector<ll> used;

ll dfs(ll pos){
    if(pos < used.size()){
        ll mp = 3000;
        for(int i = 0; i <= 3; ++i){
            used.at(pos) = i;
            mp = min(dfs(pos + 1), mp);
        }
        return mp;
    }else{
        vector<ll> ns(4, 0);
        vector<ll> lens(4, 0);
        for(int i = 0; i < ls.size(); ++i){
            ns.at(used.at(i)) += 1;
            lens.at(used.at(i)) += ls.at(i);
        }
        if(ns.at(1) == 0 || ns.at(2) == 0 || ns.at(3) == 0){
            return 3000;
        }
        ll mp = 0;
        for(int i = 1; i < 4; ++i){
            mp += 10 * (ns.at(i) - 1);
            mp += abs(tgt.at(i - 1) - lens.at(i));
        }
        return mp;
    }
}

int main(){
    ll n;
    cin >> n >> tgt.at(0) >> tgt.at(1) >> tgt.at(2);
    ls.resize(n, 0);
    for(int i = 0; i < n; ++i){
        cin >> ls.at(i);
    }
    used.resize(n, 0);
    cout << dfs(0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


enum Type{
	None,
	TATE,
	YOKO,
};

int N;
char table[2][55];

int main(){

	scanf("%d",&N);

	for(int row = 0; row < 2; row++){

		scanf("%s",table[row]);
	}

	ll ans;
	int loc;
	Type pre;

	if(table[0][0] == table[1][0]){

		pre = TATE;
		ans = 3;
		loc = 1;

	}else{

		pre = YOKO;
		ans = 6;
		loc = 2;
	}

	while(loc <= N-1){

		if(table[0][loc] == table[1][loc]){

			if(pre == TATE){

				ans *= 2;
				ans %= MOD;
			}else{

				ans *= 1;
			}

			pre = TATE;
			loc++;

		}else{

			if(pre == TATE){

				ans *= 2;
				ans %= MOD;
			}else{

				ans *= 3;
				ans %= MOD;
			}

			pre = YOKO;
			loc += 2;
		}
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {

	int n, k;
	cin >> n >> k;
	if (n % k == 0) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string str; 
int cnt[27],ans;
int main()
{
	cin>>str;
	for(int i=0;i<4;i++)
	{
		cnt[str[i]-'A'+1]++;
		if(cnt[str[i]-'A'+1]==1) ans++;
	}
	if(ans==2)
		printf("Yes");
	else printf("No");
	return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define ul unsigned long long

int main() {
  ll x[5];
  rep(i,5){
    cin >> x[i];
    if(!x[i]){
      cout << i+1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

//--------------------------

int main() {

  double l, a;
  cin >> l;

  a = l/3.0;

  cout << fixed;
  cout << setprecision(8) << a*a*a << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
boin vowel
other consonant
 */
char c;

int main(){
  cin >> c;
  char vowel[] = "aiueo";
  bool f = false;
  REP(i,5){
    if(vowel[i]==c)
      f = true;
  }

  if(f)
    cout << "vowel\n";
  else
    cout << "consonant\n";

  return 0;
}


Measured memory_bytes: 256
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 998244353
#define fr first
#define se second
#define endl "\n"
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE

signed main()
{   



      
      senky_bansal
      IIIT_ALLAHABAD
      
      pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
          
          ll n,m,k;
          cin>>n>>m>>k;
          ll ans = 0;
          for(int i=0;i<=k;i++)
          {
               ll p1 = ncr(n-1,i);
               p1 = (p1*m)%mod;
               p1*=power(m-1,n-i-1);
               p1%=mod;
               ans+=p1;
               ans%=mod;
          } 
          cout<<ans<<endl;
         

      }
      






}



























Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b,N,M,K,S,T,X,Y,Z;
  cin >> a >> b;
 
  int int_a = atoi(a.c_str());
  int int_b = atoi(b.c_str());
  //cout << int_a << int_b << endl;
  if(int_a > int_b){
      for(int i=0; i < int_a;i++){
              cout <<  b;
      }
      cout << endl;

  }else{
      for(int i=0; i < int_b;i++){
              cout <<  a;
      }
      cout << endl;
  }
}

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

int main() {
    string code =  "CODEFESTIVAL2016";
    string s;
    cin >> s;
    int count = 0;
    for(int i=0;i<code.size();i++){
        if(code[i]!=s[i])count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    int n; sc(n);
    int a[n], b[n], c[n-1];
    sca(a, n); sca(b, n); sca(c, n-1);
    int ans = 0;
    fo(i, n) ans += b[i];
    fo1(i, n-1) {
        if (a[i] == a[i-1] + 1) {
            ans += c[a[i]-2];
        }
    }
    cout << ans;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
import math

a,b,h,m = map(int,input().split())

b_radius = 360/60*m
h_radius = (h*60+m) *360/(12*60)

d_radius =abs(h_radius-b_radius)
c = math.sqrt(a*a -2*a*b*math.cos(math.radians(d_radius)) +b*b)
print(c)

Measured memory_bytes: 9496
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#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 sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S, T; std::cin >> S >> T;

  int ans = 0;
  rep(i,3) {
    if ( S[i] == T[i] ) ans++;
  }
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long cc;
const int N = 100005;
int n, A, B;
int h[N];
bool check(const int &m) {
    cc sum = 0;
    for (int i = 0; i < n; i++)
        if (h[i] - 1ll * m * B > 0) {
            int val = max(0ll, (h[i] - 1ll * m * B) / (A - B)  + ((h[i] - 1ll * m * B) % (A - B) > 0 ) );
            sum += val;
        }
    return sum <= m;
}
int main() {
//	freopen("input.inp", "r", stdin);
	//freopen("output.out", "w", stdout);
    //freopen("udtseq2.out", "w", stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int lo = 0, hi = 1000000000;

    cin >> n >> A >> B;
    for (int i = 0; i < n; i++) cin >> h[i];
    //cout << check (800000001) << " sda\n";
    while (lo <= hi) {
        int mi = (lo + hi) >> 1;
        if (check(mi))
            hi = mi - 1;
        else
            lo = mi + 1;
    }
    cout << hi + 1;
    return 0;
}


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

int n;
const int MAX_N = 1000001;
vector<int> d(MAX_N, 0); //添字が入力された回数

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

int main() {
  cin >> n;
  vector<int> a(n, 0);
  
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    d[a[i]]++;
  }
  
  bool pairwise = true;
  for (int i = 2; i <= MAX_N; i++) {
    int cnt = 0;
   	for (int j = i; j <= MAX_N; j += i) {
      if (d[j] > 0) cnt += d[j];
    }
    
    if (cnt > 1) {
      pairwise = false;
      break;
    }
  }
  
  if (pairwise) {
    cout << "pairwise coprime";
    return 0;
  }
  
  int g = 0;
  for (int i = 0; i < n; i++) {
    g = gcd(a[i], g);
  }
  
  if (g == 1) {
    cout << "setwise coprime";
    return 0;
  }
  
  cout << "not coprime";
  return 0;
}

Measured memory_bytes: 10688
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long ans = 0;

            int N = int.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');

            int[] X = new int[N];

            for (int i = 0; i < N; i++)
            {
                X[i]= int.Parse(s[i]) -i;
            }

            Array.Sort(X);

            int Mid = 0;

            if (N % 2 == 1)
                Mid = X[(N - 1) / 2];
            else
                Mid = (X[(N - 2) / 2] + X[N / 2]) / 2;

            for(int i=0;i<N;i++)
            {
                ans += Math.Abs(X[i] - Mid);
            }

            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 30048
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

colors = []
over = 0

for a in A:
    if 1 <= a <= 399:
        colors.append("gray")
    if 400 <= a <= 799:
        colors.append("brawn")
    if 800 <= a <= 1199:
        colors.append("green")
    if 1200 <= a <= 1599:
        colors.append("water")
    if 1600 <= a <= 1999:
        colors.append("blue")
    if 2000 <= a <= 2399:
        colors.append("yellow")
    if 2400 <= a <= 2799:
        colors.append("orange")
    if 2800 <= a <= 3199:
        colors.append("red")
    if 3200 <= a:
        over += 1

counter = Counter(colors)

if len(A) == over:
    print(1, over)
    exit()

if over > 0:
    max_num = len(counter) + over
    print(len(counter), max_num)
else:
    print(len(counter), len(counter))


Measured memory_bytes: 3316
from collections import defaultdict
n, x, m = map(int, input().split())
now = x
ans = x
d = defaultdict(int)
repeat = []

for i in range(n):
    now = (now**2)%m
    d[now] += 1
    repeat.append(now)
    if d[now] > 1:
        break

for g in range(len(repeat)):
    if repeat[g] == now:
        break
    else:
        ans += repeat[g]
        n -= 1

repeat = repeat[g:-1] 
n -= 1
if len(repeat) != 0:
    ans += sum(repeat)*(n//len(repeat)) + sum(repeat[:n%len(repeat)])
print(ans)


Measured memory_bytes: 81360
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			long[] a = new long[N];
			for (int i = 0; i < N; i++) {
				a[i] = Long.parseLong(sc.next());
			}
			for (int i = K + 1; i <= N; i++) {
				if (a[i - 1] > a[i - 1 - K]) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
		}
	}
}

Measured memory_bytes: 61940
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt.txt","r",stdin);
	// freopen("output.txt.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	double p[n];
	rep(i,0,n) cin>>p[i];
	double dp[n][n+1];
	rep(i,0,n)
	{
		rep(j,0,n+1)
		{
			dp[i][j] = 0;
			if(i==0)
			{ 
				if(j==0) dp[i][j] = 1-p[0];
				if(j==1) dp[i][j] = p[0];
				continue;
			}
			if(j>=1)
			dp[i][j] += dp[i-1][j-1]*p[i];
			dp[i][j] += dp[i-1][j]*(1-p[i]);

		}
	}
	double ans = 0;
	for(int j=n/2+1;j<=n;j++)
		ans+= dp[n-1][j];
	cout<<fixed<<setprecision(20)<<ans<<endl;


}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    ll a, b;
    cin >> a >> b;
    if (a > b) cout << "a > b" << endl;
    else if (a < b) cout << "a < b" << endl;
    else cout << "a == b" << endl;
    return 0;
}


Measured memory_bytes: 3168
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

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

    int max_gap = 0;
    for (int i = 1; i < n; i++) {
        max_gap = max(a[i] - a[i - 1], max_gap);
    }
    max_gap = max(a[0] + k - a[n - 1], max_gap);

    const int ans = k - max_gap;
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;

    cout << (X - Z) / (Y + Z) << endl;


}

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

int main(){
  string n;
  cin>>n;
  if((n[0]==n[1]&&n[1]==n[2])||(n[1]==n[2]&&n[2]==n[3]))
    cout<<"Yes";
  else
  {
    cout<<"No";
  }
  
  
  return 0;
}

Measured memory_bytes: 256
import bisect
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N):
    for k in range(i+1,N):
        tmp = bisect.bisect_left(a,a[i]+a[k])
        ans += tmp - k - 1
print(ans)

Measured memory_bytes: 42972
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 100000000;
typedef pair<int, int> P;
const int MAX_N = 1000000;



int main() {
	int a, b;
	cin >> a >> b;
	if (a>0&&b>0)
	{
		cout << "Positive" << endl;
	}
	else if ((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) {
		cout << "Zero" << endl;
	}
	else {
		if ((b+1-a)%2==1)
		{
			cout << "Negative" << endl;
		}
		else {
			cout << "Positive" << endl;
		}
		
	}
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define X first
#define Y second
#define LL long long
#define MP make_pair
#define PB push_back
#define SZ(a) (LL)(a.size())
const LL INF = 1000 * 1000 * 1000 + 47;
const LL LINF = INF * (LL)INF;
using namespace std;
const LL MAX = 200005;
const LL MAGIC = 50;
int pref[MAX] , a[MAX] , pzdc[MAX];
int s(int l , int r)
{
	if(l > r)
		return 0;
	return pref[r] - (l ? pref[l - 1] : 0);
}
int main() 
{
	int N , K;
	cin >> N >> K;
	__int128 ans = N - K + 1;
	for(int i = 0; i < N; i++)
		cin >> a[i];
	for(int i = 0; i < N - 1; i++)
		pref[i] = (a[i] > a[i + 1]) + (i ? pref[i - 1] : 0);
	bool first = true;
	for(int i = 0; i < N - K + 1; i++)
		if(s(i , K - 2 + i) == 0)
		{
			pzdc[i] = !first;
			first = false;
		}
	set<int> s;
	for(int i = 0; i < K; i++)
		s.insert(a[i]);
	for(int i = 0; i < N - K; i++)
	{
		s.insert(a[i + K]);
		if(*s.begin() == a[i] && *(--s.end()) == a[i + K])
			pzdc[i + 1] = 1;
		s.erase(a[i]);
	}
	for(int i = 0; i < N - K + 1; i++)
		ans -= pzdc[i];
	cout << (int)ans;
			
	return 0;
}


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

using namespace std;

using int64 = long long;

int main() {
  int N;
  double sum = 0;
  cin >> N;
  for(int i = 0; i < N; i++) {
    double x;
    string t;
    cin >> x >> t;
    if(t == "JPY") sum += x;
    else sum += x * 380000;
  }
  cout << fixed << setprecision(10) << sum << endl;
}


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

int main(){
	int a,b;
	cin >> a >> b;
	cout << "a ";
	if(a<b) cout << "< ";
	if(a==b) cout << "== ";
	if(a>b) cout << "> ";
	cout << "b" << endl;
	
	
	return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x+r>H||y+r>H||x-r<0||y-r<0){printf("No\n");
}else{printf("Yes\n");}

    return 0;
}

Measured memory_bytes: 584
Option Strict On
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim s As String = ReadLine()

        Dim best As Integer = 0
        Dim cnt As Integer = 0
        Dim flg As Boolean = False

        For Each v As Char In s
            If v = "A"c Then flg = True
            If flg Then cnt += 1
            If flg AndAlso v = "Z"c Then best = cnt
        Next

        WriteLine(best)
    End Sub

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 15836
n,k = gets.chomp.split.map(&:to_i)
as = gets.chomp.split.map(&:to_i)

reached = Array.new(n,0)
cnt = 0
idx = 0
while reached[idx] == 0
	reached[idx] = cnt
	idx = as[idx] - 1
	cnt += 1
end
loop_num = cnt - reached[idx]

if cnt > k
	puts reached.index(k) + 1
else
	puts reached.index((k-cnt)%loop_num + reached[idx]) + 1
end

Measured memory_bytes: 30124
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

struct Point{
	double x,y;
};

int main(){

	int n,max,count;
	Point point[100];

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		max = 0;

		for(int i = 0; i < n; i++){
			scanf("%lf,%lf",&point[i].x,&point[i].y);
		}

		for(double i = 0; i <= 10; i += 0.1){
			for(double k = 0; k <= 10; k+=0.1){
				count = 0;
				for(int p = 0; p < n; p++){
					if(sqrt((i-point[p].x)*(i-point[p].x)+(k-point[p].y)*(k-point[p].y)) < 1 ||
							fabs(sqrt((i-point[p].x)*(i-point[p].x)+(k-point[p].y)*(k-point[p].y))-1) < 0.00000001){
						count++;
					}
				}
				max = (max >= count)?max:count;
			}
		}

		printf("%d\n",max);

	}

	return 0;
}

Measured memory_bytes: 2744
import sys
input = sys.stdin.readline

n = int(input())
edges = []

for id in range(n-1):
    a, b = map(int, input().split())
    edges.append([a-1, b-1, id])

edges.sort()

used = [0]*(n)
ans = [0]*(n-1)
num = 1
prev = 0
for edge in edges:
    _from, to, id = edge
    if _from != prev:
        num = 1
    if used[_from] == num:
        num += 1
    ans[id] = num
    used[to] = num
    num += 1
    prev = _from

print(max(ans))
for color in ans:
    print(color)


Measured memory_bytes: 25184
#include <stdio.h>

int	main(void)
{
  	char	s[100];
  	char	t[100];
  
  	int		num;
  
  	num = scanf("%s %s", s, t);
  	if (num != 2)
      	return (0);
  
  	printf("%s%s", t, s);
  	return (0);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <math.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <stdlib.h>
#include <time.h> 
#include <assert.h>

#define nmax 500010
#define eps 1e-8
#define MOD 1000000007

#define P1 25671
#define P2 191
#define MOD1 666013
#define MOD2 1000000007
#define B_SIZE 315

#define SZ(x) ((int)(x.size()))

#define fst first
#define snd second
#define pb push_back
#define mp make_pair

using namespace std;

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

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

int n;
ll tree[nmax * 3];
ll dp[nmax];
pii p[nmax];

ll query(int node, int l, int r, int lq, int rq)
{
	if (rq < lq) return 0;
	if (l >= lq && r <= rq) return tree[node];

	ll sum = 0;
	int m = (l + r) / 2;

	if (lq <= m) sum = max(sum, query(node * 2, l, m, lq, rq));
	if (rq > m) sum = max(sum, query(node * 2 + 1, m + 1, r, lq, rq));

	return sum;
}

void update(int node, int l, int r, int pos, ll val)
{
	if (l == r) {

		tree[node] = val;
		
		return;
	}

	int m = (l + r) / 2;

	if (pos <= m) update(node * 2, l, m, pos, val); else
		update(node * 2 + 1, m + 1, r, pos, val);

	tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}

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

	for (int i = 1; i <= n; i++) scanf("%d", &p[i].fst);
	for (int i = 1; i <= n; i++) scanf("%d", &p[i].snd);

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

		int h = p[i].fst;
		int v = p[i].snd;

		dp[i] = query(1, 1, n, 1, h - 1) + v;

		update(1, 1, n, h, dp[i]);
	}
	
	ll answer = 0;

	for (int i = 1; i <= n; i++) answer = max(answer, dp[i]);

	printf("%lld", answer);

	return 0;
}

Measured memory_bytes: 12032
#include <stdio.h>

int main() {
    int n, i;
    scanf("%d", &n);
    for (i=1; i<=n; i++) {
        if (i%3==0) {
            printf(" %d", i);
        }else if(i%10==3 || i/10%10==3 || i/100%10==3 || i/1000%10==3){
            printf(" %d", i);
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <fstream>

using namespace std;

ifstream fin("../data.txt");

string s;

int main() {

  getline(cin, s);
  int a = 0, b = s.size() - 1;
  while(s[a] != 'A' || s[b] != 'Z') {
    if (s[a] != 'A') a++;
    if (s[b] != 'Z') b--;
  }

  cout << b - a + 1;

  return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define F first
#define S second
#define MP make_pair
#define PB push_back

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	ll n,m;
	while(rl2(n,m),n,m)
	{
		if(n==0&&m==0)
			break;
		//vector<vector<ll>> arr(50,vector<ll>(1000));
		ll arr[50][1000];
		fr(i,0,m)
			fr(j,0,n)
				rl(arr[i][j]);
		ll mx=0;
		fr(i,0,n)
		{
			ll sum=0;
			fr(j,0,m)
			{
				sum+=arr[j][i];
			}
			mx=max(mx,sum);
		}
		wl(mx);
		NL;
	}

	return 0;
}


Measured memory_bytes: 3548
using System;
using System.Linq;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var S = Read();

        var reg = new Regex("[^ACGT]");

        var div = reg.Split(S);
        Console.WriteLine(div.Max(_ => _.Length));

    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}



Measured memory_bytes: 15960
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
#define S 21 
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){ll ans=1,l=2;rep(i,0,min(n-r,r)){ans*=(n-i);while(ans%l==0&&l<=min(r,n-r)){ans/=l;l++;}}return ans;}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}//素数の時true
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*行列のコピー*/void matcpy(ll a[S][S],ll b[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)b[i][j]=a[i][j];/*(aをbに)*/i=t;}
/*行列のリセット*/void matrst(ll a[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)a[i][j]=0;i=t;}
/*行列の2乗*/void matpow(ll a[S][S]){ll ans[S][S];matrst(ans);ll t=i,k;rep(i,0,S)rep(j,0,S)rep(k,0,S)ans[i][j]+=a[i][k]*a[k][j];matcpy(ans,a);i=t;}
/*行列の乗算*/void matmul(ll a[S][S],ll b[S][S], ll as[S][S]){ll t=i,k;matrst(as);rep(i,0,S)rep(j,0,S)rep(k,0,S)as[i][j]+=a[i][k]*b[k][j];i=t;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll n,k; 
 cin>>n>>k;
 ll tmp=0,ans=0,t,now,before=0,b2;
 rep(i,0,n){
  cin>>t;
  b2=t;
  t-=before;
  before=b2;
  if(t<k)ans+=t;
  else ans+=k;
 }
 pr(ans+k);
return 0;}

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

int main() {
  int w,n;
  cin >> w >> n;
  int array[w];
  for (int i = 0; i < w; i++) array[i] = i+1;
  for (int i = 0; i < n; i++) {
    int a,b,tmp;
    char c;
    cin >> a >> c >> b;
    tmp = array[a-1];
    array[a-1] = array[b-1];
    array[b-1] = tmp;
  }
  for (int i = 0; i < w; i++) cout << array[i] << endl;
  return 0;
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
typedef pair<int,int> pii;

int main(){
    int a, b, c;
    int cnt = 0, ans = 0;
    string S;
    int v[10];

    cin >> a >> b;
    if(a * 500 >= b) cout << "Yes\n";
    else cout << "No\n";
}

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

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 1e6;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int  n , x ,t ; cin >> n >> x >> t;
    int cr = 0 , ans  = 0 ;
    while (cr < n ) {
        ans +=  t ;
        cr += x;
    }
    cout << ans << endl ;

}

Measured memory_bytes: 3660
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll W,a,b;
    cin >> W >> a >> b;
    if(a > b) swap(a,b);
    cout << max(0LL,b-a-W)<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> A(n);
    int sum = 0;
    for(int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        A[i] = x;
        sum += x;
    }
    sort(A.rbegin(), A.rend());
    int vote = A[m - 1];
    double mn_vote = 1.0 / (4 * m) * sum;
    if(vote >= mn_vote) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;

}



Measured memory_bytes: 256
from bisect import bisect_right, bisect_left
n = int(input())
l = list(map(int, input().split()))
count = 0
l.sort()
for i in range(n-2):
    for j in range(i+1, n-1):
        count += bisect_left(l, l[i]+l[j]) -j -1
print(count)

Measured memory_bytes: 3188
H, W = map(int, input().split())
S = ['.' + input() + '.' for _ in range(H)]
S = ['.' * (W+2)] + S + ['.' * (W+2)]

flag = 'Yes'
for i in range(1, H+1):
	for j in range(1, W+1):
		if S[i][j] == '#':
			if S[i-1][j] == '.' and S[i+1][j] == '.' and S[i][j-1] == '.' and S[i][j+1] == '.':
				flag = 'No'
print(flag)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {

	int a,b,c;
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	
	if(a<b && b<c){
		printf("Yes\n");
	}
	else{
		printf("No\n");

	}
	return 0;
}

Measured memory_bytes: 580
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
count=[False]*n
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for i in range(d):
        count[a[i]-1]=True
ans=0
for i in count:
    if not i:
        ans+=1
print(ans)

Measured memory_bytes: 67760
# coding: utf-8
# Your code here!

s = set(input())
if (('N' in s and 'S' in s) or not('N' in s) and not('S' in s)) and (('E' in s and 'W' in s) or not('E' in s) and not('W' in s)):
    print ('Yes')
else:
    print ('No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using IIII = tuple<int, int, int, int>;

int	calc_score(int N, int M, int Q, const vector<IIII> &cons_vec,
		bitset<20> wall)
{
	int	A[10] = {};
	int	cur_A = 0;
	int	idx = 0;
	for (int i = 0; i < N + M; ++i) {
		if (wall.test(i)) {
			A[idx] = cur_A;
			++idx;
		} else {
			++cur_A;
		}
	}
	int	a, b, c, d;
	int	score = 0;
	for (int i = 0; i < Q; ++i) {
		tie(a, b, c, d) = cons_vec.at(i);
		if (A[b] - A[a] == c)
			score += d;
	}
	return score;
}

int dfs(int N, int M, int Q, const vector<IIII> &cons_vec,
		int idx, bitset<20> wall)
{
	if (idx == N + M) 
		return calc_score(N, M, Q, cons_vec, wall);
	int	num_wall = wall.count();
	int	score;
	int	max_score = 0;
	if (idx - num_wall < M) {
		wall.reset(idx);
		score = dfs(N, M, Q, cons_vec, idx + 1, wall);
		if (max_score < score)
			max_score = score;
	}
	if (idx > 0 && num_wall < N) {
		wall.set(idx);
		score = dfs(N, M, Q, cons_vec, idx + 1, wall);
		if (max_score < score)
			max_score = score;
		wall.reset(idx);
	}
	return max_score;
}

int	main()
{
	int	N, M, Q;
	cin >> N >> M >> Q;
	int	a, b, c, d;
	vector<IIII>	cons_vec(Q);
	for (int i = 0; i < Q; ++i) {
		cin >> a >> b >> c >> d;
		--a; --b;
		cons_vec.at(i) = make_tuple(a, b, c, d);
	}
	bitset<20>	wall(0);
	int	score = dfs(N, M, Q, cons_vec, 0, wall);
	cout << score << endl;
}



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

int main(){
  long long n,m;
  cin>>n>>m;

  long long maxg = m/n + 1;
  for(long long x=maxg;x>0;x--){
    if((m-x*(n-1))>0 && (m-x*(n-1))%x==0){
      cout<<x<<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt64(scanner)
	k := getNextInt64(scanner)
	ans := n % k
	if ans > k-ans {
		ans = k - ans
	}
	fmt.Fprintln(writer, ans)
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.text.Segment;

public class Main {
	
	public static long gcd(long a, long b){
		return b == 0 ? a : gcd(b, a % b);
	}
	public static long lcm(long a, long b){
		return a / gcd(a, b) * b;
	}
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			long[] array = new long[N];
			for(int i = 0; i < N; i++){
				array[i] = sc.nextLong();
			}
			
			long lcm = 1;
			for(int i = 0; i < N; i++){
				lcm = lcm(lcm, array[i]);
			}
			
			System.out.println(lcm);
			
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N,M,X,Y;
    cin>>N>>M>>X>>Y;
    int x[N],y[M];
    for(int i=0;i<N;i++){
        cin>>x[i];
    }
    for(int j=0;j<M;j++){
        cin>>y[j];
    }
    sort(x,x+N);
    sort(y,y+M);
    int max=x[N-1];
    int min=y[0];
    bool ans=false;
    for(int i=X+1;i<=Y;i++){
        if(i>max&&i<=min) ans=true;
    }
    if(ans==true) cout<<"No War";
    else cout<<"War";
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	s;

	m = INF;
	cin >> n;
	for(i=0;i<n;i++) {
		cin >> a;
		if (m > a) ans++;
		m = min(m , a);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
using ll = long long int;

int main(void) {
	string s;
	cin >> s;
	string ret;
	if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
		ret = "Yes";
	}
	else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) {
		ret = "Yes";
	}
	else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) {
		ret = "Yes";
	}
	else {
		ret = "No";
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
def counting_sort(MAX):
    C = [0 for _ in range(MAX+1)]

    for i in range(N):
        C[A[i]] += 1

    for i in range(1, MAX+1):
        C[i] = C[i] + C[i-1]

    for i in range(N-1, -1, -1):
        C[A[i]] -= 1
        B[C[A[i]]] = A[i]

N = int(input())
A = list(map(int, input().split()))

MAX = 10001

B = [0 for _ in range(N)]
counting_sort(MAX)
print(" ".join(map(str, B)))


Measured memory_bytes: 241920