akhauriyash/Code-Regression huggingface dataset:
import scala.io.StdIn

object Main extends App {

  val s = StdIn.readLine()
  val t = StdIn.readLine()

  def solve(i: Int, before: String): Boolean = {
    if (i == t.length + 1) false
    else {
      val rotate = before.tail + before.head
      if (rotate == t) true
      else solve(i + 1, rotate)
    }
  }

  println(if(solve(0, s)) "Yes" else "No")
}


Measured memory_bytes: 25280
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var lrd = IO.RSInt;
            var ans = 0;
            for (int i = lrd[0]; i <= lrd[1]; i++)
            {
                if (i % lrd[2] == 0) ans++;
            }
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 19100
k = int(input())
a, b = (int(val) for val in input().split(' '))

if abs(a-b) > k:
    print("OK")
else:
    found = False
    for number in range(a, b+1):
        if number % k == 0:
            print("OK")
            found = True
            break
    if not found:
        print("NG")

Measured memory_bytes: 9184
N,M = map(int, input().split())
H=list(map(int, input().split()))
h=[1 for _ in range(N)]

for i in range(M):
  A=list(map(int, input().split()))
  Ah = H[A[0]-1]
  Bh = H[A[1]-1]
  if Ah >= Bh:
    h[A[1]-1]=0
  if Ah <= Bh:
    h[A[0]-1]=0
print(sum(h))


Measured memory_bytes: 19964
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    char c; cin >> c;
    cout << (char)(c+1) << endl;
}

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
  a,b=list(map(int,input().split()))
  l.append(int(a==b))
for i in range(n-2):
  if l[i] and l[i+1] and l[i+2]:
    print("Yes")
    break
else:
  print("No")

Measured memory_bytes: 9164
#include <iostream>
#include <cmath>

using namespace std;
int x,a,b;
int main()
{
    cin >> x >> a >> b;
    a=abs(a-x);
    b=abs(b-x);
    if(a>b)
        cout << "B";
    else
        cout << "A";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,L;
  
   vector<char>str(3);
  
    for(int i=0; i<3; i++){
        cin>>str.at(i);
     }
  int count=0;
    for(int i=0; i<3; i++){
        if(str.at(i)=='A')
          count++;
    }
  if(count==3 || count==0)
    cout << "No";
  else
    cout << "Yes";
}

Measured memory_bytes: 256
s=input()
k=int(input())

abc='abcdefghijklmnopqrstuvwxyz'

def dfs(keta,ns):
  global cnt
  if ns in s:
    cnt+=1
  if cnt==k:
    print(ns)
    exit()
  if keta==k:
    return

  for i in abc:
    dfs(keta+1,ns+i)

cnt=0
for i in abc:
  if i not in s:
    continue
  dfs(1,i)

Measured memory_bytes: 9140
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
  int a = 0;
  int b = 0;
  cin >> a >> b;
  if(a % b == 0){
    cout << a / b << endl;
  }
  else{
    cout << a / b + 1 << endl;
  }
  return 0;
}

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

void aoki(char c, int &l, int &r, int &u, int &d)
{
    if(c == 'L') r = min(W, r+1);
    else if(c == 'R') l = max(1, l-1);
    else if(c == 'U') d = min(H, d+1);
    else if(c == 'D') u = max(1, u-1);
}
void takahashi(char c, int &l, int &r, int &u, int &d)
{
    if(c == 'L') l++;
    else if(c == 'R') r--;
    else if(c == 'U') u++;
    else if(c == 'D') d--;
}

int main()
{
    int n, sr, sc;
    string s, t;
    cin >> H >> W >> n >> sr >> sc >> s >> t;

    int l = 1;
    int r = W;
    int u = 1;
    int d = H;
    for(int i = n-1; i >= 0; i--)
    {
        aoki(t[i], l, r, u, d);
        takahashi(s[i], l, r, u, d);
        if(l > r || u > d)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    if(sc < l || sc > r || sr < u || sr > d)
    {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  set<int> kind;
  rep(i,0,n) {
    cin >> a[i];
    kind.insert(a[i]);
  }
  bool ok = false;
  
/*  for (auto value : kind) {
  cout << value << endl;
}
*/
  
  if(*max_element(ALL(a)) == 0 && *min_element(ALL(a)) == 0) ok = true;
  
  if(kind.size() == 2 && n%3==0){
    sort(ALL(a));
    bool ok1 = true;
    rep(i,0,n/3){
      if (a[i] != 0) ok1 = false;
    }
    if(a[n/3] == 0) ok1 = false;
    if(ok1) ok = true;
  }
  vector<int> three(3);
  
  if(kind.size() == 3 && n%3 == 0){
    bool ok2 = true;
    three[0] =*begin(kind);
    kind.erase(*begin(kind));
    three[1] =*begin(kind);
    kind.erase(*begin(kind));
    three[2] =*begin(kind);
    kind.erase(*begin(kind));
    
    sort(ALL(a));
    rep(i,0,n/3) {
      if (a[i]!=three[0]) ok2 = false;
    }
//    cout << ok2 << endl;
    rep(i,n/3,(2*n)/3) {
      if (a[i]!=three[1]) ok2 = false;
    }
//    cout << ok2 << endl;
    rep(i,(2*n)/3, n) {
      if (a[i]!=three[2]) ok2 = false;
    }
//    cout << ok2 << endl;
    
    int p,q,r;
//    cout << three[2] << endl;
    while(three[2] > 0) {
      p = three[0]%2;
      q = three[1]%2;
      r = three[2]%2;
      three[0] /= 2;
      three[1] /= 2;
      three[2] /= 2;
      if ( p+q+r != 0 && p+q+r != 2 ) break;
      if (three[2] == 0 && ok2) ok = true;
    }
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 4480
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

int main(){
    int n;
    string s;
    cin >> n >> s;
    REP(i, 0, s.size()){
        int a = int(s[i]) + n;
        if(a >= 91){a = a - 26;}
        printf("%c", a);
    }
    cout << endl;
}


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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define tc ll t;cin >> t;while(t--)

#define ff first
#define ss second
#define pb push_back
vector<ll> ans;
// void bfs(ll x,vector <bool> &visited,vector <ll> v[]){
// 	visited[x] = true;
// 	for0(i,v[x].size()){
// 		if(!visited[v[x][i]]){
// 			ans[v[x][i]] = x;
// 			dfs(v[x][i],visited,v);
// 		}
// 	}
	
// 	return;
// }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,m,x,y;
	bool flag = true;
	cin >> n >> m;
	ans.resize(n+1);
	vector <ll > v[n+1];
	for0(i,m){
		cin >> x >> y;
		v[x].pb(y);
		v[y].pb(x);
	}
	vector<bool>visited(n+1,false);
	// dfs(1,visited,v); 
	queue <ll> q;
	q.push(1);
	while(!q.empty()){
		ll z = q.front();
		q.pop();
		for0(i,v[z].size()){
			if(!visited[v[z][i]]){
				visited[v[z][i]] = true;
				q.push(v[z][i]);
				ans[v[z][i]] = z;
			}
		}
	}
	for1(i,n){
		if(!visited[i]){
			flag = false;
		}
	}
	if(flag == false){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
		forc(i,2,n){
			cout << ans[i] << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 12988
#include <stdio.h>

int main(void) 
{
	int i, j, n;
	int s;
	int value;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		printf("Case %d:\n", i + 1);
		scanf("%d", &s);
		value = s;
		for (j = 0; j < 10; j++) {
			value = ((value * value) % 1000000) / 100;
			printf("%d\n", value);
		}
	}
	return 0;
}

Measured memory_bytes: 592
def main():
    point_count = int(input())
    sums = []
    diffs = []
    for _ in range(point_count):
        x, y = [int(x) for x in input().split()]
        sums.append(x + y)
        diffs.append(x - y)
    pat_sum = abs(max(sums) - min(sums))
    pat_diff = abs(max(diffs) - min(diffs))
    return max(pat_sum, pat_diff)


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 24948
#include <iostream>

using namespace std;

int main()
{
    long long a[100005],b[100005],temp,n,n1;
    cin>>n;
    n1=n;
    while(n--) {cin>>a[n];cin>>b[n];}//从0到n-1,逆着记
    temp=0;
    while(n++<n1-1)
    {
        if((a[n]+temp)%b[n]!=0)
            temp+=(b[n]-(a[n]+temp)%b[n]);
    }
    cout<<temp;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N, H;
  cin >> N >> H;
  if (N == 1 && H == 1) {
    COUT(1);
    return 0;
  }
  if (N == 1) {
    COUT(max((ll)0, H - 2));
    return 0;
  }
  if (H == 1) {
    COUT(max((ll)0, N - 2));
    return 0;
  }
  if (N == 2) {
    COUT(0);
    return 0;
  }
  if (H == 2) {
    COUT(0);
    return 0;
  }
  COUT((N - 2) * (H - 2));
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    
    long long int n,m,k,i,ans=0,j=0;
    cin>>n>>m>>k;
    vector<long long int> a(n+1),b(m+1);
    for(i=1;i<=n;i++)
        {
            cin>>a[i];
            a[i]+=a[i-1];
        }
    for(i=1;i<=m;i++)
        {
            cin>>b[i];
            b[i]+=b[i-1];
        }
    for(i=0;i<=n;i++)
    {
        if(k-a[i]<0)
        break;
        int temp=upper_bound(b.begin(),b.end(),k-a[i])-b.begin();
        ans=max(ans,temp+i-1);
    }
    for(i=0;i<=m;i++)
    {
        if(k-b[i]<0)
        break;
        int temp=upper_bound(a.begin(),a.end(),k-b[i])-a.begin();
        ans=max(ans,temp+i-1);
    }
    cout<<ans;
}

Measured memory_bytes: 6408
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;

int main() {
	int i, j, k;
	long n, x;
	vector<long>num;
	vector<long>sasa;

	cin >> n >> x;

	for (i = 0; i < n; i++) {
		long nn;
		cin >> nn;

		num.push_back(nn);
	}


	sort(num.begin(), num.end());

	long minn = 99999999999;

	for (i = 0; i < n - 1; i++) {
		long sa = num[i + 1] - num[i];
		auto itr = find(sasa.begin(), sasa.end(), sa);
		if (itr == sasa.end()) {    
			sasa.push_back(sa);
		}
		minn = min(sa, minn);
	}

	sort(sasa.begin(), sasa.end());
	long minn2 = 9999999999;


	for (i = 0; i < n; i++) {
		long sa = abs(num[i] - x);
		minn2 = min(sa, minn2);
	}

	minn2 = min(minn, minn2);
	bool flag2 = false;

	while (true) {

		flag2 = false;

		for (i = 0; i < sasa.size(); i++) {
			if (sasa[i] % minn2 != 0) {
				minn2--;
				flag2 = true;
				break;
			}

		}

		if (flag2 == false)break;
	}

	cout << minn2 << endl;


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 1400
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String... args) {
		Main m = new Main();
		m.start();
		m.close();
	}

	private Scanner sc;
	private PrintWriter pw;

	public Main() {
		sc = new Scanner(System.in);
		pw = new PrintWriter(System.out);
	}

	private void close() { pw.flush(); pw.close(); }

	private boolean has() { return sc.hasNextInt(); }
	private int nint()    { return sc.nextInt();    }

	static int MAX = 1000000;

	boolean[] primes = new boolean[MAX];
	boolean[] isPrime = new boolean[MAX];

	private void start() {
		for(int i = 0; i < MAX; i++) {
			primes[i]  = false;
			isPrime[i] = true;
		}
		for(int i = 2; i < MAX - 1; i++) {
			if(isPrime[i]) primes[i] = true;
			for(int j = i; j < MAX; j+=i) isPrime[j] = false;
		}
		while(has()) {
			pw.println(solve());
		}
	}

	private int solve() {
		int N = nint();
		int ans = 0;
		for(int i = 0; i <= N; i++) {
			if(primes[i]) ans++;
		}
		return ans;
	}
}

Measured memory_bytes: 14000
#include <iostream>
#include <vector>
#include <set>
#include <bitset>

using namespace std;

int main(int argc, const char *argv[])
{
  int n, m;
  cin >> n >> m;

  vector<int> lamps(n);
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int s;
      cin >> s;
      s--;
      lamps[i] |= (1 << s);
    }
  }

  vector<int> p(m);
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }

  // try all switch_state
  int ans = 0;
  for (int sw_st = 0; sw_st < (1 << n); sw_st++) {
    int cnt = 0;
    for (int i = 0; i < m; i++) {
      bitset<16> bs(lamps[i] & sw_st);
      if (bs.count() % 2 != p[i]) {
        break;
      }

      cnt++;
    }

    if (cnt == m) {
      ans++;
    }
  }

  cout << ans << "\n";
  
  return 0;
}

Measured memory_bytes: 256
//2019/9/28

#include <stdio.h>

int main (void) {
    int num,border,ans=0,temp,i;
    scanf("%d %d",&num,&border);
    for (i=0;i<num;i++) {
        scanf("%d",&temp);
        if (temp>=border) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  int x;
  cin >> x;
  int ans;
  
  for(int i=x; i<100005; i++){
    if(IsPrime(i)){
      ans = i;
      break;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353 ;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	llint H,W;cin>>H>>W;
	if(H==1||W==1){cout<<1<<endl;}
	else{cout<<(H*W+1)/2<<endl;}
}

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

N, X, Y = MAP()
graph = [[] for _ in range(N)]

for i in range(N-1):
    graph[i].append(i+1)
    graph[i+1].append(i)

graph[X-1].append(Y-1)
graph[Y-1].append(X-1)

dic = defaultdict(int)
for i in range(N):
    q = deque()
    q.append(i)
    dist = [INF]*N
    dist[i] = 0
    while q:
        n = q.popleft()
        for node in graph[n]:
            if dist[node] == INF:
                dist[node] = dist[n] + 1
                q.append(node)

    for d in dist:
        dic[d] += 1

for k in range(1, N):
    print(dic[k]//2)

Measured memory_bytes: 75352
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T> using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = 20;
int L;
vector<pii> edges[MAX_N];
int main() {
  cin >> L;
  L--;
  int value = 0;
  int pow2 = 1;
  int idx = 0;
  while (true) {
    if (L < value + pow2) {
      idx--;
      break;
    }
    value += pow2;
    pow2 *= 2;
    idx++;
  }

  for (int i = 0; i < MAX_N - 1; i++) {
    edges[i].push_back(mp(i + 1, 0));
  }
  // cerr << L << " " << value << " " << idx << endl;
  if (L > 0) {
    L -= value;

    int cost = 1;
    int dest = MAX_N - 1;
    int src = dest - 1;
    for (int i = 0; i <= idx; i++) {
      edges[src].push_back(mp(dest, cost));
      cost *= 2;
      dest--;
      src = dest - 1;
    }

    int base = value;
    while (L > 0) {
      int pow2 = 1;
      int idx = 0;
      while (true) {
        if (L < pow2) {
          pow2 /= 2;
          idx--;
          break;
        }
        pow2 *= 2;
        idx++;
      }
      int dest = MAX_N - 1 - idx;
      // cerr << L << " " << pow2 << " " << idx << endl;
      // cerr << endl;
      L -= pow2;
      edges[0].push_back(mp(dest, base + 1));
      base += pow2;
    }
  }
  int N = 20;
  int M = 0;
  for (int i = 0; i < MAX_N; i++) {
    M += edges[i].size();
  }
  cout << N << " " << M << endl;
  for (int i = 0; i < MAX_N; i++) {
    for (const auto &val : edges[i]) {
      cout << i + 1 << " " << val.first + 1 << " " << val.second << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
<?php
$K = (int)fgets(STDIN) - 1;
$input = explode(",","1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51");
echo (int)$input[$K];
?>

Measured memory_bytes: 4728
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;

int main(){ 
	int N, ans = 0;
	vector<int> p(11);
	cin >> N;
	for (int i = 0; i < N; ++i){
		cin >> p[i];
	}

	sort(p.begin(), p.end(), greater<int>());

	ans += p[0] / 2;
	for (int i = 1; i < N; ++i){
		ans += p[i];
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
    int S;

    cin >> S;

    vector<int> s(4);

    for (int i = 0; i < 4; i++)
    {
        s[i]=S%10;
        S=S/10;
    }

    bool flag=false;

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

    if (flag)
    {
        cout << "Bad";
    }else{
        cout << "Good";
    }

    return 0;
}

Measured memory_bytes: 256
import numpy as np

N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = str(input())

ans = 0
for k in range(K):
    orig_str = T[k::K]
    rep_str = orig_str.replace('rr', 'r').replace('ss', 's').replace('pp', 'p')
    point = rep_str.count('r') * P + rep_str.count('s') * R + rep_str.count('p') * S
    ans += point

print(ans)

Measured memory_bytes: 21904
import sys

def main():
#     def input(): return sys.stdin.readline().rstrip()
    
    N = int(input())
    S = input()
    
    r, g, b = S.count('R'), S.count('G'), S.count('B')
    
    exce = 0
    for i in range(N):
        for j in range(i, N):
            k = 2*j - i
            if k < len(S):
                if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                    exce += 1
    print(r*g*b - exce)
    
        
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9188
#define _USE_MATH_DEFINES

//#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <vector>
    
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

//int 最大値は2147483647 > 10^9


int main(){
	ll X;cin>>X;
	for(ll A=-200;A<=200;A++){
		for(ll B=-200;B<=200;B++){
			if(A*A*A*A*A-B*B*B*B*B==X){
				cout << A << " " << B;
				return 0;
			}
		}
	}
} // end of main
    
//実行は、Opt + Ctl + N


//pythonの入力
//s, w = map(int, input().split())


Measured memory_bytes: 3632
a,b,c=map(int,input().split())
import math
d=math.radians(c)
S=a*b*math.sin(d)*(1/2)
e=math.cos(d)
x=a**2+b**2-2*a*b*e
L=a+b+math.sqrt(x)
h=2*S/a

print('{:.6f}'.format(S))
print('{:.6f}'.format(L))
print('{:.6f}'.format(h))


Measured memory_bytes: 5716
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

constexpr int N = 1005;
constexpr int LOOPED = 1e9;

vector<vector<int>> m_no(N,vector<int>(N,-1));
vector<vector<int>> m_g(N,vector<int>(N,-1));
vector<int> len(N*N,-1);
vector<vector<int>> to(N*N,vector<int>());
vector<bool> visited(N*N,false);


int dfs(int i) {
    if (visited[i]) {
        if (len[i] == -1) return LOOPED;
        else return len[i];
    }

    visited[i] = true;
    if (to[i].size() == 0) {
        len[i] = 1;
    } else {
        for(auto next:to[i]) {
            int ret = dfs(next);
            if (ret == LOOPED) return ret;
            len[i] = max(len[i],ret+1);
        }
    }

    return len[i];
}

int main(void)
{
    IOS
    int n; cin >> n;
    vector<vector<int>> v;

    REP(i,n) {
        vector<int> v2(n-1);
        REP(j,n-1) {
            cin >> v2[j];
            v2[j]--;
        }
        v.emplace_back(v2);
    }

    int m_max = 0;
    REP(i,n-1) FOR(j,i+1,n) {
        m_no[i][j] = m_max;
        m_no[j][i] = m_max;
        m_max++;
    }

    REP(i,n) REP(j,n-1) {
        m_g[i][j] = m_no[i][v[i][j]];
        if (j != 0) to[m_g[i][j-1]].emplace_back(m_g[i][j]);
    }

    int ans = 0;
    REP(i,n) {
        ans = max(ans,dfs(m_g[i][0]));
        if (ans == LOOPED) {
            ans = -1;
            break;
        }
    }

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

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

typedef long long ll;
const int maxn=1e6+10,mod=1e9+7;
int n;
ll ans,fac[maxn],finv[maxn];

inline ll c(ll n,ll m){
	if(n<0||m<0||n-m<0)
		return 0;
	return fac[n]*finv[m]%mod*finv[n-m]%mod;
}
inline ll calc(int x){
	return c(x-1,n-1-x)*fac[x]%mod*fac[n-1-x]%mod;
}

int main(){
	cin>>n;
	fac[0]=1;for(int i=1;i<=n;++i)fac[i]=fac[i-1]*i%mod;
	finv[0]=finv[1]=1;for(int i=2;i<=n;++i)finv[i]=(mod-mod/i)*finv[mod%i]%mod;
	for(int i=1;i<=n;++i)finv[i]=finv[i-1]*finv[i]%mod;
	for(int i=1;i<=n-1;++i)
		(ans+=(calc(i)-calc(i-1)+mod)%mod*i)%=mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
std::mt19937 mt{std::random_device{}()};
int main()
{
    int N;
    std::cin >> N;
    std::vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) { std::cin >> A[i]; }
    for (int i = 0; i < N; i++) { std::cin >> B[i]; }
    ll s = 0;
    std::priority_queue<ll> up;
    int si = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] < B[i]) {
            s += B[i] - A[i];
            si++;
        } else {
            up.push(A[i] - B[i]);
        }
    }
    if (s == 0) { return std::cout << 0 << std::endl, 0; }
    for (int ans = 1; not up.empty(); ans++) {
        s -= up.top();
        if (s <= 0) { return std::cout << si + ans << std::endl, 0; }
        up.pop();
    }
    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 2936
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int X;
	int ans = 0;
	
	cin>>X;
	
	for(int i = 1; ; i++){
		if(i * X %  360 == 0) {
			cout<<i<<endl;
			break;
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
const ll mod = 1e9 + 7;
const ll N = 2e6 + 7;
ll fact[N];



int main() {
	fastIO;
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		v.push_back(x);
	}
	int cost = 1e9;
	for (int i = 0; i <= 100; i++) {
		int c = 0;
		for (int j = 0; j < n; j++) {
			c += abs(v[j]-i)*(abs(v[j]-i));
		}
		cost = min(cost, c);
	}
	cout << cost;

}



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

#define ll long long
#define vecll vector<long long>
#define vecs vector<string>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  bool ok=true;
  ll x, m, c;
  cin >> x;
  if (x < 100)
	ok = false;
  else{
	c = x / 100;
	m = x % 100;
	forll(i, 0, 5){
	  c -= m / (5-i);
	  m = m % (5-i);
	  if (c < 0){
		ok = false;
		break;
	  }
	}
  }
  if (ok==true)
	cout << 1 << endl;
  else
	cout << 0 << endl;
}


Measured memory_bytes: 256
/*
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
//*/
#include <bits/stdc++.h>

using namespace std;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 1e5+100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) cout << x , exit(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;
int W;
int w , val;
int dp[maxn];

int32_t main(){
    migmig
    cin >> n >> W;
    for(int i = 1 ; i < maxn ; i ++)
        dp[i] = W + 1;
    while(n --){
        cin >> w >> val;
        for(int i = maxn-1 ; i >= val ; i --)
            dp[i] = min(dp[i] , dp[i-val] + w);
    }
    for(int i = maxn - 1 ; i >= 0 ; i --)
        if(dp[i] <= W)
            dokme(i);
    return(0);
}

Measured memory_bytes: 3976
#include<iostream>
using namespace std;
int main(){
	int n;
	int a[6]={0}; 
	cin>>n;
	for(int i=0;i<n;i++){
		double b;
		cin>>b;
		if(165.0>b){
			a[0]++;		
		}
		else if(165.0<=b&&170.0>b){
			a[1]++;
		}
		else if(170.0<=b&&175.0>b){
			a[2]++;		
		}
		else if(175.0<=b&&180.0>b){
			a[3]++;		
		}
		else if(180.0<=b&&185.0>b)
			a[4]++;
		else if(185.0<=b)
			a[5]++;
	}
	for(int i=0;i<6;i++){
		cout<<i+1<<':';
		for(int j=0;j<a[i];j++){
			cout<<'*';
		}
		cout<<endl;	
	}
}	

Measured memory_bytes: 1232
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
    long int t,a,b;
    cin>>t;
  cin>>a>>b;
    long int sum=0;
    for(int i=a;i<=b;i++){
        if(i%t==0){
            sum++;
            break;
        }
        
    }
    (sum==0?cout<<"NG\n":cout<<"OK\n");

}

Measured memory_bytes: 3568
N, A, B, C, D = map(int, input().split())
S = input()

if "##" in S[B: D - 1]:
    print("No")
    exit()
elif "##" in S[A: C - 1]:
    print("No")
    exit()

if D < C:
    if not "..." in S[B - 2: D + 1]:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3572
S = input()

cnt = 1
loc = {}
for i in range(len(S)-1):
    if S[i] == "R" and S[i + 1] == "L":
        if i%2 == 0:
            loc[cnt] = [i, i+1]
        else:
            loc[cnt] = [i+1, i]
        cnt += 1

cnt = 1
p = []
for i in range(len(S)-1):
    p.append(cnt)
    if S[i] == "L" and S[i+1] == "R":
        cnt += 1
p.append(cnt)

ans = [0] * len(p)
for i in range(0, len(S), 2):
    ans[loc[p[i]][0]] += 1

for i in range(1, len(S), 2):
    ans[loc[p[i]][1]] += 1

print(" ".join(map(str, ans)))

Measured memory_bytes: 30924
#include<stdio.h>
#include<string.h>
int a[20];
int main()
{
    int N, i;
    a[0] = 1;
    for(i=0;i<15;i++)
    {
        a[i+1] = a[i]<<1;
    }
    while(~scanf("%d",&N))
    {
        for(i=10;i>=0;i--)
        {
            if(a[i]<=N)
                break;
        }
        printf("%d\n",a[i]);
    }
    return 0;
}


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

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long a = 0) : v((a %= M) < 0 ? a + M : a) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m r) { if ((v += r.v) >= M) v -= M; return *this; }
  m& operator-=(m r) { if (v < r.v) v += M; v -= r.v; return *this; }
  m& operator*=(m r) { v = (uint64_t)v * r.v % M; return *this; }
  m& operator/=(m r) { return *this *= power(r, M - 2); }
  friend m operator+(m l, m r) { return l += r; }
  friend m operator-(m l, m r) { return l -= r; }
  friend m operator*(m l, m r) { return l *= r; }
  friend m operator/(m l, m r) { return l /= r; }
  friend bool operator==(m l, m r) { return l.v == r.v; }
  friend string to_string(m a) { return to_string(a.v); }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(2 * n);
  for (auto&& e : a) {
    cin >> e;
  }
  vector<int> idx(2 * n);
  iota(begin(idx), end(idx), 0);
  sort(begin(idx), end(idx), [&](int i, int j) {
    return a[i] < a[j];
  });
  mint res = 1;
  int t = 0;
  for (int i : idx) {
    if (i < n) {
      if (t > 0) {
        res *= t;
      }
      --t;
    } else {
      if (t < 0) {
        res *= -t;
      }
      ++t;
    }
  }
  cout << res.v << '\n';
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int tx[] = {-1,0,1,1};
int ty[] = {1,1,0,-1};

int stage[10][10];

void printStage(int N){
	for(int y=0;y<N;y++){
		for(int x=0;x<N;x++){
			printf("%3d",stage[y][x]);
		}
		printf("\n");
	}
}

int main(){
	int N;
	int idx=1;
	while(~scanf("%d",&N)){
		if(N==0) break;
		int x = 0;
		int y = 0;
		int dx=0,dy=0;
		int dir = 2;
		int prev = 2;

		stage[0][0] = 1;
		for(int num=2;num<=N*N;num++){
			dy = y + ty[dir];
			dx = x + tx[dir];
			stage[dy][dx] = num;
			//printf("dir:%d\n",dir);
			//printStage(N);

			//0:lower left 1:lower 2:right 3:upper right

			x = dx;
			y = dy;

			if(prev == 0){
				dx = x + tx[prev];
				dy = y + ty[prev];
				if(dx<0 || dx>=N || dy<0 || dy>=N){
					dir = 1;
					dx = x + tx[dir];
					dy = y + ty[dir];
				}

				if(dx<0 || dx>=N || dy<0 || dy>=N){
					dir = 2;
					dx = x + tx[dir];
					dy = y + ty[dir];
				}
			}

			else if(prev==1){
				if(x==0) dir = 3;
				else dir = 0;
			}

			else if(prev==2){
				if(y==0) dir = 0;
				else dir = 3;
			}

			else if(prev==3){
				dx = x + tx[prev];
				dy = y + ty[prev];
				if(dx<0 || dx>=N || dy<0 || dy>=N){
					dir = 2;
					dx = x + tx[dir];
					dy = y + ty[dir];
				}

				if(dx<0 || dx>=N || dy<0 || dy>=N){
					dir = 1;
					dx = x + tx[dir];
					dy = y + ty[dir];
				}
			}


			prev = dir;

			
		}
		printf("Case %d:\n",idx++);
		printStage(N);
	}
}

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

int main(void) {
  int 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: 3088
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using pint = pair<int,int>;

int main(){
    int n;
    cin >> n;
    if(n % 1000 == 0){
        cout << 0 << endl;
        return 0;
    }
    cout << 1000 - (n % 1000) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    ll n; cin >> n;
    vector<ll>h(n); 
    rep(i,n)cin >> h[i];
    h[0]--;
    rep(i,n){
        if(h[i]<h[i+1]){
            h[i+1]--;
        }
    }
    rep(i,n-1){
        if(h[i]>h[i+1]){
            cout <<"No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}




Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> s(H, vector<char>(W, 0));
    vector<vector<int>> res(H, vector<int>(W, 0));
    vector<int> cnt(H, 0);

    for(int r=0;r<H;r++){
        for(int c=0;c<W;c++){
            cin >> s[r][c];
            if(s[r][c] == '#'){
                cnt[r]++;
            }
        }
    }
    int befR = 0;
    int nowNum = 1;
    for(int r=0;r<H;r++){
        if(cnt[r] == 0){continue;}
        bool begin = false;
        for(int c=0;c<W;c++){
            if(s[r][c] == '#'){
                if(begin){//#が2回め以降に出てきたら、番号を一つすすめる。
                    nowNum ++;
                }
                begin = true;
            }
            res[r][c] = nowNum;
        }
        for(int tr=befR; tr<r; tr++){//巻き戻ってコピーする。
            for(int c=0;c<W;c++)
                res[tr][c] = res[r][c];
        }
        befR = r+1;
        nowNum++;
    }
    for(int tr=befR; tr<H; tr++){//最後の行が0だったら、
        for(int c=0;c<W;c++)
            res[tr][c] = res[befR-1][c];
    }
    for(int r=0;r<H;r++){
        for(int c=0;c<W;c++){
            cout << res[r][c] << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define eb emplace_back
#define MP make_pair
#define pb push_back
#define pf push_front
#define ins insert
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define tr(c,it) for(auto it=c.begin();it!=c.end();it++)
#define fr(i,n) for(lli i=0;i<(n);i++)
#define inc(i,a,b) for(lli i=a;i<=b;i++)
#define dec(i,a,b) for(lli i=a;i>=b;i--)
#define fr2(i,n) for(int i=0;i<(n);i++)
#define inc2(i,a,b) for(int i=a;i<=b;i++)
#define dec2(i,a,b) for(int i=a;i>=b;i--)
#define ymin(a,b)  (a=min((a),(b)))
#define ymax(a,b)  (a=max((a),(b)))
#define sz(x) (lli)(x).size()
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr<< *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long int lli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<lli,lli> plli;
typedef vector<lli> vlli;
typedef vector<int> vi;
//typedef  vector<vector<lli> >ncr(1001,vector<lli>(1001,0))
typedef vector<plli> vplli;
long long MOD=1000000009;
#define addm(x,y) (x+y>=MOD? (x+y-MOD):(x+y))
int main()
{
		#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS
	
	// int t;
	// cin>>t;
	// for(int i=1;i<=t;i++)
	// {
	// 	cout<<"Case #"<<i<<": ";
	// 	solve();

	// }
	lli d,t,s;
	cin>>d>>t>>s;
	// if(d%t==0)
	// {
	if((d+s-1)/s<=t)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	

	
	
	
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] ints = new int[n][m];
		int[] line = new int[n];
		int[] row = new int[m]; 
		int sum = 0;
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				 int temp = Integer.parseInt(sc.next());
				 ints[i][j] = temp;
				 line[i] += temp;
				 row[j] += temp;
			}
			sum += line[i];
		}
		
		for (int i=0; i<n+1; i++) {
			for (int j=0; j<m+1; j++) {
				if (i==n && j==m) {System.out.print(sum);}
				else if (j==m) {System.out.print(line[i]);}
				else if (i==n) {System.out.print(row[j]);}
				else {System.out.print(ints[i][j]);}
				if (j!=m) {System.out.print(" ");}
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 40032
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;
//========================================================================

int gcd(int a, int b);

int main() {
	
	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	


	ll N;
	cin >> N;

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

	sort(A.begin(), A.end());

	vll ruiseki(N);
	ruiseki[0] = A[0];
	for (ll i = 1; i < N; i++) {
		ruiseki[i] = A[i] + ruiseki[i - 1];
	}

	sort(ruiseki.begin(), ruiseki.end(), greater<ll>());

	ll ans = 1;
	for (ll i = 0; i < N-1; i++) {

		if (ruiseki[i] - ruiseki[i + 1] > ruiseki[i + 1] * 2) {
			cout << ans;
			return 0;
		}
		
		ans++;

	}

	cout << N;






}



Measured memory_bytes: 1792
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.List (sort, findIndex)

main :: IO ()
main = do
  [h, w] <- map read <$> words <$> getLine
  unless (h == 0 && w == 0) $ do
    putStrLn $ solve db h w
    main
  where db = sort $ do
          w <- [2..150]
          h <- [1..w-1]
          return (h^2 + w^2, h, w)
  
solve :: [(Int, Int, Int)] -> Int -> Int -> String
solve db h w = let Just i = findIndex (\(_, a, b) -> a == h && b == w) db
               in f $ db !! (i+1)
  where f (_, a, b) = unwords $ map show $ [a, b]



Measured memory_bytes: 6884
#include <stdio.h>
int main()
{
int  i,a[10001]={0},j;
	for(j=0;j<28;j++){
		scanf("%d",&i);
		a[i]=i;
	}
	for(i=1;i<=30;i++){
	if(a[i]==0){
		printf("%d\n",i);
		}
	}
	
return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int k, t;
  cin >> k >> t;
  int ans = 0;
  int prev = -1;
  priority_queue<pair<int, int>> data;
  REP(i, t) {
    int x;
    cin >> x;
    pair<int, int> p = make_pair(x, i + 1);
    data.push(p);
  }

  while (!data.empty()) {
    pair<int, int> p1 = data.top();
    data.pop();
    if (data.empty()) {
      ans += (p1.first - 1);
      break;
    }
    pair<int, int> p2 = data.top();
    data.pop();
    if (p1.first != 1) {
      pair<int, int> p = make_pair(p1.first - 1, p1.second);
      data.push(p);
    }
    if (p2.first != 1) {
      pair<int, int> p = make_pair(p2.first - 1, p2.second);
      data.push(p);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = gets.to_i
xu = N.times.map { gets.split.map(&:to_s) }
sumJPY = 0
sumBTC = 0
for y in 0..N - 1
  if xu[y][1] == 'JPY'
    sumJPY += xu[y][0].to_f
  elsif xu[y][1] == 'BTC'
    sumBTC += xu[y][0].to_f
  end
end
sumBTC = 380_000 * sumBTC
puts sumJPY + sumBTC

Measured memory_bytes: 1788